summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorToke Høiland-Jørgensen <toke@redhat.com>2019-12-16 11:38:19 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-24 08:36:36 +0100
commitcdd5b09bcbc0c2ee8bfbdaacfe35c61fb297b8a1 (patch)
treea1e6f404018cbf868e4e9bb3b949f8a1df5fb5fb /samples
parentaf77e76625be0a16a9f1338080225d3ed39f2f28 (diff)
downloadlinux-stable-cdd5b09bcbc0c2ee8bfbdaacfe35c61fb297b8a1.tar.gz
linux-stable-cdd5b09bcbc0c2ee8bfbdaacfe35c61fb297b8a1.tar.bz2
linux-stable-cdd5b09bcbc0c2ee8bfbdaacfe35c61fb297b8a1.zip
samples/bpf: Set -fno-stack-protector when building BPF programs
[ Upstream commit 450278977acbf494a20367c22fbb38729772d1fc ] It seems Clang can in some cases turn on stack protection by default, which doesn't work with BPF. This was reported once before[0], but it seems the flag to explicitly turn off the stack protector wasn't added to the Makefile, so do that now. The symptom of this is compile errors like the following: error: <unknown>:0:0: in function bpf_prog1 i32 (%struct.__sk_buff*): A call to built-in function '__stack_chk_fail' is not supported. [0] https://www.spinics.net/lists/netdev/msg556400.html Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20191216103819.359535-1-toke@redhat.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'samples')
-rw-r--r--samples/bpf/Makefile1
1 files changed, 1 insertions, 0 deletions
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index e7ad48c605e0..6d1df7117e11 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -219,6 +219,7 @@ BTF_LLVM_PROBE := $(shell echo "int main() { return 0; }" | \
readelf -S ./llvm_btf_verify.o | grep BTF; \
/bin/rm -f ./llvm_btf_verify.o)
+BPF_EXTRA_CFLAGS += -fno-stack-protector
ifneq ($(BTF_LLVM_PROBE),)
EXTRA_CFLAGS += -g
else