Linux Test Project
 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

* Re: [LTP] kill11: Skip pipe-based core dumps per signal
  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 ` linuxtestproject.agent
  2026-07-09 17:38 ` [LTP] [PATCH v2 1/1] " Andrea Cervesato via ltp
  2026-07-10 12:27 ` Cyril Hrubis
  2 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-07-09 13:53 UTC (permalink / raw)
  To: Jan Polensky; +Cc: ltp

Hi Jan,

On Thu, 09 Jul 2026 12:28:37 +0200, Jan Polensky wrote:
> kill11: Skip pipe-based core dumps per signal

Verdict - Reviewed

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
  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 ` Andrea Cervesato via ltp
  2026-07-10 12:27 ` Cyril Hrubis
  2 siblings, 0 replies; 11+ messages in thread
From: Andrea Cervesato via ltp @ 2026-07-09 17:38 UTC (permalink / raw)
  To: Jan Polensky; +Cc: ltp

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
  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 17:58   ` Jan Polensky
  2 siblings, 2 replies; 11+ messages in thread
From: Cyril Hrubis @ 2026-07-10 12:27 UTC (permalink / raw)
  To: Jan Polensky; +Cc: ltp

Hi!
Alternative we may change the core pattern for the duration of the test.
Does this patch fixes the issue for you?

diff --git a/testcases/kernel/syscalls/kill/kill11.c b/testcases/kernel/syscalls/kill/kill11.c
index 3cf62feae..191587368 100644
--- a/testcases/kernel/syscalls/kill/kill11.c
+++ b/testcases/kernel/syscalls/kill/kill11.c
@@ -126,7 +126,12 @@ static void setup(void)
 static struct tst_test test = {
        .needs_tmpdir = 1,
        .forks_child = 1,
+       .needs_root = 1,
        .setup = setup,
        .tcnt = ARRAY_SIZE(tcases),
        .test = verify_kill,
+       .save_restore = (const struct tst_path_val[]) {
+               {PATH_KERN_CORE_PATTERN, "core", TST_SR_TBROK},
+               {}
+       }
 };


-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
  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 17:58   ` Jan Polensky
  1 sibling, 1 reply; 11+ messages in thread
From: Andrea Cervesato via ltp @ 2026-07-10 12:41 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,

> Hi!
> Alternative we may change the core pattern for the duration of the test.
> Does this patch fixes the issue for you?
> 
> diff --git a/testcases/kernel/syscalls/kill/kill11.c b/testcases/kernel/syscalls/kill/kill11.c
> index 3cf62feae..191587368 100644
> --- a/testcases/kernel/syscalls/kill/kill11.c
> +++ b/testcases/kernel/syscalls/kill/kill11.c
> @@ -126,7 +126,12 @@ static void setup(void)
>  static struct tst_test test = {
>         .needs_tmpdir = 1,
>         .forks_child = 1,
> +       .needs_root = 1,

I don't know if it's a good idea to switch to privileged user, since
we would remove the test from parallel execution.

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
  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
  0 siblings, 1 reply; 11+ messages in thread
From: Cyril Hrubis @ 2026-07-10 12:45 UTC (permalink / raw)
  To: Andrea Cervesato; +Cc: ltp

Hi!
> > Alternative we may change the core pattern for the duration of the test.
> > Does this patch fixes the issue for you?
> > 
> > diff --git a/testcases/kernel/syscalls/kill/kill11.c b/testcases/kernel/syscalls/kill/kill11.c
> > index 3cf62feae..191587368 100644
> > --- a/testcases/kernel/syscalls/kill/kill11.c
> > +++ b/testcases/kernel/syscalls/kill/kill11.c
> > @@ -126,7 +126,12 @@ static void setup(void)
> >  static struct tst_test test = {
> >         .needs_tmpdir = 1,
> >         .forks_child = 1,
> > +       .needs_root = 1,
> 
> I don't know if it's a good idea to switch to privileged user, since
> we would remove the test from parallel execution.

Well either we do that, or we skip the signals that dump core when we
are dumping into the pipe.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
  2026-07-10 12:45     ` Cyril Hrubis
@ 2026-07-10 12:55       ` Andrea Cervesato via ltp
  2026-07-10 13:04         ` Cyril Hrubis
  0 siblings, 1 reply; 11+ messages in thread
From: Andrea Cervesato via ltp @ 2026-07-10 12:55 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

> Well either we do that, or we skip the signals that dump core when we
> are dumping into the pipe.

To me it looks good to skip the signals which are not allowing child
to be killed after coredump. It's a systemd feature we can't workaround
in this case.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
  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
  0 siblings, 1 reply; 11+ messages in thread
