From: Steven Rostedt (Google) Date: Tue, 26 Jul 2022 14:18:51 +0000 (-0400) Subject: ftrace/x86: Add back ftrace_expected assignment X-Git-Tag: baikal/mips/sdk5.9~99 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=04955c3581a3a471422ae239933d51bd6e58a8ea;p=kernel.git ftrace/x86: Add back ftrace_expected assignment commit bbadcedb9e5c2d62aa5f35202d03810a1dba6a99 upstream. When a ftrace_bug happens (where ftrace fails to modify a location) it is helpful to have what was at that location as well as what was expected to be there. But with the conversion to text_poke() the variable that assigns the expected for debugging was dropped. Unfortunately, I noticed this when I needed it. Add it back. Link: https://lkml.kernel.org/r/20220726101851.069d2e70@gandalf.local.home Cc: "x86@kernel.org" Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Andrew Morton Cc: stable@vger.kernel.org Fixes: cdfebad7bc9b ("x86/ftrace: Use text_poke()") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 74c2f88a43d0c..ceab282775461 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -93,6 +93,7 @@ static int ftrace_verify_code(unsigned long ip, const char *old_code) /* Make sure it is what we expect it to be */ if (memcmp(cur_code, old_code, MCOUNT_INSN_SIZE) != 0) { + ftrace_expected = old_code; WARN_ON(1); return -EINVAL; }