git: 120a6e2459cf - stable/15 - kasan: Fix the annotation for shadow map checks in atomic_load_*

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 22 Oct 2026 17:31:43 UTC
The branch stable/15 has been updated by markj:

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

commit 120a6e2459cf7a36901b1d99af91aaf33765fa7f
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-09-25 15:19:30 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-10-22 15:45:40 +0000

    kasan: Fix the annotation for shadow map checks in atomic_load_*
    
    atomic_load_* is a read, not a write.  Otherwise KASAN will report a
    use-after-free via atomic_load_* as a write rather than a read.
    
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 0aa055edc17267c6e971d29cabeffed0b1c59c32)
---
 sys/kern/subr_asan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c
index 867d232198b9..79302d730c13 100644
--- a/sys/kern/subr_asan.c
+++ b/sys/kern/subr_asan.c
@@ -761,7 +761,7 @@ kasan_casueword(volatile u_long *base, u_long oldval, u_long *oldvalp,
 #define	_ASAN_ATOMIC_FUNC_LOAD(name, type)				\
 	type kasan_atomic_load_##name(const volatile type *ptr)		\
 	{								\
-		kasan_shadow_check((uintptr_t)ptr, sizeof(type), true,	\
+		kasan_shadow_check((uintptr_t)ptr, sizeof(type), false,	\
 		    __RET_ADDR);					\
 		return (atomic_load_##name(ptr));			\
 	}