From: Cyril Hrubis @ 2026-07-10 13:04 UTC (permalink / raw)
  To: Andrea Cervesato; +Cc: ltp

Hi!
> > Well either we do that, or we skip the signals that dump core when we
> > are dumping into the pipe.
> 
> To me it looks good to skip the signals which are not allowing child
> to be killed after coredump. It's a systemd feature we can't workaround
> in this case.

Thinking of it once more, I wonder what exactly fails in the
systemd-coredump case. I guess that it may delay the test execution a
bit but the crashed process should eventualy quit and the test wait()
call should collect it. If that wasn't the case systemd-coredump would
break one of the fundamentals of UNIX process management.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
  2026-07-10 13:04         ` Cyril Hrubis
@ 2026-07-10 15:15           ` Andrea Cervesato via ltp
  2026-07-14  8:43             ` Cyril Hrubis
  0 siblings, 1 reply; 11+ messages in thread
From: Andrea Cervesato via ltp @ 2026-07-10 15:15 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

> Hi!
> > > Well either we do that, or we skip the signals that dump core when we
> > > are dumping into the pipe.
> > 
> > To me it looks good to skip the signals which are not allowing child
> > to be killed after coredump. It's a systemd feature we can't workaround
> > in this case.
> 
> Thinking of it once more, I wonder what exactly fails in the
> systemd-coredump case. I guess that it may delay the test execution a
> bit but the crashed process should eventualy quit and the test wait()
> call should collect it. If that wasn't the case systemd-coredump would
> break one of the fundamentals of UNIX process management.

Let's forget about systemd for a second.

The problem is that by using `pause()` that is not draining the buffer we
never ends the piped user-space helper. The default behaviour for a piped
helper is that kernel collect the coredump until helper drains the pipe.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
  2026-07-10 12:27 ` Cyril Hrubis
  2026-07-10 12:41   ` Andrea Cervesato via ltp
@ 2026-07-10 17:58   ` Jan Polensky
  1 sibling, 0 replies; 11+ messages in thread
From: Jan Polensky @ 2026-07-10 17:58 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

On Fri, Jul 10, 2026 at 02:27:11PM +0200, Cyril Hrubis wrote:
> Hi!
> Alternative we may change the core pattern for the duration of the test.
> Does this patch fixes the issue for you?
>
> diff --git a/testcases/kernel/syscalls/kill/kill11.c b/testcases/kernel/syscalls/kill/kill11.c
> index 3cf62feae..191587368 100644
> --- a/testcases/kernel/syscalls/kill/kill11.c
> +++ b/testcases/kernel/syscalls/kill/kill11.c
> @@ -126,7 +126,12 @@ static void setup(void)
>  static struct tst_test test = {
>         .needs_tmpdir = 1,
>         .forks_child = 1,
> +       .needs_root = 1,
>         .setup = setup,
>         .tcnt = ARRAY_SIZE(tcases),
>         .test = verify_kill,
> +       .save_restore = (const struct tst_path_val[]) {
> +               {PATH_KERN_CORE_PATTERN, "core", TST_SR_TBROK},
> +               {}
> +       }
>  };
>
>
> --
> Cyril Hrubis
> chrubis@suse.cz
Hi Cyril,

yes, this patch fixes the issue completely for me.

I tested it on both x86_64 and s390 with different configurations and could no longer reproduce the failures.

Using a non-pipe core_pattern during the test is a good solution for my setup.

Regards,
Jan

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 1/1] kill11: Skip pipe-based core dumps per signal
  2026-07-10 15:15           ` Andrea Cervesato via ltp
@ 2026-07-14  8:43             ` Cyril Hrubis
  0 siblings, 0 replies; 11+ messages in thread
From: Cyril Hrubis @ 2026-07-14  8:43 UTC (permalink / raw)
  To: Andrea Cervesato; +Cc: ltp

Hi!
> > Thinking of it once more, I wonder what exactly fails in the
> > systemd-coredump case. I guess that it may delay the test execution a
> > bit but the crashed process should eventualy quit and the test wait()
> > call should collect it. If that wasn't the case systemd-coredump would
> > break one of the fundamentals of UNIX process management.
> 
> Let's forget about systemd for a second.
> 
> The problem is that by using `pause()` that is not draining the buffer we
> never ends the piped user-space helper. The default behaviour for a piped
> helper is that kernel collect the coredump until helper drains the pipe.

Which would mean that the system this is failing on is mis-configured at
best. I've tested this on Leap 16.0 that uses systemd-coredump and
everything works fine there.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox