]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix samples to add fake KBUILD_MODNAME
authorDaniel Borkmann <daniel@iogearbox.net>
Tue, 25 Oct 2016 22:37:53 +0000 (00:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 29 Oct 2016 18:46:12 +0000 (14:46 -0400)
commit0bf07331dd58980bd8f67fb98d15df25080decd0
tree2ca8e31b6d4d038de726eba1ed43ca26c2fad4b8
parent028f540d28fa947547fbb477c46e4c6f707a181e
bpf: fix samples to add fake KBUILD_MODNAME

Some of the sample files are causing issues when they are loaded with tc
and cls_bpf, meaning tc bails out while trying to parse the resulting ELF
file as program/map/etc sections are not present, which can be easily
spotted with readelf(1).

Currently, BPF samples are including some of the kernel headers and mid
term we should change them to refrain from this, really. When dynamic
debugging is enabled, we bail out due to undeclared KBUILD_MODNAME, which
is easily overlooked in the build as clang spills this along with other
noisy warnings from various header includes, and llc still generates an
ELF file with mentioned characteristics. For just playing around with BPF
examples, this can be a bit of a hurdle to take.

Just add a fake KBUILD_MODNAME as a band-aid to fix the issue, same is
done in xdp*_kern samples already.

Fixes: 5fc8dfb94afc ("samples/bpf: add 'pointer to packet' tests")
Fixes: 67eca47f4039 ("samples/bpf: Add tunnel set/get tests.")
Fixes: e6c8cf7ac2fb ("cgroup: bpf: Add an example to do cgroup checking in BPF")
Reported-by: Chandrasekar Kannan <ckannan@console.to>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
samples/bpf/parse_ldabs.c
samples/bpf/parse_simple.c
samples/bpf/parse_varlen.c
samples/bpf/tcbpf1_kern.c
samples/bpf/tcbpf2_kern.c
samples/bpf/test_cgrp2_tc_kern.c