Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Josh Poimboeuf and committed by
Ingo Molnar
72c774aa e63d465f

+10 -1
+6
kernel/panic.c
··· 832 832 */ 833 833 __visible noinstr void __stack_chk_fail(void) 834 834 { 835 + unsigned long flags; 836 + 835 837 instrumentation_begin(); 838 + flags = user_access_save(); 839 + 836 840 panic("stack-protector: Kernel stack is corrupted in: %pB", 837 841 __builtin_return_address(0)); 842 + 843 + user_access_restore(flags); 838 844 instrumentation_end(); 839 845 } 840 846 EXPORT_SYMBOL(__stack_chk_fail);
+4 -1
tools/objtool/check.c
··· 1194 1194 "__ubsan_handle_load_invalid_value", 1195 1195 /* STACKLEAK */ 1196 1196 "stackleak_track_stack", 1197 + /* TRACE_BRANCH_PROFILING */ 1198 + "ftrace_likely_update", 1199 + /* STACKPROTECTOR */ 1200 + "__stack_chk_fail", 1197 1201 /* misc */ 1198 1202 "csum_partial_copy_generic", 1199 1203 "copy_mc_fragile", 1200 1204 "copy_mc_fragile_handle_tail", 1201 1205 "copy_mc_enhanced_fast_string", 1202 - "ftrace_likely_update", /* CONFIG_TRACE_BRANCH_PROFILING */ 1203 1206 "rep_stos_alternative", 1204 1207 "rep_movs_alternative", 1205 1208 "__copy_user_nocache",