objtool, panic: Disable SMAP in __stack_chk_fail()
[ Upstream commit 72c774aa9d1e16bfd247096935e7dae194d84929 ] __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 Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8b4f2b6389
commit
0485bdf88f
@@ -832,9 +832,15 @@ device_initcall(register_warn_debugfs);
|
|||||||
*/
|
*/
|
||||||
__visible noinstr void __stack_chk_fail(void)
|
__visible noinstr void __stack_chk_fail(void)
|
||||||
{
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
instrumentation_begin();
|
instrumentation_begin();
|
||||||
|
flags = user_access_save();
|
||||||
|
|
||||||
panic("stack-protector: Kernel stack is corrupted in: %pB",
|
panic("stack-protector: Kernel stack is corrupted in: %pB",
|
||||||
__builtin_return_address(0));
|
__builtin_return_address(0));
|
||||||
|
|
||||||
|
user_access_restore(flags);
|
||||||
instrumentation_end();
|
instrumentation_end();
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__stack_chk_fail);
|
EXPORT_SYMBOL(__stack_chk_fail);
|
||||||
|
|||||||
@@ -1243,12 +1243,15 @@ static const char *uaccess_safe_builtin[] = {
|
|||||||
"__ubsan_handle_load_invalid_value",
|
"__ubsan_handle_load_invalid_value",
|
||||||
/* STACKLEAK */
|
/* STACKLEAK */
|
||||||
"stackleak_track_stack",
|
"stackleak_track_stack",
|
||||||
|
/* TRACE_BRANCH_PROFILING */
|
||||||
|
"ftrace_likely_update",
|
||||||
|
/* STACKPROTECTOR */
|
||||||
|
"__stack_chk_fail",
|
||||||
/* misc */
|
/* misc */
|
||||||
"csum_partial_copy_generic",
|
"csum_partial_copy_generic",
|
||||||
"copy_mc_fragile",
|
"copy_mc_fragile",
|
||||||
"copy_mc_fragile_handle_tail",
|
"copy_mc_fragile_handle_tail",
|
||||||
"copy_mc_enhanced_fast_string",
|
"copy_mc_enhanced_fast_string",
|
||||||
"ftrace_likely_update", /* CONFIG_TRACE_BRANCH_PROFILING */
|
|
||||||
"rep_stos_alternative",
|
"rep_stos_alternative",
|
||||||
"rep_movs_alternative",
|
"rep_movs_alternative",
|
||||||
"__copy_user_nocache",
|
"__copy_user_nocache",
|
||||||
|
|||||||
Reference in New Issue
Block a user