diff options
Diffstat (limited to 'dev-debug/scap-driver')
-rw-r--r-- | dev-debug/scap-driver/files/0.29.3-fix-kmod-build-on-6.8+.patch | 44 | ||||
-rw-r--r-- | dev-debug/scap-driver/scap-driver-0.29.3-r6.ebuild | 53 |
2 files changed, 97 insertions, 0 deletions
diff --git a/dev-debug/scap-driver/files/0.29.3-fix-kmod-build-on-6.8+.patch b/dev-debug/scap-driver/files/0.29.3-fix-kmod-build-on-6.8+.patch new file mode 100644 index 000000000000..b33ba164b97a --- /dev/null +++ b/dev-debug/scap-driver/files/0.29.3-fix-kmod-build-on-6.8+.patch @@ -0,0 +1,44 @@ + +Bug: https://bugs.gentoo.org/926768 +Minimal subset of changes from: https://github.com/falcosecurity/libs/pull/1632 + +--- a/driver/ppm_events.c 2024-03-11 15:19:23.000000000 +0100 ++++ b/driver/ppm_events.c 2024-03-11 15:22:48.230598879 +0100 +@@ -624,12 +624,16 @@ int val_to_ring(struct event_filler_argu + if (unlikely(len < 0)) + return PPM_FAILURE_INVALID_USER_MEMORY; + } else { +- len = (int)strlcpy(args->buffer + args->arg_data_offset, ++ len = (int)strscpy(args->buffer + args->arg_data_offset, + (const char *)(syscall_arg_t)val, + max_arg_size); + +- if (++len > (int)max_arg_size) ++ if (len == -E2BIG) { + len = max_arg_size; ++ } else { ++ len++; ++ } ++ + } + + /* +@@ -640,12 +644,15 @@ int val_to_ring(struct event_filler_argu + /* + * Handle NULL pointers + */ +- len = (int)strlcpy(args->buffer + args->arg_data_offset, ++ len = (int)strscpy(args->buffer + args->arg_data_offset, + "(NULL)", + max_arg_size); + +- if (++len > (int)max_arg_size) +- len = max_arg_size; ++ if (len == -E2BIG) { ++ len = max_arg_size; ++ } else { ++ len++; ++ } + } + + break; diff --git a/dev-debug/scap-driver/scap-driver-0.29.3-r6.ebuild b/dev-debug/scap-driver/scap-driver-0.29.3-r6.ebuild new file mode 100644 index 000000000000..6874973ae601 --- /dev/null +++ b/dev-debug/scap-driver/scap-driver-0.29.3-r6.ebuild @@ -0,0 +1,53 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake linux-mod-r1 + +DESCRIPTION="Kernel module for dev-debug/sysdig" +HOMEPAGE="https://sysdig.com/" + +# The driver is part of falcosecurity/libs, but for versioning reasons we cannot (yet) +# use semver-released packages; instead we pull in a commit that is used and known +# to work with sysdig, see sysdig/cmake/modules/falcosecurity-libs.cmake for details. +# For now the commit here and the one referenced in sysdig should be in sync. +LIBS_COMMIT="e5c53d648f3c4694385bbe488e7d47eaa36c229a" +SRC_URI="https://github.com/falcosecurity/libs/archive/${LIBS_COMMIT}.tar.gz -> falcosecurity-libs-${LIBS_COMMIT}.tar.gz" +S="${WORKDIR}/libs-${LIBS_COMMIT}" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86" + +RDEPEND="!<dev-debug/sysdig-${PV}[modules]" + +CONFIG_CHECK="HAVE_SYSCALL_TRACEPOINTS ~TRACEPOINTS" + +PATCHES=( + "${FILESDIR}"/${PV}-fix-kmod-build-on-5.18+.patch + "${FILESDIR}"/${PV}-fix-kmod-build-on-6.2+.patch + "${FILESDIR}"/${PV}-fix-kmod-build-on-6.3+.patch + "${FILESDIR}"/${PV}-fix-kmod-build-on-6.4+.patch + "${FILESDIR}"/${PV}-fix-kmod-build-on-6.7+.patch + "${FILESDIR}"/${PV}-fix-kmod-build-on-6.8+.patch +) + +src_configure() { + local mycmakeargs=( + # we will use linux-mod, so just pretend to use bundled deps + # in order to make it through the cmake setup. + -DUSE_BUNDLED_DEPS=ON + -DCREATE_TEST_TARGETS=OFF + -DDRIVER_VERSION=${LIBS_COMMIT} + ) + + cmake_src_configure +} + +src_compile() { + local modlist=( scap=:"${BUILD_DIR}"/driver/src ) + local modargs=( KERNELDIR="${KV_OUT_DIR}" ) + + linux-mod-r1_src_compile +} |