summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2017-12-13 10:35:37 -0800
committerDaniel Borkmann <daniel@iogearbox.net>2017-12-13 22:44:10 +0100
commitf4e2298e63d24bb7f5cf0f56f72867973cb7e652 (patch)
treefd3dc43e1d9c9c9b14784fd0c3639e2cac7cea04 /kernel
parent553a8f2f42dffc5414a82fffe55d9b8c0fbd383f (diff)
downloadlinux-f4e2298e63d24bb7f5cf0f56f72867973cb7e652.tar.gz
linux-f4e2298e63d24bb7f5cf0f56f72867973cb7e652.tar.bz2
linux-f4e2298e63d24bb7f5cf0f56f72867973cb7e652.zip
bpf/tracing: fix kernel/events/core.c compilation error
Commit f371b304f12e ("bpf/tracing: allow user space to query prog array on the same tp") introduced a perf ioctl command to query prog array attached to the same perf tracepoint. The commit introduced a compilation error under certain config conditions, e.g., (1). CONFIG_BPF_SYSCALL is not defined, or (2). CONFIG_TRACING is defined but neither CONFIG_UPROBE_EVENTS nor CONFIG_KPROBE_EVENTS is defined. Error message: kernel/events/core.o: In function `perf_ioctl': core.c:(.text+0x98c4): undefined reference to `bpf_event_query_prog_array' This patch fixed this error by guarding the real definition under CONFIG_BPF_EVENTS and provided static inline dummy function if CONFIG_BPF_EVENTS was not defined. It renamed the function from bpf_event_query_prog_array to perf_event_query_prog_array and moved the definition from linux/bpf.h to linux/trace_events.h so the definition is in proximity to other prog_array related functions. Fixes: f371b304f12e ("bpf/tracing: allow user space to query prog array on the same tp") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/events/core.c2
-rw-r--r--kernel/trace/bpf_trace.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5857c500721b..34fda6aa4606 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4725,7 +4725,7 @@ static long _perf_ioctl(struct perf_event *event, unsigned int cmd, unsigned lon
}
case PERF_EVENT_IOC_QUERY_BPF:
- return bpf_event_query_prog_array(event, (void __user *)arg);
+ return perf_event_query_prog_array(event, (void __user *)arg);
default:
return -ENOTTY;
}
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index e009b7ecf473..c5dd60cc0751 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -856,7 +856,7 @@ unlock:
mutex_unlock(&bpf_event_mutex);
}
-int bpf_event_query_prog_array(struct perf_event *event, void __user *info)
+int perf_event_query_prog_array(struct perf_event *event, void __user *info)
{
struct perf_event_query_bpf __user *uquery = info;
struct perf_event_query_bpf query = {};