Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Oct 2023 15:04:49 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e4d86dda3413 - releng/14.0 - amd64: Zero-fill AP PCPU pages
Message-ID:  <202310221504.39MF4nrs033636@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch releng/14.0 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=e4d86dda34133fdeb8674fc8774be3c311a374b1

commit e4d86dda34133fdeb8674fc8774be3c311a374b1
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-10-16 22:40:21 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-10-22 15:01:36 +0000

    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.
    
    Approved by:    re (gjb)
    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)
    (cherry picked from commit 4533fa42ad912537a15d72068f2cfca46a465521)
---
 sys/amd64/amd64/mp_machdep.c | 5 +++--
 1 file 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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202310221504.39MF4nrs033636>