aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/ftrace.c')
-rw-r--r--arch/x86/kernel/ftrace.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index eb6bd34582c6..1b96bfe09d42 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -977,6 +977,18 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
977 unsigned long return_hooker = (unsigned long) 977 unsigned long return_hooker = (unsigned long)
978 &return_to_handler; 978 &return_to_handler;
979 979
980 /*
981 * When resuming from suspend-to-ram, this function can be indirectly
982 * called from early CPU startup code while the CPU is in real mode,
983 * which would fail miserably. Make sure the stack pointer is a
984 * virtual address.
985 *
986 * This check isn't as accurate as virt_addr_valid(), but it should be
987 * good enough for this purpose, and it's fast.
988 */
989 if (unlikely((long)__builtin_frame_address(0) >= 0))
990 return;
991
980 if (unlikely(ftrace_graph_is_dead())) 992 if (unlikely(ftrace_graph_is_dead()))
981 return; 993 return;
982 994