Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Nov 2021 13:15:30 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: 10d94487df58 - stable/13 - kasan: Use vm_offset_t for the first parameter to kasan_shadow_map()
Message-ID:  <202111031315.1A3DFUGL055320@gitrepo.freebsd.org>

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

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

commit 10d94487df58e286a6d29b9adf39ebcc8fd2597e
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-04-29 15:39:02 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-11-02 22:17:58 +0000

    kasan: Use vm_offset_t for the first parameter to kasan_shadow_map()
    
    No functional change intended.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 20e3b9d8bd778445bb80b2be28d2fdedf7bae37e)
---
 sys/amd64/amd64/pmap.c |  2 +-
 sys/kern/subr_asan.c   | 10 +++++-----
 sys/sys/asan.h         |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index a1f3a5cdc650..353ee18a862a 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -4892,7 +4892,7 @@ pmap_growkernel(vm_offset_t addr)
 	if (addr - 1 >= vm_map_max(kernel_map))
 		addr = vm_map_max(kernel_map);
 	if (kernel_vm_end < addr)
-		kasan_shadow_map((void *)kernel_vm_end, addr - kernel_vm_end);
+		kasan_shadow_map(kernel_vm_end, addr - kernel_vm_end);
 	while (kernel_vm_end < addr) {
 		pdpe = pmap_pdpe(kernel_pmap, kernel_vm_end);
 		if ((*pdpe & X86_PG_V) == 0) {
diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c
index 2967b443d5c8..825d7d4228c0 100644
--- a/sys/kern/subr_asan.c
+++ b/sys/kern/subr_asan.c
@@ -97,18 +97,18 @@ static bool kasan_enabled __read_mostly = false;
 /* -------------------------------------------------------------------------- */
 
 void
-kasan_shadow_map(void *addr, size_t size)
+kasan_shadow_map(vm_offset_t addr, size_t size)
 {
 	size_t sz, npages, i;
 	vm_offset_t sva, eva;
 
-	KASSERT((vm_offset_t)addr % KASAN_SHADOW_SCALE == 0,
-	    ("%s: invalid address %p", __func__, addr));
+	KASSERT(addr % KASAN_SHADOW_SCALE == 0,
+	    ("%s: invalid address %#lx", __func__, addr));
 
 	sz = roundup(size, KASAN_SHADOW_SCALE) / KASAN_SHADOW_SCALE;
 
-	sva = kasan_md_addr_to_shad((vm_offset_t)addr);
-	eva = kasan_md_addr_to_shad((vm_offset_t)addr) + sz;
+	sva = kasan_md_addr_to_shad(addr);
+	eva = kasan_md_addr_to_shad(addr) + sz;
 
 	sva = rounddown(sva, PAGE_SIZE);
 	eva = roundup(eva, PAGE_SIZE);
diff --git a/sys/sys/asan.h b/sys/sys/asan.h
index c86202222c72..caa6643bda68 100644
--- a/sys/sys/asan.h
+++ b/sys/sys/asan.h
@@ -56,7 +56,7 @@
 #define	KASAN_EXEC_ARGS_FREED	0xFF
 
 void kasan_init(void);
-void kasan_shadow_map(void *, size_t);
+void kasan_shadow_map(vm_offset_t, size_t);
 
 void kasan_mark(const void *, size_t, size_t, uint8_t);
 #else /* KASAN */



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