diff options
author | Sam James <sam@gentoo.org> | 2024-03-02 06:33:14 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-03-02 06:33:19 +0000 |
commit | 39340a3d3b3f93f9af613136e874f634305ee356 (patch) | |
tree | 6f337958e4bf7c8cb0851edd7d792aae804d258b /dev-debug | |
parent | sys-libs/timezone-data: backport Asia/Almaty fix (diff) | |
download | gentoo-39340a3d3b3f93f9af613136e874f634305ee356.tar.gz gentoo-39340a3d3b3f93f9af613136e874f634305ee356.tar.bz2 gentoo-39340a3d3b3f93f9af613136e874f634305ee356.zip |
dev-debug/bpftrace: fix USE=fuzzing build
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-debug')
-rw-r--r-- | dev-debug/bpftrace/bpftrace-0.20.1-r1.ebuild | 95 | ||||
-rw-r--r-- | dev-debug/bpftrace/files/bpftrace-0.20.1-fuzzer.patch | 42 |
2 files changed, 137 insertions, 0 deletions
diff --git a/dev-debug/bpftrace/bpftrace-0.20.1-r1.ebuild b/dev-debug/bpftrace/bpftrace-0.20.1-r1.ebuild new file mode 100644 index 000000000000..d4856d58d474 --- /dev/null +++ b/dev-debug/bpftrace/bpftrace-0.20.1-r1.ebuild @@ -0,0 +1,95 @@ +# Copyright 2019-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_MAX_SLOT=17 + +inherit llvm linux-info cmake + +DESCRIPTION="High-level tracing language for eBPF" +HOMEPAGE="https://github.com/iovisor/bpftrace" +MY_PV="${PV//_/}" +SRC_URI="https://github.com/iovisor/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.gh.tar.gz" +S="${WORKDIR}/${PN}-${MY_PV:-${PV}}" + +LICENSE="Apache-2.0" +SLOT="0" + +# remove keywords until build works: +# https://github.com/iovisor/bpftrace/issues/2349 +KEYWORDS="~amd64 ~arm64 ~x86" +IUSE="fuzzing test" + +# lots of fixing needed +RESTRICT="test" + +RDEPEND=" + >=dev-libs/libbpf-1.1:= + >=dev-util/bcc-0.25.0:= + >=sys-devel/llvm-10[llvm_targets_BPF(+)] + >=sys-devel/clang-10 + <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):= + <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=[llvm_targets_BPF(+)] + sys-libs/binutils-libs:= + virtual/libelf:= +" +DEPEND=" + ${COMMON_DEPEND} + dev-libs/cereal:= + test? ( dev-cpp/gtest ) +" +BDEPEND=" + app-arch/xz-utils + app-alternatives/lex + app-alternatives/yacc + virtual/pkgconfig +" + +QA_DT_NEEDED=" + usr/lib.*/libbpftraceresources.so + usr/lib.*/libcxxdemangler_llvm.so +" + +PATCHES=( + "${FILESDIR}/bpftrace-0.20.0-install-libs.patch" + "${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch" + "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch" + "${FILESDIR}/bpftrace-0.20.1-fuzzer.patch" +) + +pkg_pretend() { + local CONFIG_CHECK=" + ~BPF + ~BPF_EVENTS + ~BPF_JIT + ~BPF_SYSCALL + ~FTRACE_SYSCALLS + ~HAVE_EBPF_JIT + " + + check_extra_config +} + +pkg_setup() { + llvm_pkg_setup +} + +src_configure() { + local mycmakeargs=( + -DSTATIC_LINKING:BOOL=OFF + # bug 809362, 754648 + -DBUILD_TESTING:BOOL=$(usex test) + -DBUILD_FUZZ:BOOL=$(usex fuzzing) + -DENABLE_MAN:BOOL=OFF + ) + + cmake_src_configure +} + +src_install() { + cmake_src_install + # bug 809362 + dostrip -x /usr/bin/bpftrace + doman man/man8/*.? +} diff --git a/dev-debug/bpftrace/files/bpftrace-0.20.1-fuzzer.patch b/dev-debug/bpftrace/files/bpftrace-0.20.1-fuzzer.patch new file mode 100644 index 000000000000..a0f54e4962f3 --- /dev/null +++ b/dev-debug/bpftrace/files/bpftrace-0.20.1-fuzzer.patch @@ -0,0 +1,42 @@ +https://github.com/bpftrace/bpftrace/commit/fe6362b4e2c1b9d0833c7d3f308c1d4006b54723 + +From fe6362b4e2c1b9d0833c7d3f308c1d4006b54723 Mon Sep 17 00:00:00 2001 +From: gkamathe <73747618+gkamathe@users.noreply.github.com> +Date: Fri, 16 Feb 2024 18:19:14 +0530 +Subject: [PATCH] =?UTF-8?q?fix=20bpftrace=5Ffuzz=20error=20for=20call=20to?= + =?UTF-8?q?=20'get=5Fkernel=E2=80=A6=5Fcflags'=20(#3007)?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* fix bpftrace_fuzz error: no matching function for call to 'get_kernel_cflags' + +When compiling bpftace_fuzz we run into the following issue where 1 +argument is missing, adding the required argument + +src/fuzz_main.cpp:140:21: error: no matching function for call to 'get_kernel_cflags' + extra_flags = get_kernel_cflags(utsname.machine, ksrc, kobj); + ^~~~~~~~~~~~~~~~~ +src/utils.h:180:26: note: candidate function not viable: requires 4 arguments, but 3 were provided +std::vector<std::string> get_kernel_cflags(const char *uname_machine, + ^ +Seems fourth argument was added via 4bcee640636e268de4b938a1007fb29a8836f049 + +Signed-off-by: Gaurav Kamathe <kamathe.gaurav@gmail.com> + +--------- + +Signed-off-by: Gaurav Kamathe <kamathe.gaurav@gmail.com> +--- a/src/fuzz_main.cpp ++++ b/src/fuzz_main.cpp +@@ -137,7 +137,8 @@ int fuzz_main(const char* data, size_t sz) + kobj = std::get<1>(kdirs); + + if (ksrc != "") +- extra_flags = get_kernel_cflags(utsname.machine, ksrc, kobj); ++ extra_flags = get_kernel_cflags( ++ utsname.machine, ksrc, kobj, bpftrace.kconfig); + } + extra_flags.push_back("-include"); + extra_flags.push_back(CLANG_WORKAROUNDS_H); + |