[PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
Jan Polensky <[email protected]>
| Newsgroups | gmane.linux.ltp |
|---|---|
| Message-ID | <[email protected]> |
kill11 verifies the signal and core dump bit reported to the waiting parent. When /proc/sys/kernel/core_pattern starts with '|', core dumps are handled by a userspace helper such as systemd-coredump. In such setups the test may hang waiting for children that are blocked in the core dump path instead of testing the wait status itself. However, only signals with dumps_core=1 (SIGQUIT, SIGILL, SIGABRT, etc.) actually trigger core dump handling. Signals with dumps_core=0 (SIGHUP, SIGKILL, SIGTERM, SIGPIPE, etc.) exit immediately without touching the core dump path. Detect pipe-based core dumps in setup() and skip only the affected test cases (those with dumps_core=1) in verify_kill(). This preserves test coverage for non-core-dumping signals while preventing hangs. Signed-off-by: Jan Polensky <[email protected]> --- Link: https://lore.kernel.org/all/20260708133726.223095-1-japo-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org/ Changes since v1: - Skip only core-dumping signals (dumps_core=1) instead of all test cases - Keep core_pattern detection in setup(), move skip decision to verify_kill() - Preserve coverage for non-core-dumping signals testcases/kernel/syscalls/kill/kill11.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/testcases/kernel/syscalls/kill/kill11.c b/testcases/kernel/syscalls/kill/kill11.c index 3cf62feaed77..f9fa595a505b 100644 --- a/testcases/kernel/syscalls/kill/kill11.c +++ b/testcases/kernel/syscalls/kill/kill11.c @@ -25,6 +25,8 @@ #include "tst_test.h" +static bool pipe_based_coredump; + static struct tcase { int sig; int dumps_core; @@ -64,6 +66,12 @@ static void verify_kill(unsigned int n) int nsig, status; struct tcase *tc = &tcases[n]; + if (tc->dumps_core && pipe_based_coredump) { + tst_res(TCONF, "%s: pipe-based core dump handler active", + tst_strsig(tc->sig)); + return; + } + pid = SAFE_FORK(); if (!pid) pause(); @@ -105,6 +113,7 @@ static void verify_kill(unsigned int n) static void setup(void) { struct rlimit rlim; + char core_pattern[256]; SAFE_GETRLIMIT(RLIMIT_CORE, &rlim); @@ -121,6 +130,14 @@ static void setup(void) rlim.rlim_cur = MIN_RLIMIT_CORE; SAFE_SETRLIMIT(RLIMIT_CORE, &rlim); } + + /* + * If core_pattern pipes core dumps to a user-space helper, the child may + * remain in the core dump path until the helper completes. Store the + * result and skip only signals that actually request a core dump. + */ + SAFE_FILE_SCANF("/proc/sys/kernel/core_pattern", "%255s", core_pattern); + pipe_based_coredump = (core_pattern[0] == '|'); } static struct tst_test test = { -- 2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp