blob: 3ad0922dba874e31278e0870652bc46975a825f8 [file] [log] [blame]
From 5633528f75bc991b50efb5468429bbe0d624c815 Mon Sep 17 00:00:00 2001
From: "Daniel T. Lee" <>
Date: Thu, 5 Dec 2019 17:01:13 +0900
Subject: [PATCH] samples: bpf: Replace symbol compare of trace_event
commit bba1b2a890253528c45aa66cf856f289a215bfbc upstream.
Previously, when this sample is added, commit 1c47910ef8013
("samples/bpf: add perf_event+bpf example"), a symbol 'sys_read' and
'sys_write' has been used without no prefixes. But currently there are
no exact symbols with these under kallsyms and this leads to failure.
This commit changes exact compare to substring compare to keep compatible
with exact symbol or prefixed symbol.
Fixes: 1c47910ef8013 ("samples/bpf: add perf_event+bpf example")
Signed-off-by: Daniel T. Lee <>
Signed-off-by: Alexei Starovoitov <>
Signed-off-by: Paul Gortmaker <>
diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c
index 16a16eadd509..749a50f2f9f3 100644
--- a/samples/bpf/trace_event_user.c
+++ b/samples/bpf/trace_event_user.c
@@ -37,9 +37,9 @@ static void print_ksym(__u64 addr)
printf("%s;", sym->name);
- if (!strcmp(sym->name, "sys_read"))
+ if (!strstr(sym->name, "sys_read"))
sys_read_seen = true;
- else if (!strcmp(sym->name, "sys_write"))
+ else if (!strstr(sym->name, "sys_write"))
sys_write_seen = true;