]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ftrace/x86: Add back ftrace_expected assignment
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 26 Jul 2022 14:18:51 +0000 (10:18 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Sat, 30 Jul 2022 17:59:36 +0000 (13:59 -0400)
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" <x86@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: stable@vger.kernel.org
Fixes: cdfebad7bc9b ("x86/ftrace: Use text_poke()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
arch/x86/kernel/ftrace.c

index 5b4efc927d808b68d5d5a18adaf1991dcd6fef52..f5cdb5f675b313588cdf4b7921d76a063c49c49d 100644 (file)
@@ -91,6 +91,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;
        }