Linux Test Project
 help / color / mirror / Atom feed
From: Jan Polensky <japo@linux.ibm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
Date: Thu,  9 Jul 2026 12:28:37 +0200	[thread overview]
Message-ID: <20260709102837.54583-1-japo@linux.ibm.com> (raw)

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

             reply	other threads:[~2026-07-09 10:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 10:28 Jan Polensky [this message]
2026-07-09 13:53 ` [LTP] kill11: Skip pipe-based core dumps per signal 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260709102837.54583-1-japo@linux.ibm.com \
    --to=japo@linux.ibm.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox