[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200703024537.79971-1-songliubraving@fb.com>
Date: Thu, 2 Jul 2020 19:45:37 -0700
From: Song Liu <songliubraving@...com>
To: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>
CC: <ast@...nel.org>, <daniel@...earbox.net>, <kernel-team@...com>,
<john.fastabend@...il.com>, <kpsingh@...omium.org>,
Song Liu <songliubraving@...com>,
kernel test robot <lkp@...el.com>
Subject: [bpf-next] 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 <lkp@...el.com>
Signed-off-by: Song Liu <songliubraving@...com>
---
kernel/bpf/stackmap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 5ad72ab2276b3..a6c361ed7937b 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,
--
2.24.1
Powered by blists - more mailing lists