[Patch v2 1/5] perf tests: Skip zero sample IP in object-code reading test
From: Dapeng Mi
Date: Sun Nov 08 2026 - 19:52:12 EST
The kernel may clear the sample IP to 0 when a user-space address is
expected but a kernel address is sampled due to hardware skid. A zero
sample IP causes the object-code reading test to fail incorrectly.
Skip zero sample IP values in the object-code reading test to avoid
false-positive failures.
Reported-by: kernel test robot <yi1.lai@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-lkp/202609151503.cb02f753-lkp@xxxxxxxxx
Fixes: 166f10836a65 ("perf/core: Fix kernel register info leak via hardware skid")
Signed-off-by: Dapeng Mi <dapeng1.mi@xxxxxxxxxxxxxxx>
---
tools/perf/tests/code-reading.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 130cd6021f93..7b80c4ab6916 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -546,6 +546,11 @@ static int process_sample_event(struct machine *machine, struct evlist *evlist,
goto out;
}
+ if (!sample.ip) {
+ pr_debug("kernel may clear IP to 0 in invalid cases, skip it\n");
+ goto out;
+ }
+
thread = machine__findnew_thread(machine, sample.pid, sample.tid);
if (!thread) {
pr_debug("machine__findnew_thread failed\n");
--
2.34.1