Skip to content

Commit 4502789

Browse files
tohojoAlexei Starovoitov
authored andcommitted
samples/bpf: Set -fno-stack-protector when building BPF programs
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
1 parent 5615ed4 commit 4502789

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎samples/bpf/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ BTF_LLVM_PROBE := $(shell echo "int main() { return 0; }" | \
236236
readelf -S ./llvm_btf_verify.o | grep BTF; \
237237
/bin/rm -f ./llvm_btf_verify.o)
238238

239+
BPF_EXTRA_CFLAGS += -fno-stack-protector
239240
ifneq ($(BTF_LLVM_PROBE),)
240241
BPF_EXTRA_CFLAGS += -g
241242
else

0 commit comments

Comments
 (0)