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 > - 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. > >