]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bpf: Fix build without CONFIG_STACKTRACE
authorSong Liu <songliubraving@fb.com>
Fri, 3 Jul 2020 02:45:37 +0000 (19:45 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 3 Jul 2020 03:21:56 +0000 (20:21 -0700)
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 <lkp@intel.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200703024537.79971-1-songliubraving@fb.com
kernel/bpf/stackmap.c

index 5ad72ab2276b39487e1abd50d9eb109d26e5baa6..a6c361ed7937ba7c30014931c4dfe9c556b3c6e9 100644 (file)
@@ -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,