git: 9b6930c6eadb - stable/13 - kasan: disable kasan_mark() after a violation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Nov 2022 17:03:07 UTC
The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9b6930c6eadb74c0261e257d6543d9f640188733 commit 9b6930c6eadb74c0261e257d6543d9f640188733 Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2022-09-27 16:01:02 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2022-11-02 17:02:24 +0000 kasan: disable kasan_mark() after a violation Specifically, when we receive a violation and we're configured to panic, kasan_enabled gets unset before we descend into panic(). At this point, there's no longer any reason to allow marking as kasan_shadow_check() is disabled -- we have some inherent risk of faulting or panicking if the system's in a bad enough state with no benefit. Reviewed by: markj Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. (cherry picked from commit f2963b530e17c5eff66bc5f4860b1cd224d3d033) --- sys/kern/subr_asan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index 70f7e11ef8f6..bdb7fc3da368 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -251,6 +251,9 @@ kasan_mark(const void *addr, size_t size, size_t redzsize, uint8_t code) size_t i, n, redz; int8_t *shad; + if (__predict_false(!kasan_enabled)) + return; + if ((vm_offset_t)addr >= DMAP_MIN_ADDRESS && (vm_offset_t)addr < DMAP_MAX_ADDRESS) return;