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
This commit is contained in:
Zhenlei Huang 2023-10-12 18:14:48 +08:00
parent 51dc362d1a
commit db5d0bc868

View File

@ -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;
}
void
@ -180,7 +183,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; \