diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-02-10 13:53:52 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-02-10 15:10:39 +0000 |
| commit | 4c23a98ba3af3a00004fd7ef54e6330b4d665d55 (patch) | |
| tree | 2b22d77f2b83d6a6cf729f66126dd164467606a7 | |
| parent | a485399f88348efbe52aad2fa9b14af8b9ae55c7 (diff) | |
asan: Use memset_early() to fill shadow memory
__builtin_memset() calls are replaced with calls to memset(), but that
can't be used before ifunc relocations are processed if the
implementation is selected at boot time. Meanwhile, the sanitizer may
emit calls to __asan_set_shadow_*() as soon as locore jumps into C code,
before ifuncs are selected.
Just unconditionally use memset_early() to work around this.
Reported by: andrew
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55079
| -rw-r--r-- | sys/kern/subr_asan.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index fee6c1a844e2..867d232198b9 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -241,7 +241,7 @@ kasan_shadow_Nbyte_fill(const void *addr, size_t size, uint8_t code) shad = (void *)kasan_md_addr_to_shad((uintptr_t)addr); size = size >> KASAN_SHADOW_SCALE_SHIFT; - __builtin_memset(shad, code, size); + memset_early(shad, code, size); } /* @@ -1168,7 +1168,7 @@ __asan_handle_no_return(void) void __asan_set_shadow_##byte(void *, size_t); \ void __asan_set_shadow_##byte(void *addr, size_t size) \ { \ - __builtin_memset((void *)addr, 0x##byte, size); \ + memset_early((void *)addr, 0x##byte, size); \ } ASAN_SET_SHADOW(00); |
