summaryrefslogtreecommitdiffstats
path: root/samples/bpf/tcbpf1_kern.c
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2016-10-26 00:37:53 +0200
committerDavid S. Miller <davem@davemloft.net>2016-10-29 14:46:12 -0400
commit96a8eb1eeed2c3485cdba198fab3a2faaec386d3 (patch)
tree2ca8e31b6d4d038de726eba1ed43ca26c2fad4b8 /samples/bpf/tcbpf1_kern.c
parente4cabca54911a6be6f2e80e48fa497c7e19019a5 (diff)
downloadlinux-stable-96a8eb1eeed2c3485cdba198fab3a2faaec386d3.tar.gz
linux-stable-96a8eb1eeed2c3485cdba198fab3a2faaec386d3.tar.bz2
linux-stable-96a8eb1eeed2c3485cdba198fab3a2faaec386d3.zip
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: 65d472fb007d ("samples/bpf: add 'pointer to packet' tests") Fixes: 6afb1e28b859 ("samples/bpf: Add tunnel set/get tests.") Fixes: a3f74617340b ("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>
Diffstat (limited to 'samples/bpf/tcbpf1_kern.c')
-rw-r--r--samples/bpf/tcbpf1_kern.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/samples/bpf/tcbpf1_kern.c b/samples/bpf/tcbpf1_kern.c
index fa051b3d53ee..274c884c87fe 100644
--- a/samples/bpf/tcbpf1_kern.c
+++ b/samples/bpf/tcbpf1_kern.c
@@ -1,3 +1,4 @@
+#define KBUILD_MODNAME "foo"
#include <uapi/linux/bpf.h>
#include <uapi/linux/if_ether.h>
#include <uapi/linux/if_packet.h>