git: c2be2c87dc21 - stable/13 - kasan: Add corresponding sysctl knob for loader tunable
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 19 Oct 2023 14:19:32 UTC
The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=c2be2c87dc2100b107a20ddd918ed9d74b8533e3 commit c2be2c87dc2100b107a20ddd918ed9d74b8533e3 Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2023-10-12 10:14:48 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2023-10-19 14:17:29 +0000 kasan: Add corresponding sysctl knob for loader tunable The loader tunable 'debug.kasan.disabled' does not have corresponding sysctl MIB entry. Add it so that it can be retrieved, and `sysctl -T` will also report it correctly. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42138 (cherry picked from commit db5d0bc868be669ed6588ebeccf8c02e76aabc41) (cherry picked from commit 6f8ef4d6e44ee27a08c14ab6a892ffccf332bcf7) --- sys/kern/subr_asan.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index 1b8c52c0eb8d..9c33d0187a6d 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -92,7 +92,10 @@ SYSCTL_INT(_debug_kasan, OID_AUTO, panic_on_violation, CTLFLAG_RDTUN, &panic_on_violation, 0, "Panic if an invalid access is detected"); -static bool kasan_enabled __read_mostly = false; +#define kasan_enabled (!kasan_disabled) +static bool kasan_disabled __read_mostly = true; +SYSCTL_BOOL(_debug_kasan, OID_AUTO, disabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &kasan_disabled, 0, "KASAN is disabled"); /* -------------------------------------------------------------------------- */ @@ -136,7 +139,7 @@ kasan_init(void) kasan_md_init(); /* Now officially enabled. */ - kasan_enabled = true; + kasan_disabled = false; } static inline const char * @@ -174,7 +177,7 @@ kasan_code_name(uint8_t code) #define REPORT(f, ...) do { \ if (panic_on_violation) { \ - kasan_enabled = false; \ + kasan_disabled = true; \ panic(f, __VA_ARGS__); \ } else { \ struct stack st; \