Skip to contentSkip to conversation

bpf: Fix build error without CONFIG_NET

PATCH Applied YueHaibing 4 participants 6 messages Oct 18, 2019

Subsystems (6)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 bpf: Fix build error without CONFIG_NET

If CONFIG_NET is n, building fails:

kernel/trace/bpf_trace.o: In function `raw_tp_prog_func_proto':
bpf_trace.c:(.text+0x1a34): undefined reference to `bpf_skb_output_proto'

Wrap it into a #ifdef to fix this.

Fixes a7658e1a4164 ("bpf: Check types of arguments passed into helpers")
---
 kernel/trace/bpf_trace.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/trace/bpf_trace.c +2 -0
index 52f7e9d..c324089 100644
@@ -1055,8 +1055,10 @@ raw_tp_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
 	switch (func_id) {
 	case BPF_FUNC_perf_event_output:
 		return &bpf_perf_event_output_proto_raw_tp;
+#ifdef CONFIG_NET
 	case BPF_FUNC_skb_output:
 		return &bpf_skb_output_proto;
+#endif
 	case BPF_FUNC_get_stackid:
 		return &bpf_get_stackid_proto_raw_tp;
 	case BPF_FUNC_get_stack:
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · YueHaibing

If CONFIG_NET is n, building fails:

kernel/trace/bpf_trace.o: In function `raw_tp_prog_func_proto':
bpf_trace.c:(.text+0x1a34): undefined reference to `bpf_skb_output_proto'

Wrap it into a #ifdef to fix this.

Fixes a7658e1a4164 ("bpf: Check types of arguments passed into helpers")
Quoted 20 lines
---
  kernel/trace/bpf_trace.c | 2 ++
  1 file changed, 2 insertions(+)
kernel/trace/bpf_trace.c +2 -0
index 52f7e9d..c324089 100644
@@ -1055,8 +1055,10 @@ raw_tp_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
  	switch (func_id) {
  	case BPF_FUNC_perf_event_output:
  		return &bpf_perf_event_output_proto_raw_tp;
+#ifdef CONFIG_NET
  	case BPF_FUNC_skb_output:
  		return &bpf_skb_output_proto;
+#endif
  	case BPF_FUNC_get_stackid:
  		return &bpf_get_stackid_proto_raw_tp;
  	case BPF_FUNC_get_stack:
maintainer
#2 lore raw
Quoted 6 lines · On Fri, 18 Oct 2019 18:11:07 +0000 Yonghong Song <[email protected]> wrote:
Quoted 5 lines · YueHaibing

If CONFIG_NET is n, building fails:

kernel/trace/bpf_trace.o: In function `raw_tp_prog_func_proto':
bpf_trace.c:(.text+0x1a34): undefined reference to `bpf_skb_output_proto'

Quoted 7 lines
Quoted 5 lines

Wrap it into a #ifdef to fix this.

Fixes a7658e1a4164 ("bpf: Check types of arguments passed into helpers")

I'm getting ready for another push to Linus. Want me to pull this into my tree?

-- Steve

maintainer
#3 lore raw
Quoted 10 lines · Steven Rostedt
Quoted 8 lines · On Fri, 18 Oct 2019 18:11:07 +0000 Yonghong Song <[email protected]> wrote:
Quoted 7 lines · YueHaibing

If CONFIG_NET is n, building fails:

kernel/trace/bpf_trace.o: In function `raw_tp_prog_func_proto':
bpf_trace.c:(.text+0x1a34): undefined reference to `bpf_skb_output_proto'

Wrap it into a #ifdef to fix this.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Fixes a7658e1a4164 ("bpf: Check types of arguments passed into helpers")

I'm getting ready for another push to Linus. Want me to pull this into my tree?

It's related to bpf-next, so only bpf-next is appropriate here. We'll take it.

Thanks,
Daniel

maintainer
#4 lore raw
Quoted 2 lines · On Fri, 18 Oct 2019 20:46:29 +0200 Daniel Borkmann <[email protected]> wrote:

It's related to bpf-next, so only bpf-next is appropriate here. We'll take it.

OK, thanks!

-- Steve

maintainer Applied
#5 lore raw
In reply to YueHaibing
Quoted 10 lines · YueHaibing

If CONFIG_NET is n, building fails:

kernel/trace/bpf_trace.o: In function `raw_tp_prog_func_proto':
bpf_trace.c:(.text+0x1a34): undefined reference to `bpf_skb_output_proto'

Wrap it into a #ifdef to fix this.

Fixes a7658e1a4164 ("bpf: Check types of arguments passed into helpers")

Applied, thanks!