git: 1f683624df87 - main - kasan: Use kasan_md_unsupported() to check for invalid addresses

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 15 Jul 2025 12:53:08 UTC
The branch main has been updated by markj:

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

commit 1f683624df878b2e4c0187137640bf2e6662c36f
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-07-15 00:31:10 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-07-15 12:52:58 +0000

    kasan: Use kasan_md_unsupported() to check for invalid addresses
    
    The subsequent assert verifies that the address is in the kernel map
    anyway, and this removes uses of the MD DMAP_*_ADDRESS constants from MI
    code.
    
    This fixes the amd64 KASAN build after commit 4dd828c80828 ("amd64: add
    kva_layout").
    
    MFC after:      2 weeks
---
 sys/kern/subr_asan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c
index 0edb631d1475..464efda1e91a 100644
--- a/sys/kern/subr_asan.c
+++ b/sys/kern/subr_asan.c
@@ -263,8 +263,7 @@ kasan_mark(const void *addr, size_t size, size_t redzsize, uint8_t code)
 	if (__predict_false(!kasan_enabled))
 		return;
 
-	if ((vm_offset_t)addr >= DMAP_MIN_ADDRESS &&
-	    (vm_offset_t)addr < DMAP_MAX_ADDRESS)
+	if (kasan_md_unsupported((vm_offset_t)addr))
 		return;
 
 	KASSERT((vm_offset_t)addr >= VM_MIN_KERNEL_ADDRESS &&