All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] samples/bpf: Set -fno-stack-protector when building BPF programs
@ 2019-12-16 10:38 Toke Høiland-Jørgensen
  2019-12-16 15:04 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Toke Høiland-Jørgensen @ 2019-12-16 10:38 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann
  Cc: Toke Høiland-Jørgensen, netdev, bpf

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>
---
 samples/bpf/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index b00651608765..f51804ef12c3 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -234,6 +234,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),)
 	BPF_EXTRA_CFLAGS += -g
 else
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next] samples/bpf: Set -fno-stack-protector when building BPF programs
  2019-12-16 10:38 [PATCH bpf-next] samples/bpf: Set -fno-stack-protector when building BPF programs Toke Høiland-Jørgensen
@ 2019-12-16 15:04 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2019-12-16 15:04 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen
  Cc: Alexei Starovoitov, Daniel Borkmann, Network Development, bpf

On Mon, Dec 16, 2019 at 2:38 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> 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>

Applied. Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-16 15:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-16 10:38 [PATCH bpf-next] samples/bpf: Set -fno-stack-protector when building BPF programs Toke Høiland-Jørgensen
2019-12-16 15:04 ` Alexei Starovoitov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.