From bb724fa986f6be4663f0cf15949bbb8de5814ff1 Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Wed, 22 Feb 2023 19:43:02 -0800 Subject: [PATCH] sysdig: Include driver patch to fix compilation on Linux 6.2 On nixos-unstable with the latest kernel (6.2.0), I'm seeing sysdig fail to compile: /build/source/build/driver/src/main.c:2788:30: error: assignment to 'char * (*)(const struct device *, umode_t *)' {aka 'char * (*)(const struct device *, short unsigned int *)'} from incompatible pointer type 'char * (*)(struct device *, umode_t *)' {aka 'char * (*)(struct device *, short unsigned int *)'} [-Werror=incompatible-pointer-types] 2788 | g_ppm_class->devnode = ppm_devnode; | ^ /build/libs/userspace/libscap/scap_procs.c: In function 'scap_os_getpid_global': This has already been fixed upstream, this just cherry-picks that fix. --- pkgs/os-specific/linux/sysdig/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/os-specific/linux/sysdig/default.nix b/pkgs/os-specific/linux/sysdig/default.nix index a8579a50fb65..2e01a38a0698 100644 --- a/pkgs/os-specific/linux/sysdig/default.nix +++ b/pkgs/os-specific/linux/sysdig/default.nix @@ -22,6 +22,11 @@ let rev = "3.0.1+driver"; sha256 = "sha256-bK9wv17bVl93rOqw7JICnMOM0fDtPIErfMmUmNKOD5c="; }; + # Workaround for scap-driver compilation error on kernel 6.2: https://github.com/falcosecurity/libs/issues/918 + driverPatch = fetchpatch { + url = "https://github.com/falcosecurity/libs/commit/b8ec3e8637c850066d01543616fe413e8deb9e1f.patch"; + hash = "sha256-s7iHbOjVqHSWRY4gktZldgrU5OClqRmbqmDtUgFIeh0="; + }; in stdenv.mkDerivation rec { @@ -67,6 +72,7 @@ stdenv.mkDerivation rec { chmod -R +w libs cp -r ${driver} driver-src chmod -R +w driver-src + patch -p1 -d driver-src < ${driverPatch} cmakeFlagsArray+=( "-DFALCOSECURITY_LIBS_SOURCE_DIR=$(pwd)/libs" "-DVALIJSON_INCLUDE=${valijson}/include"