[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <udVTYZDubwdZ1jOwDdlfeD1XsbAumTc1Wji2EsIVhUByuxw5qUwxStiFMFCqfo5IuU7gJBD-Sg3QPBGi24peRtrCxUldyYeIM55JF2BzeBc=@protonmail.com>
Date: Tue, 05 Mar 2019 07:37:44 +0000
From: Hazrael <hazrael@...tonmail.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: "A call to built-in function '__stack_chk_fail' is not supported." when building BPF samples/tools
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, March 5, 2019 12:31 AM, Daniel Borkmann <daniel@...earbox.net> wrote:
> On 03/05/2019 12:18 AM, Hazrael wrote:
>
> > Hello,
> > I guess I'm taking risks by asking this here, as the problem
> > I have is definitely more likely to come from my setup, but
> > after many research I don't know where to seek help.
>
> No worries, completely fine to ask.
>
> > So here it goes : when I try building samples/bpf or
> > tools/testing/selftests/bpf/, I always end up with the following
> > error (here when compiling samples):
> > CLANG-bpf <path_to>/samples/bpf/sockex1_kern.o
> > error: <unknown>:0:0: in function bpf_prog1 i32 (%struct.__sk_buff*):
> > A call to built-in function '__stack_chk_fail' is not supported.
>
> Hm, looks like your toolchain might have stack protector enabled by
> default. Could you try with setting CFLAGS with -fno-stack-protector
> as in the below:
>
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 65e667b..ebfb3d1 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -213,6 +213,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)
>
> +EXTRA_CFLAGS += -fno-stack-protector
> ifneq ($(BTF_LLVM_PROBE),)
> EXTRA_CFLAGS += -g
> else
>
Yup, that was it ! Thanks a lot !
I feel a bit ashamed because I had seen that flag on stackoverflow for
a similar-yet-quite-different problem (forgot to mention it :/),
but tried it totally in the wrong places, and then ruled it out...
You saved me many hours of vain attempts.
I'll now try to find out if that llvm/clang behaviour is somehow specific
/related to arch and maybe propose a wiki entry for future newbies ;)
Thanks again :D
> > - I'm running Archlinux (up-to-date) / 4.20.13-arch1-1-ARCH
> > - clang 7.0.1 / gcc 8.2.1 /
> > - It happens on *_kern.c programs only
> > - I tried following steps from Cilium BPF doc, right after a fresh
> > Archlinux install
> > (https://cilium.readthedocs.io/en/v1.3/bpf/#compiling-the-kernel)
> >
> > - My kernel config matches what is required by Cilium guide.
> > - All in all, I tried with
> > - archlinux "stock" kernel
> > - many 'custom' kernels I compiled and installed (still on arch)
> > - the net and net-next trees just as in Cilium guide (still on arch,
> > fresh install)
> >
> > - It worked fine on my Slackware with 4.20.0 kernel and a random Fedora...
> >
> > So... guess that comes from my llvm/clang, but found nothing useful
> > online yet. I'm in the process of building llvm from scratch,even
> > if build parameters in llvm archlinux package don't seem odd compared
> > to what Cilium (once again :P) recommends.
> > I'm not asking for a full debug of course but if someone's here uses
> > Archlinux for BPF development and has some pointers, that would be nice !
> > And again, if that was totally the wrong place for such question, I'm
> > deeply sorry :/
> > Nicolas C.
Powered by blists - more mailing lists