diff options
author | Josh Poimboeuf <jpoimboe@kernel.org> | 2025-03-24 14:56:07 -0700 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2025-03-25 23:00:15 +0100 |
commit | 72c774aa9d1e16bfd247096935e7dae194d84929 (patch) | |
tree | 6414b3ad438d64be2af31b615151c301e62544d3 /kernel/panic.c | |
parent | e63d465f59011dede0a0f1d21718b59a64c3ff5c (diff) |
objtool, panic: Disable SMAP in __stack_chk_fail()
__stack_chk_fail() can be called from uaccess-enabled code. Make sure
uaccess gets disabled before calling panic().
Fixes the following warning:
kernel/trace/trace_branch.o: error: objtool: ftrace_likely_update+0x1ea: call to __stack_chk_fail() with UACCESS enabled
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/a3e97e0119e1b04c725a8aa05f7bc83d98e657eb.1742852847.git.jpoimboe@kernel.org
Diffstat (limited to 'kernel/panic.c')
-rw-r--r-- | kernel/panic.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/panic.c b/kernel/panic.c index d8635d5cecb2..f9f0c5148f6a 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -832,9 +832,15 @@ device_initcall(register_warn_debugfs); */ __visible noinstr void __stack_chk_fail(void) { + unsigned long flags; + instrumentation_begin(); + flags = user_access_save(); + panic("stack-protector: Kernel stack is corrupted in: %pB", __builtin_return_address(0)); + + user_access_restore(flags); instrumentation_end(); } EXPORT_SYMBOL(__stack_chk_fail); |