summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2021-12-27 13:07:15 +0100
committerJörg Thalheim <joerg@thalheim.io>2021-12-30 06:40:02 +0100
commitecb6200c7bf5e5eb1aff9ba5c168bdc7ccb28baf (patch)
tree3679688c8f1db13f1dbfbd03dd6b870e3deec785
parent313619a32cc191fbfa9ada4dbe9ed9b3e39e11e8 (diff)
downloadnixpkgs-ecb6200c7bf5e5eb1aff9ba5c168bdc7ccb28baf.tar
nixpkgs-ecb6200c7bf5e5eb1aff9ba5c168bdc7ccb28baf.tar.gz
nixpkgs-ecb6200c7bf5e5eb1aff9ba5c168bdc7ccb28baf.tar.bz2
nixpkgs-ecb6200c7bf5e5eb1aff9ba5c168bdc7ccb28baf.tar.lz
nixpkgs-ecb6200c7bf5e5eb1aff9ba5c168bdc7ccb28baf.tar.xz
nixpkgs-ecb6200c7bf5e5eb1aff9ba5c168bdc7ccb28baf.tar.zst
nixpkgs-ecb6200c7bf5e5eb1aff9ba5c168bdc7ccb28baf.zip
bcc: fix aarch64 test
-rw-r--r--pkgs/os-specific/linux/bcc/absolute-ausyscall.patch43
-rw-r--r--pkgs/os-specific/linux/bcc/default.nix8
2 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/bcc/absolute-ausyscall.patch b/pkgs/os-specific/linux/bcc/absolute-ausyscall.patch
new file mode 100644
index 00000000000..7480e9c5d97
--- /dev/null
+++ b/pkgs/os-specific/linux/bcc/absolute-ausyscall.patch
@@ -0,0 +1,43 @@
+From 01e793163231c5085afced37471df32b94a313f5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
+Date: Thu, 30 Dec 2021 06:34:41 +0100
+Subject: [PATCH] absolute ausyscall
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
+---
+ libbpf-tools/syscall_helpers.c | 2 +-
+ src/python/bcc/syscall.py      | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libbpf-tools/syscall_helpers.c b/libbpf-tools/syscall_helpers.c
+index e114a08f..62adea78 100644
+--- a/libbpf-tools/syscall_helpers.c
++++ b/libbpf-tools/syscall_helpers.c
+@@ -47,7 +47,7 @@ void init_syscall_names(void)
+ 	int err;
+ 	FILE *f;
+ 
+-	f = popen("ausyscall --dump 2>/dev/null", "r");
++	f = popen("@ausyscall@ --dump 2>/dev/null", "r");
+ 	if (!f) {
+ 		warn("popen: ausyscall --dump: %s\n", strerror(errno));
+ 		return;
+diff --git a/src/python/bcc/syscall.py b/src/python/bcc/syscall.py
+index 1346b4e8..e7e29a11 100644
+--- a/src/python/bcc/syscall.py
++++ b/src/python/bcc/syscall.py
+@@ -376,7 +376,7 @@ def _parse_syscall(line):
+ try:
+     # Skip the first line, which is a header. The rest of the lines are simply
+     # SYSCALL_NUM\tSYSCALL_NAME pairs.
+-    out = subprocess.check_output(['ausyscall', '--dump'], stderr=subprocess.STDOUT)
++    out = subprocess.check_output(['@ausyscall@', '--dump'], stderr=subprocess.STDOUT)
+     # remove the first line of expected output
+     out = out.split(b'\n',1)[1]
+     syscalls = dict(map(_parse_syscall, out.strip().split(b'\n')))
+-- 
+2.34.0
+
diff --git a/pkgs/os-specific/linux/bcc/default.nix b/pkgs/os-specific/linux/bcc/default.nix
index c87740ed021..caeaed455f7 100644
--- a/pkgs/os-specific/linux/bcc/default.nix
+++ b/pkgs/os-specific/linux/bcc/default.nix
@@ -2,6 +2,7 @@
 , makeWrapper, cmake, llvmPackages
 , flex, bison, elfutils, python, luajit, netperf, iperf, libelf
 , bash, libbpf, nixosTests
+, audit
 }:
 
 python.pkgs.buildPythonApplication rec {
@@ -41,9 +42,16 @@ python.pkgs.buildPythonApplication rec {
     "-DCMAKE_USE_LIBBPF_PACKAGE=ON"
   ];
 
+  # to replace this executable path:
+  # https://github.com/iovisor/bcc/blob/master/src/python/bcc/syscall.py#L384
+  ausyscall = "${audit}/bin/ausyscall";
+
   postPatch = ''
     substituteAll ${./libbcc-path.patch} ./libbcc-path.patch
     patch -p1 < libbcc-path.patch
+
+    substituteAll ${./absolute-ausyscall.patch} ./absolute-ausyscall.patch
+    patch -p1 < absolute-ausyscall.patch
   '';
 
   postInstall = ''