Hello community, here is the log from the commit of package bpftrace for openSUSE:Factory checked in at 2020-11-11 20:47:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/bpftrace (Old) and /work/SRC/openSUSE:Factory/.bpftrace.new.26437 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "bpftrace" Wed Nov 11 20:47:17 2020 rev:7 rq:847622 version:0.11.2 Changes: -------- --- /work/SRC/openSUSE:Factory/bpftrace/bpftrace.changes 2020-11-02 09:42:48.749749202 +0100 +++ /work/SRC/openSUSE:Factory/.bpftrace.new.26437/bpftrace.changes 2020-11-11 20:47:21.891701801 +0100 @@ -1,0 +2,6 @@ +Mon Nov 9 01:17:21 UTC 2020 - Marcus Rueckert <mrueck...@suse.de> + +- added detect-7-arg-bpf_attach_uprobe.patch: + fix build with new bpf_attach_uprobe in TW + +------------------------------------------------------------------- New: ---- detect-7-arg-bpf_attach_uprobe.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ bpftrace.spec ++++++ --- /var/tmp/diff_new_pack.mamGRI/_old 2020-11-11 20:47:22.643702507 +0100 +++ /var/tmp/diff_new_pack.mamGRI/_new 2020-11-11 20:47:22.647702511 +0100 @@ -24,6 +24,8 @@ Group: Development/Tools/Debuggers URL: https://github.com/iovisor/bpftrace Source: https://github.com/iovisor/bpftrace/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +# OPENSUSE-FIX-UPSTREAM: Backport of <https://github.com/iovisor/bpftrace/pull/1589>. +Patch1: detect-7-arg-bpf_attach_uprobe.patch BuildRequires: binutils BuildRequires: binutils-devel BuildRequires: bison @@ -60,6 +62,7 @@ %prep %setup -q +%patch1 -p1 # Correct the #!-line to avoid rpmlint warnings. find tools -name '*.bt' -type f \ ++++++ detect-7-arg-bpf_attach_uprobe.patch ++++++ From c7dbab451484b96178da1a8c43330154ce4c9d7a Mon Sep 17 00:00:00 2001 From: Daniel Xu <d...@dxuuu.xyz> Date: Wed, 14 Oct 2020 17:09:46 -0700 Subject: [PATCH] Detect 7 arg bpf_attach_uprobe() API The 7th arg allows us to specify the usdt semaphore location. --- cmake/FindLibBcc.cmake | 11 +++++++++++ src/CMakeLists.txt | 3 +++ src/attached_probe.cpp | 42 ++++++++++++++++++++++++++++++++++-------- src/main.cpp | 6 ++++++ tests/CMakeLists.txt | 3 +++ 5 files changed, 57 insertions(+), 8 deletions(-) Index: bpftrace-0.11.2/cmake/FindLibBcc.cmake =================================================================== --- bpftrace-0.11.2.orig/cmake/FindLibBcc.cmake +++ bpftrace-0.11.2/cmake/FindLibBcc.cmake @@ -7,6 +7,8 @@ # LIBBCC_DEFINITIONS - Compiler switches required for using libbcc # LIBBCC_BPF_LIBRARY_STATIC - libbpf static library (for static compilation) # LIBBCC_LOADER_LIBRARY_STATIC - libbcc helper static library (for static compilation) +# LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE +# LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE # # Note that the shared libbcc binary has libbpf and bcc_loader already compiled in but # the static doesn't. So when creating a static build those have to be included too. @@ -70,3 +72,39 @@ include (FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc "Please install the bcc library package, which is required. Depending on your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel (Fedora), or something else. If unavailable, install bcc from source (github.com/iovisor/bcc)." LIBBCC_LIBRARIES LIBBCC_INCLUDE_DIRS) + +# Check bpf_attach_kprobe signature +if(${LIBBCC_FOUND}) +if(STATIC_LINKING) + # libbcc.a is not statically linked with libbpf.a, libelf.a, and libz.a. + # If we do a static bpftrace build, we must link them in. + find_package(LibBpf) + find_package(LibElf) + find_package(LibZ) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARY_STATIC} ${LIBBPF_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBZ_LIBRARIES}) +else() + SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_LIBRARIES} ${LIBBPF_LIBRARIES}) +endif() + +INCLUDE(CheckCXXSourceCompiles) +SET(CMAKE_REQUIRED_INCLUDES ${LIBBCC_INCLUDE_DIRS}) +CHECK_CXX_SOURCE_COMPILES(" +#include <bcc/libbpf.h> + +int main(void) { + bpf_attach_kprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0); + return 0; +} +" LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE) + +CHECK_CXX_SOURCE_COMPILES(" +#include <bcc/libbpf.h> + +int main(void) { + bpf_attach_uprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0, 0); + return 0; +} +" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE) +SET(CMAKE_REQUIRED_LIBRARIES) +SET(CMAKE_REQUIRED_INCLUDES) +endif() Index: bpftrace-0.11.2/src/CMakeLists.txt =================================================================== --- bpftrace-0.11.2.orig/src/CMakeLists.txt +++ bpftrace-0.11.2/src/CMakeLists.txt @@ -79,6 +79,12 @@ if(HAVE_BFD_DISASM) target_link_libraries(bpftrace ${LIBOPCODES_LIBRARIES}) endif(STATIC_LINKING) endif(HAVE_BFD_DISASM) +if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE) + target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE) +endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE) +if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE) + target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE) +endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE) if (ALLOW_UNSAFE_PROBE) target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE) Index: bpftrace-0.11.2/src/attached_probe.cpp =================================================================== --- bpftrace-0.11.2.orig/src/attached_probe.cpp +++ bpftrace-0.11.2/src/attached_probe.cpp @@ -793,12 +793,23 @@ void AttachedProbe::attach_uprobe(bool s { resolve_offset_uprobe(safe_mode); - int perf_event_fd = bpf_attach_uprobe(progfd_, - attachtype(probe_.type), - eventname().c_str(), - probe_.path.c_str(), - offset_, - probe_.pid); + int perf_event_fd = +#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE + bpf_attach_uprobe(progfd_, + attachtype(probe_.type), + eventname().c_str(), + probe_.path.c_str(), + offset_, + probe_.pid, + 0); +#else + bpf_attach_uprobe(progfd_, + attachtype(probe_.type), + eventname().c_str(), + probe_.path.c_str(), + offset_, + probe_.pid); +#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE if (perf_event_fd < 0) throw std::runtime_error("Error attaching probe: " + probe_.name); @@ -907,8 +918,23 @@ void AttachedProbe::attach_usdt(int pid) offset_ = resolve_offset(probe_.path, probe_.attach_point, probe_.loc); - int perf_event_fd = bpf_attach_uprobe(progfd_, attachtype(probe_.type), - eventname().c_str(), probe_.path.c_str(), offset_, pid == 0 ? -1 : pid); + int perf_event_fd = +#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE + bpf_attach_uprobe(progfd_, + attachtype(probe_.type), + eventname().c_str(), + probe_.path.c_str(), + offset_, + pid == 0 ? -1 : pid, + 0); +#else + bpf_attach_uprobe(progfd_, + attachtype(probe_.type), + eventname().c_str(), + probe_.path.c_str(), + offset_, + pid == 0 ? -1 : pid); +#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE if (perf_event_fd < 0) { Index: bpftrace-0.11.2/src/main.cpp =================================================================== --- bpftrace-0.11.2.orig/src/main.cpp +++ bpftrace-0.11.2/src/main.cpp @@ -156,6 +156,12 @@ static int info() #else << "no" << std::endl; #endif + std::cerr << " bcc bpf_attach_uprobe refcount: " +#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE + << "yes" << std::endl; +#else + << "no" << std::endl; +#endif std::cerr << " libbpf: " #ifdef HAVE_LIBBPF << "yes" << std::endl; Index: bpftrace-0.11.2/tests/CMakeLists.txt =================================================================== --- bpftrace-0.11.2.orig/tests/CMakeLists.txt +++ bpftrace-0.11.2/tests/CMakeLists.txt @@ -107,6 +107,12 @@ if(HAVE_BFD_DISASM) target_link_libraries(bpftrace_test ${LIBOPCODES_LIBRARIES}) endif(STATIC_LINKING) endif(HAVE_BFD_DISASM) +if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE) + target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE) +endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE) +if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE) + target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE) +endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE) target_link_libraries(bpftrace_test arch ast parser resources) _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org