All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
@ 2026-07-09 10:28 Jan Polensky
  2026-07-09 13:53 ` [LTP] " linuxtestproject.agent
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jan Polensky @ 2026-07-09 10:28 UTC (permalink / raw)
  To: ltp

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 <japo@linux.ibm.com>
---
Link: https://lore.kernel.org/all/20260708133726.223095-1-japo@linux.ibm.com/

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-07-14  8:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 10:28 [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal Jan Polensky
2026-07-09 13:53 ` [LTP] " linuxtestproject.agent
2026-07-09 17:38 ` [LTP] [PATCH v2 1/1] " Andrea Cervesato via ltp
2026-07-10 12:27 ` Cyril Hrubis
2026-07-10 12:41   ` Andrea Cervesato via ltp
2026-07-10 12:45     ` Cyril Hrubis
2026-07-10 12:55       ` Andrea Cervesato via ltp
2026-07-10 13:04         ` Cyril Hrubis
2026-07-10 15:15           ` Andrea Cervesato via ltp
2026-07-14  8:43             ` Cyril Hrubis
2026-07-10 17:58   ` Jan Polensky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.