public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-debug/bpftrace/, dev-debug/bpftrace/files/
Date: Sat,  2 Mar 2024 06:33:34 +0000 (UTC)	[thread overview]
Message-ID: <1709361199.39340a3d3b3f93f9af613136e874f634305ee356.sam@gentoo> (raw)

commit:     39340a3d3b3f93f9af613136e874f634305ee356
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  2 06:33:14 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar  2 06:33:19 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39340a3d

dev-debug/bpftrace: fix USE=fuzzing build

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-debug/bpftrace/bpftrace-0.20.1-r1.ebuild       | 95 ++++++++++++++++++++++
 .../bpftrace/files/bpftrace-0.20.1-fuzzer.patch    | 42 ++++++++++
 2 files changed, 137 insertions(+)

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);
+


             reply	other threads:[~2024-03-02  6:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-02  6:33 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-17 14:35 [gentoo-commits] repo/gentoo:master commit in: dev-debug/bpftrace/, dev-debug/bpftrace/files/ Sam James
2024-12-17 14:35 Sam James
2024-03-26 18:19 Patrick McLean
2024-01-23 20:51 Patrick McLean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1709361199.39340a3d3b3f93f9af613136e874f634305ee356.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox