aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2023-10-16 22:40:21 +0000
committerMark Johnston <markj@FreeBSD.org>2023-10-20 16:02:05 +0000
commit4533fa42ad912537a15d72068f2cfca46a465521 (patch)
treeacd5ef8d657369c9f90f3f2904e81e883a80e79a
parenteb965d4f0309514893745e6cfae998495e76d941 (diff)
downloadsrc-4533fa42ad912537a15d72068f2cfca46a465521.tar.gz
src-4533fa42ad912537a15d72068f2cfca46a465521.zip
amd64: Zero-fill AP PCPU pages
At least KMSAN relies on zero-initialization of AP PCPU regions, see commit 4b136ef259ce. Prior to commit af1c6d3f3013 these were allocated with allocpages() in the amd64 pmap, which always returns zero-initialized memory. Reviewed by: kib Fixes: af1c6d3f3013 ("amd64: do not leak pcpu pages") MFC after: 3 days Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D42241 (cherry picked from commit a37e484d049758c70f2d61be0d28a115b6f2f01e)
-rw-r--r--sys/amd64/amd64/mp_machdep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index ec4501c3aeed..d506ffada4b9 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -300,11 +300,12 @@ amd64_mp_alloc_pcpu(void)
m = NULL;
if (vm_ndomains > 1) {
m = vm_page_alloc_noobj_domain(
- acpi_pxm_get_cpu_locality(cpu_apic_ids[cpu]), 0);
+ acpi_pxm_get_cpu_locality(cpu_apic_ids[cpu]),
+ VM_ALLOC_ZERO);
}
if (m == NULL)
#endif
- m = vm_page_alloc_noobj(0);
+ m = vm_page_alloc_noobj(VM_ALLOC_ZERO);
if (m == NULL)
panic("cannot alloc pcpu page for cpu %d", cpu);
pmap_qenter((vm_offset_t)&__pcpu[cpu], &m, 1);