bpftool fails to build its bpf parts with clang if the toolchain has stack-protection enabled - which is the case in Gentoo. Reproducible: Always Steps to Reproduce: 1. use clang-15.0.6 2. build bpftool 3. error Actual Results: clang \ -I. \ -I/tmp/portage/dev-util/bpftool-6.0.12/work/linux-6.0/tools/include/uapi/ \ -I/tmp/portage/dev-util/bpftool-6.0.12/work/linux-6.0/tools/bpf/bpftool/bootstrap/libbpf/include \ -g -O2 -Wall -target bpf -c skeleton/pid_iter.bpf.c -o pid_iter.bpf.o clang \ -I. \ -I/tmp/portage/dev-util/bpftool-6.0.12/work/linux-6.0/tools/include/uapi/ \ -I/tmp/portage/dev-util/bpftool-6.0.12/work/linux-6.0/tools/bpf/bpftool/bootstrap/libbpf/include \ -g -O2 -Wall -target bpf -c skeleton/profiler.bpf.c -o profiler.bpf.o skeleton/profiler.bpf.c:40:14: error: A call to built-in function '__stack_chk_fail' is not supported. int BPF_PROG(fentry_XXX) ^ skeleton/profiler.bpf.c:94:14: error: A call to built-in function '__stack_chk_fail' is not supported. int BPF_PROG(fexit_XXX) ^ 2 errors generated. Expected Results: Clean build
It should be okay (and upstreamable) to just jam a -fno-stack-protector into the Makefiles.
(In reply to Sam James from comment #1) > It should be okay (and upstreamable) to just jam a -fno-stack-protector into > the Makefiles. That's exactly what I've done. :)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e6371538947cff10c0d6dba0f36dd93af9b555f9 commit e6371538947cff10c0d6dba0f36dd93af9b555f9 Author: Holger Hoffstätte <holger@applied-asynchrony.com> AuthorDate: 2023-01-13 10:04:17 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-01-13 10:22:34 +0000 dev-util/bftool: fix build with clang+ssp Closes: https://bugs.gentoo.org/890638 Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com> Closes: https://github.com/gentoo/gentoo/pull/29086 Signed-off-by: Sam James <sam@gentoo.org> dev-util/bpftool/bpftool-5.19.12.ebuild | 1 + dev-util/bpftool/bpftool-6.0.12.ebuild | 5 +++++ dev-util/bpftool/files/5.19.12-no-stack-protector.patch | 14 ++++++++++++++ dev-util/bpftool/files/6.0.12-no-stack-protector.patch | 14 ++++++++++++++ 4 files changed, 34 insertions(+)
Added upstream in: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=878625e1c7a10dfbb1fdaaaae2c4d2a58fbce627 Will probably land in 6.3.