bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bpf-next] bpf: fix build without CONFIG_STACKTRACE
@ 2020-07-03  2:45 Song Liu
  2020-07-03  3:30 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Song Liu @ 2020-07-03  2:45 UTC (permalink / raw)
  To: bpf, netdev
  Cc: ast, daniel, kernel-team, john.fastabend, kpsingh, Song Liu,
	kernel test robot

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>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [bpf-next] bpf: fix build without CONFIG_STACKTRACE
  2020-07-03  2:45 [bpf-next] bpf: fix build without CONFIG_STACKTRACE Song Liu
@ 2020-07-03  3:30 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2020-07-03  3:30 UTC (permalink / raw)
  To: Song Liu
  Cc: bpf, Network Development, Alexei Starovoitov, Daniel Borkmann,
	Kernel Team, John Fastabend, KP Singh, kernel test robot

On Thu, Jul 2, 2020 at 7:45 PM Song Liu <songliubraving@fb.com> wrote:
>
> 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>

Applied. Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-03  3:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-03  2:45 [bpf-next] bpf: fix build without CONFIG_STACKTRACE Song Liu
2020-07-03  3:30 ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).