Message ID | 87r1ti9fto.fsf@asu.edu |
---|---|
State | Accepted |
Headers | show |
Series | [bug#42227] BPF in linux-libre | expand |
Context | Check | Description |
---|---|---|
cbaines/applying patch | fail | View Laminar job |
Hey John, Thanks for your patience! > I wrapped the PYTHONPATH around the various provided python tools. > I also found a spare path that required patching. > I am not sure this fixes every tool but I did get a few to work now. Yes, I tested some of them, looks fine :). > I also added debugfs as a requirement for a bpf system. To use it > %bpf-file-systems can be used in place of %base-file-systems in the > operating system definition. Actually, I wonder if we could mount debugfs by default, by adding it to %base-file-systems. Any objections? In the meantime I pushed the bcc patch with a few edits. Regarding bpftrace, I'd like to avoid the "-DHAVE_BFD_DISASM=OFF" patching, I found this ticket which seems related: https://github.com/iovisor/bpftrace/issues/1106, but didn't make any significant progress yet. Thanks, Mathieu
Hi Mathieu! > Thanks for your patience! No problem. I'm quite busy too. >> I also added debugfs as a requirement for a bpf system. To use it >> %bpf-file-systems can be used in place of %base-file-systems in the >> operating system definition. > > Actually, I wonder if we could mount debugfs by default, by adding it to > %base-file-systems. Any objections? That seems ok. I did find a few questions about debugfs on old irc logs and mailing lists. My only concern again is that I would prefer to opt in to such a thing. debugfs is much simpler than the bpf kernel flags though, so maybe it will be ok to remove in the future. > In the meantime I pushed the bcc patch with a few edits. Regarding > bpftrace, I'd like to avoid the "-DHAVE_BFD_DISASM=OFF" patching, I > found this ticket which seems related: > https://github.com/iovisor/bpftrace/issues/1106, but didn't make any > significant progress yet. I have tried every which way I can to make HAVE_BFD_DISASM work. A kind persn from the bpftrace irc directed me to this PR: https://github.com/iovisor/bpftrace/pull/1095 But I cannot see anything guix does differently that would cause it to fail. My only feeling is perhaps our configure flags for binutils might be causing the issue. As is, however, bpftrace does work even with out HAVE_BFD_DISASM and I even used it to debug a few processes recently. Thanks again! - John
Hey, > That seems ok. I did find a few questions about debugfs on old irc logs > and mailing lists. My only concern again is that I would prefer to opt > in to such a thing. debugfs is much simpler than the bpf kernel flags > though, so maybe it will be ok to remove in the future. Yeah, but I saw that Ubuntu for instance is enabling it by default, so I guess it could help to have the same behaviour in Guix System. Added it with: 6bb07e91e1ab9367f636a3a5e9d52a9e0772aa89. > But I cannot see anything guix does differently that would cause it to > fail. My only feeling is perhaps our configure flags for binutils might > be causing the issue. > > As is, however, bpftrace does work even with out HAVE_BFD_DISASM and I > even used it to debug a few processes recently. Gave it another try and I think if we could get "binutils" to produce a dynamic version of libbfd.a, that would make the trick. Anyway, let's proceed without BFD support for now. Pushed bpftrace as c55acb073248392b1387017378f36a1d378fa7c4. Closing the serie, thank you! Mathieu
From f17d7242b3821b6a5600bfd5e9a0f75fa4054d60 Mon Sep 17 00:00:00 2001 From: John Soo <jsoo1@asu.edu> Date: Sat, 13 Jun 2020 23:16:56 -0700 Subject: [PATCH 4/4] gnu: Add bpftrace. * gnu/packages/linux.scm (bpftrace): New variable. * gnu/packages/patches/bpftrace-disable-bfd-disasm.patch: Disable bfd disassembly for bpftrace. * gnu/local.mk (dist_patch_DATA): Add bpftrace-disable-bfd-disasm.patch. --- gnu/local.mk | 1 + gnu/packages/linux.scm | 48 +++++++++++++++++++ .../patches/bpftrace-disable-bfd-disasm.patch | 15 ++++++ 3 files changed, 64 insertions(+) create mode 100644 gnu/packages/patches/bpftrace-disable-bfd-disasm.patch diff --git a/gnu/local.mk b/gnu/local.mk index a277e63fa4..5c9d39663f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -819,6 +819,7 @@ dist_patch_DATA = \ %D%/packages/patches/bitcoin-core-python-compat.patch \ %D%/packages/patches/blender-2.79-newer-ffmpeg.patch \ %D%/packages/patches/blender-2.79-python-3.7-fix.patch \ + %D%/packages/patches/bpftrace-disable-bfd-disasm.patch \ %D%/packages/patches/busybox-1.31.1-fix-build-with-glibc-2.31.patch \ %D%/packages/patches/byobu-writable-status.patch \ %D%/packages/patches/calibre-no-updates-dialog.patch \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index b3922b0770..8f19ca11d2 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -7314,3 +7314,51 @@ makes use of extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature that was first added to Linux 3.15. Much of what BCC uses requires Linux 4.1 and above.") (license license:asl2.0))) + +(define-public bpftrace + (package + (name "bpftrace") + (version "0.10.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/iovisor/bpftrace") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "023ardywbw5w8815j2ny9rrp2xlpxndqaa7v2njjm8109p7ilsdn")) + (patches (search-patches "bpftrace-disable-bfd-disasm.patch")))) + (build-system cmake-build-system) + (native-inputs + `(("bison" ,bison) + ("flex" ,flex))) + (inputs + `(("bcc" ,bcc) + ("clang-toolchain" ,clang-toolchain) + ("elfutils" ,elfutils) + ;; FIXME: Tests require googletest but clone repository + ;; ("googletest" ,googletest) + ("libbpf" ,libbpf) + ("linux-libre-headers" ,linux-libre-headers))) + (arguments + `(#:tests? #f ; FIXME: Enable when googletest from guix is used + #:configure-flags + '(;; FIXME: Make tests not clone the googletest repository + "-DBUILD_TESTING=OFF" + ;; FIXME: libbfd misses some link dependencies + ;; When fixed, remove patch + "-DHAVE_BFD_DISASM=OFF"))) + (home-page "https://github.com/iovisor/bpftrace") + (synopsis "High-level tracing language for Linux eBPF") + (description + "bpftrace is a high-level tracing language for Linux enhanced Berkeley +Packet Filter (eBPF) available in recent Linux kernels (4.x). bpftrace uses +LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for +interacting with the Linux BPF system, as well as existing Linux tracing +capabilities: kernel dynamic tracing (kprobes), user-level dynamic +tracing (uprobes), and tracepoints. The bpftrace language is inspired by awk +and C, and predecessor tracers such as DTrace and SystemTap. bpftrace was +created by Alastair Robertson.") + (license license:asl2.0))) diff --git a/gnu/packages/patches/bpftrace-disable-bfd-disasm.patch b/gnu/packages/patches/bpftrace-disable-bfd-disasm.patch new file mode 100644 index 0000000000..8565d8d851 --- /dev/null +++ b/gnu/packages/patches/bpftrace-disable-bfd-disasm.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e89a6a9..a594786 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -126,10 +126,6 @@ find_package(LibBpf) + find_package(LibBfd) + find_package(LibOpcodes) + +-if(${LIBBFD_FOUND} AND ${LIBOPCODES_FOUND}) +- set(HAVE_BFD_DISASM TRUE) +-endif() +- + include(CheckIncludeFile) + check_include_file("sys/sdt.h" HAVE_SYSTEMTAP_SYS_SDT_H) + -- 2.27.0