From 1f84236b0a7bbf364b4901dc13bcd6561f26214c Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 27 Feb 2026 12:56:27 +0100 Subject: include: Suppress coredumpctl entries for tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With DISABLE_TESTS_CORE_DUMPS, setrlimit(RLIMIT_CORE, 0) only prevents core dump files from being written, but when systemd-coredump is configured as a piped handler (via core_pattern), the kernel still invokes it regardless of RLIMIT_CORE, so entries appear in coredumpctl. Adding prctl(PR_SET_DUMPABLE, 0) marks the process as non-dumpable, which prevents the kernel from invoking the core dump handler entirely — including piped ones. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/test/test.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/test/test.h b/include/test/test.h index 99681384..a76fe62a 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -30,6 +30,9 @@ #include #include #include +#ifdef __linux__ +#include +#endif #define TEST_RC_SUCCESS 0 #define TEST_RC_SKIP 1 @@ -86,6 +89,9 @@ static int __attribute__((unused)) test_assert_fail(int(* testfunc)(void)) #ifdef DISABLE_TESTS_CORE_DUMPS struct rlimit rl = { .rlim_cur = 0, .rlim_max = 0 }; setrlimit(RLIMIT_CORE, &rl); +#ifdef __linux__ + prctl(PR_SET_DUMPABLE, 0); +#endif #endif return testfunc(); /* should abort */ } -- cgit v1.2.3