Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af058ab0 authored by H. Peter Anvin's avatar H. Peter Anvin Committed by Steven Rostedt
Browse files

x86-32, ftrace: Fix static ftrace when early microcode is enabled



Early microcode loading runs C code before paging is enabled on 32
bits.  Since ftrace puts a hook into every function, that hook needs
to be safe to execute in the pre-paging environment.  This is
currently true for dynamic ftrace but not for static ftrace.

Static ftrace is obsolescent and assumed to not be
performance-critical, so we can simply test that the stack pointer
falls within the valid range of kernel addresses.

Reported-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Tested-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 59338f75
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1176,6 +1176,9 @@ ftrace_restore_flags:
#else /* ! CONFIG_DYNAMIC_FTRACE */
#else /* ! CONFIG_DYNAMIC_FTRACE */


ENTRY(mcount)
ENTRY(mcount)
	cmpl $__PAGE_OFFSET, %esp
	jb ftrace_stub		/* Paging not enabled yet? */

	cmpl $0, function_trace_stop
	cmpl $0, function_trace_stop
	jne  ftrace_stub
	jne  ftrace_stub