diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-02-27 12:56:27 +0100 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-03-02 08:28:12 +0100 |
| commit | 1f84236b0a7bbf364b4901dc13bcd6561f26214c (patch) | |
| tree | c29caff0f14a14d64a71da39468aa2809d9b9447 | |
| parent | 68e0407e8f21a5adff66bbb57c09cb12ca9bb0c5 (diff) | |
| download | ouroboros-1f84236b0a7bbf364b4901dc13bcd6561f26214c.tar.gz ouroboros-1f84236b0a7bbf364b4901dc13bcd6561f26214c.zip | |
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 <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
| -rw-r--r-- | include/test/test.h | 6 |
1 files changed, 6 insertions, 0 deletions
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 <sys/wait.h> #include <sys/types.h> #include <sys/resource.h> +#ifdef __linux__ +#include <sys/prctl.h> +#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 */ } |
