netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: fix build failure for kernel/trace/bpf_trace.c with CONFIG_NET=n
@ 2020-10-07  6:29 Yonghong Song
  2020-10-07 18:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Song @ 2020-10-07  6:29 UTC (permalink / raw)
  To: bpf, netdev; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team, Song Liu

When CONFIG_NET is not defined, I hit the following build error:
    kernel/trace/bpf_trace.o:(.rodata+0x110): undefined reference to `bpf_prog_test_run_raw_tp'

Commit 1b4d60ec162f ("bpf: Enable BPF_PROG_TEST_RUN for raw_tracepoint")
added test_run support for raw_tracepoint in /kernel/trace/bpf_trace.c.
But the test_run function bpf_prog_test_run_raw_tp is defined in
net/bpf/test_run.c, only available with CONFIG_NET=y.

Adding a CONFIG_NET guard for
    .test_run = bpf_prog_test_run_raw_tp;
fixed the above build issue.

Fixes: 1b4d60ec162f ("bpf: Enable BPF_PROG_TEST_RUN for raw_tracepoint")
Cc: Song Liu <songliubraving@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
---
 kernel/trace/bpf_trace.c | 2 ++
 1 file changed, 2 insertions(+)

Note: I found the above issue when I reviewed the following patch:
      https://lore.kernel.org/bpf/fcf3f659-027e-517f-086d-deb3ad33d953@fb.com/T

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index a136a6a63a71..a2a4535b6277 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1780,7 +1780,9 @@ const struct bpf_verifier_ops raw_tracepoint_verifier_ops = {
 };
 
 const struct bpf_prog_ops raw_tracepoint_prog_ops = {
+#ifdef CONFIG_NET
 	.test_run = bpf_prog_test_run_raw_tp,
+#endif
 };
 
 const struct bpf_verifier_ops tracing_verifier_ops = {
-- 
2.24.1


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

* Re: [PATCH bpf-next] bpf: fix build failure for kernel/trace/bpf_trace.c with CONFIG_NET=n
  2020-10-07  6:29 [PATCH bpf-next] bpf: fix build failure for kernel/trace/bpf_trace.c with CONFIG_NET=n Yonghong Song
@ 2020-10-07 18:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-10-07 18:00 UTC (permalink / raw)
  To: Yonghong Song; +Cc: bpf, netdev, ast, daniel, kernel-team, songliubraving

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

On Tue, 6 Oct 2020 23:29:33 -0700 you wrote:
> When CONFIG_NET is not defined, I hit the following build error:
>     kernel/trace/bpf_trace.o:(.rodata+0x110): undefined reference to `bpf_prog_test_run_raw_tp'
> 
> Commit 1b4d60ec162f ("bpf: Enable BPF_PROG_TEST_RUN for raw_tracepoint")
> added test_run support for raw_tracepoint in /kernel/trace/bpf_trace.c.
> But the test_run function bpf_prog_test_run_raw_tp is defined in
> net/bpf/test_run.c, only available with CONFIG_NET=y.
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf: fix build failure for kernel/trace/bpf_trace.c with CONFIG_NET=n
    https://git.kernel.org/bpf/bpf-next/c/ebfb4d40ed9d

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2020-10-07 18:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-07  6:29 [PATCH bpf-next] bpf: fix build failure for kernel/trace/bpf_trace.c with CONFIG_NET=n Yonghong Song
2020-10-07 18:00 ` patchwork-bot+netdevbpf

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