From 6108c057ddfdf18a11a755f1e187692bde1961e2 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 11 Feb 2022 16:54:53 +0900 Subject: [PATCH 1/2] libbpf: 0.6.1 -> 0.7.0 - remove patch that had been merged since - install all uapi headers, not just btf, as new version of bcc requires some more --- pkgs/os-specific/linux/libbpf/default.nix | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pkgs/os-specific/linux/libbpf/default.nix b/pkgs/os-specific/linux/libbpf/default.nix index 81e86fe77efc..f45e18477513 100644 --- a/pkgs/os-specific/linux/libbpf/default.nix +++ b/pkgs/os-specific/linux/libbpf/default.nix @@ -12,20 +12,15 @@ with builtins; stdenv.mkDerivation rec { pname = "libbpf"; - version = "0.6.1"; + version = "0.7.0"; src = fetchFromGitHub { owner = "libbpf"; repo = "libbpf"; rev = "v${version}"; - sha256 = "sha256-/MLPflnfooe7Wjy8M3CTowAi5oYpscruSkDsaVzhmYQ="; + sha256 = "sha256-ieJ19igGCoPKGX6J0mQG+QD7QcXHX2SVzZUjMwxum/M="; }; - patches = [(fetchpatch { - url = "https://github.com/libbpf/libbpf/pull/41.diff"; - sha256 = "sha256-pg5WARqh6z0nkTHMBhftxwdV2SyswC2lfaCXCpez0VA="; - })]; - nativeBuildInputs = [ pkg-config ]; buildInputs = [ libelf zlib ]; @@ -38,7 +33,7 @@ stdenv.mkDerivation rec { postInstall = '' # install linux's libbpf-compatible linux/btf.h - install -Dm444 include/uapi/linux/btf.h -t $out/include/linux + install -Dm444 include/uapi/linux/*.h -t $out/include/linux ''; # FIXME: Multi-output requires some fixes to the way the pkg-config file is From 824d26d3959873bd64c11edf5a918617a038d9aa Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 11 Feb 2022 16:55:34 +0900 Subject: [PATCH 2/2] bcc: 0.23.0 -> 0.24.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also add an extra test in nixos/tests/bpf.nix for BTF usage in bpftrace Co-authored-by: Jörg Thalheim --- nixos/tests/bpf.nix | 6 +++++- pkgs/os-specific/linux/bcc/default.nix | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nixos/tests/bpf.nix b/nixos/tests/bpf.nix index 233c7dab1ee2..e479cd057921 100644 --- a/nixos/tests/bpf.nix +++ b/nixos/tests/bpf.nix @@ -18,8 +18,12 @@ import ./make-test-python.nix ({ pkgs, ... }: { # simple BEGIN probe (user probe on bpftrace itself) print(machine.succeed("bpftrace -e 'BEGIN { print(\"ok\"); exit(); }'")) # tracepoint - print(machine.succeed("bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit(); }'")) + print(machine.succeed("bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit() }'")) # kprobe print(machine.succeed("bpftrace -e 'kprobe:schedule { print(probe); exit() }'")) + # BTF + print(machine.succeed("bpftrace -e 'kprobe:schedule { " + " printf(\"tgid: %d\", ((struct task_struct*) curtask)->tgid); exit() " + "}'")) ''; }) diff --git a/pkgs/os-specific/linux/bcc/default.nix b/pkgs/os-specific/linux/bcc/default.nix index caeaed455f7e..d6e4b059088d 100644 --- a/pkgs/os-specific/linux/bcc/default.nix +++ b/pkgs/os-specific/linux/bcc/default.nix @@ -7,7 +7,7 @@ python.pkgs.buildPythonApplication rec { pname = "bcc"; - version = "0.23.0"; + version = "0.24.0"; disabled = !stdenv.isLinux; @@ -15,7 +15,7 @@ python.pkgs.buildPythonApplication rec { owner = "iovisor"; repo = "bcc"; rev = "v${version}"; - sha256 = "sha256-iLVUwJTDQ8Bn38sgHOcIR8TYxIB+gIlfTgr9+gPU0gE="; + sha256 = "sha256-5Nq6LmphiyiiIyru/P2rCCmA25cwJIWn08oK1+eM3cQ="; }; format = "other";