aboutsummaryrefslogtreecommitdiff
path: root/kernel/bpf/stackmap.c
diff options
context:
space:
mode:
authorSong Liu <[email protected]>2020-07-02 19:45:37 -0700
committerAlexei Starovoitov <[email protected]>2020-07-02 20:21:56 -0700
commit046cc3dd9a2507b8e111714807ab8bf15ea5bb70 (patch)
treefdb000010085a84b92a72deb6919b9b2e1021773 /kernel/bpf/stackmap.c
parent811d7e375d08312dba23f3b6bf7e58ec14aa5dcb (diff)
bpf: Fix build without CONFIG_STACKTRACE
Without CONFIG_STACKTRACE stack_trace_save_tsk() is not defined. Let get_callchain_entry_for_task() to always return NULL in such cases. Fixes: fa28dcb82a38 ("bpf: Introduce helper bpf_get_task_stack()") Reported-by: kernel test robot <[email protected]> Signed-off-by: Song Liu <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'kernel/bpf/stackmap.c')
-rw-r--r--kernel/bpf/stackmap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 5ad72ab2276b..a6c361ed7937 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -351,6 +351,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
static struct perf_callchain_entry *
get_callchain_entry_for_task(struct task_struct *task, u32 init_nr)
{
+#ifdef CONFIG_STACKTRACE
struct perf_callchain_entry *entry;
int rctx;
@@ -380,6 +381,9 @@ get_callchain_entry_for_task(struct task_struct *task, u32 init_nr)
put_callchain_entry(rctx);
return entry;
+#else /* CONFIG_STACKTRACE */
+ return NULL;
+#endif
}
BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map,