Commit 046cc3dd authored by Song Liu's avatar Song Liu Committed by Alexei Starovoitov

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: fa28dcb8 ("bpf: Introduce helper bpf_get_task_stack()")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200703024537.79971-1-songliubraving@fb.com
parent 811d7e37
...@@ -351,6 +351,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, ...@@ -351,6 +351,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
static struct perf_callchain_entry * static struct perf_callchain_entry *
get_callchain_entry_for_task(struct task_struct *task, u32 init_nr) get_callchain_entry_for_task(struct task_struct *task, u32 init_nr)
{ {
#ifdef CONFIG_STACKTRACE
struct perf_callchain_entry *entry; struct perf_callchain_entry *entry;
int rctx; int rctx;
...@@ -380,6 +381,9 @@ get_callchain_entry_for_task(struct task_struct *task, u32 init_nr) ...@@ -380,6 +381,9 @@ get_callchain_entry_for_task(struct task_struct *task, u32 init_nr)
put_callchain_entry(rctx); put_callchain_entry(rctx);
return entry; return entry;
#else /* CONFIG_STACKTRACE */
return NULL;
#endif
} }
BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map, BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment