Skip to contentSkip to conversation

ftrace/x86: Add back ftrace_expected for ftrace bug reports

PATCH New Steven Rostedt 1 participant 1 message Dec 9, 2022

Subsystems (3)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

PATCH 1/1 ftrace/x86: Add back ftrace_expected for ftrace bug reports

From: "Steven Rostedt (Google)" <[email protected]>

After someone reported a bug report with a failed modification due to the expected value not matching what was found, it came to my attention that the ftrace_expected is no longer set when that happens. This makes for debugging the issue a bit more difficult.

Set ftrace_expected to the expected code before calling ftrace_bug, so that it shows what was expected and why it failed.

Fixes 768ae4406a5c ("x86/ftrace: Use text_poke()")
---
 arch/x86/kernel/ftrace.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/ftrace.c +2 -0
index bd165004776d..e07234ec7e23 100644
@@ -217,7 +217,9 @@ void ftrace_replace_code(int enable)
 
 		ret = ftrace_verify_code(rec->ip, old);
 		if (ret) {
+			ftrace_expected = old;
 			ftrace_bug(ret, rec);
+			ftrace_expected = NULL;
 			return;
 		}
 	}
Signature · 1 line
2.35.1