Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Dec 2025 22:57:35 +0000
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Cc:        Hesham Almatary <Hesham.Almatary@cl.cam.ac.uk>
Subject:   git: 37e9b420b23a - stable/15 - arm64: Fix calculating kernel size for preload metadata
Message-ID:  <694486df.a1a4.1cfe0a45@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by jhb:

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

commit 37e9b420b23a4d39400a5f8d1fe0c15bc1e04230
Author:     Hesham Almatary <Hesham.Almatary@cl.cam.ac.uk>
AuthorDate: 2025-11-13 14:57:54 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-12-18 22:51:50 +0000

    arm64: Fix calculating kernel size for preload metadata
    
    Cast &end to vm_offset_t before subtracting VM_MIN_KERNEL_ADDRESS to
    ensure the resulting size is correct for PRELOAD_PUSH_VALUE.
    Previously the correct size was effectively divided by sizeof(void *).
    
    Reviewed by:    andrew
    Obtained from:  CheriBSD
    Differential Revision:  https://reviews.freebsd.org/D53699
    
    (cherry picked from commit 587490dabc649b58f0c7966e749aa80a0f16796b)
---
 sys/arm64/arm64/machdep_boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/machdep_boot.c b/sys/arm64/arm64/machdep_boot.c
index 83bd74ea7317..1c5e8189e436 100644
--- a/sys/arm64/arm64/machdep_boot.c
+++ b/sys/arm64/arm64/machdep_boot.c
@@ -106,7 +106,8 @@ fake_preload_metadata(void *dtb_ptr, size_t dtb_size)
 
 	PRELOAD_PUSH_VALUE(uint32_t, MODINFO_SIZE);
 	PRELOAD_PUSH_VALUE(uint32_t, sizeof(size_t));
-	PRELOAD_PUSH_VALUE(uint64_t, (size_t)(&end - VM_MIN_KERNEL_ADDRESS));
+	PRELOAD_PUSH_VALUE(uint64_t,
+		(size_t)((vm_offset_t)&end - VM_MIN_KERNEL_ADDRESS));
 
 	if (dtb_ptr != NULL) {
 		/* Copy DTB to KVA space and insert it into module chain. */


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?694486df.a1a4.1cfe0a45>