* [PATCH] [v4l-utils] keytable: Add -fno-stack-protector compilation option
@ 2023-02-11 22:14 Laurent Pinchart
2023-02-13 10:16 ` Sean Young
0 siblings, 1 reply; 2+ messages in thread
From: Laurent Pinchart @ 2023-02-11 22:14 UTC (permalink / raw)
To: linux-media; +Cc: Gregor Jasny, Hans Verkuil
clang may come with stack protector enabled by default, which caused
compilation errors for BPF programs:
FAILED: utils/keytable/bpf_protocols/grundig.o
/usr/lib/llvm/15/bin/clang -idirafter /usr/lib/llvm/15/bin/../../../../lib/clang/15.0.6/include -idirafter /usr/local/include -idirafter /usr/include -D__linux__ -target bpf -O2 -c ../../utils/keytable/bpf_protocols/grundig.c -o utils/keytable/bpf_protocols/grundig.o
../../utils/keytable/bpf_protocols/grundig.c:50:5: error: A call to built-in function '__stack_chk_fail' is not supported.
int bpf_decoder(unsigned int *sample)
^
1 error generated.
Disable the stack protector to fix this, as recommended in [1].
[1] https://www.spinics.net/lists/netdev/msg556400.html
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
utils/keytable/bpf_protocols/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/keytable/bpf_protocols/Makefile.am b/utils/keytable/bpf_protocols/Makefile.am
index 13be2794791b..6096c0de5813 100644
--- a/utils/keytable/bpf_protocols/Makefile.am
+++ b/utils/keytable/bpf_protocols/Makefile.am
@@ -8,7 +8,7 @@ CLANG_SYS_INCLUDES := $(shell $(CLANG) -v -E - </dev/null 2>&1 \
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }')
%.o: %.c bpf_helpers.h
- $(CLANG) $(CLANG_SYS_INCLUDES) -D__linux__ -I$(top_srcdir)/include -target bpf -O2 -c $<
+ $(CLANG) $(CLANG_SYS_INCLUDES) -D__linux__ -I$(top_srcdir)/include -target bpf -fno-stack-protector -O2 -c $<
PROTOCOLS = grundig.o pulse_distance.o pulse_length.o rc_mm.o manchester.o xbox-dvd.o imon_rsc.o raw.o samsung36.o
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [v4l-utils] keytable: Add -fno-stack-protector compilation option
2023-02-11 22:14 [PATCH] [v4l-utils] keytable: Add -fno-stack-protector compilation option Laurent Pinchart
@ 2023-02-13 10:16 ` Sean Young
0 siblings, 0 replies; 2+ messages in thread
From: Sean Young @ 2023-02-13 10:16 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media, Gregor Jasny, Hans Verkuil
On Sun, Feb 12, 2023 at 12:14:01AM +0200, Laurent Pinchart wrote:
> clang may come with stack protector enabled by default, which caused
> compilation errors for BPF programs:
>
> FAILED: utils/keytable/bpf_protocols/grundig.o
> /usr/lib/llvm/15/bin/clang -idirafter /usr/lib/llvm/15/bin/../../../../lib/clang/15.0.6/include -idirafter /usr/local/include -idirafter /usr/include -D__linux__ -target bpf -O2 -c ../../utils/keytable/bpf_protocols/grundig.c -o utils/keytable/bpf_protocols/grundig.o
> ../../utils/keytable/bpf_protocols/grundig.c:50:5: error: A call to built-in function '__stack_chk_fail' is not supported.
> int bpf_decoder(unsigned int *sample)
> ^
> 1 error generated.
>
> Disable the stack protector to fix this, as recommended in [1].
>
> [1] https://www.spinics.net/lists/netdev/msg556400.html
Looks good, applied.
I could not reproduce the problem, but the -fno-stack-protector cli option
has been supported for a very long time, and stack protection does not make
sense in a BPF context.
Thanks,
Sean
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> utils/keytable/bpf_protocols/Makefile.am | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/utils/keytable/bpf_protocols/Makefile.am b/utils/keytable/bpf_protocols/Makefile.am
> index 13be2794791b..6096c0de5813 100644
> --- a/utils/keytable/bpf_protocols/Makefile.am
> +++ b/utils/keytable/bpf_protocols/Makefile.am
> @@ -8,7 +8,7 @@ CLANG_SYS_INCLUDES := $(shell $(CLANG) -v -E - </dev/null 2>&1 \
> | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }')
>
> %.o: %.c bpf_helpers.h
> - $(CLANG) $(CLANG_SYS_INCLUDES) -D__linux__ -I$(top_srcdir)/include -target bpf -O2 -c $<
> + $(CLANG) $(CLANG_SYS_INCLUDES) -D__linux__ -I$(top_srcdir)/include -target bpf -fno-stack-protector -O2 -c $<
>
> PROTOCOLS = grundig.o pulse_distance.o pulse_length.o rc_mm.o manchester.o xbox-dvd.o imon_rsc.o raw.o samsung36.o
>
> --
> Regards,
>
> Laurent Pinchart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-13 10:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-11 22:14 [PATCH] [v4l-utils] keytable: Add -fno-stack-protector compilation option Laurent Pinchart
2023-02-13 10:16 ` Sean Young
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.