Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] coredump01: Skip pipe core_pattern under SELinux enforcing
@ 2026-09-18 19:43 Avinesh Kumar via ltp
  2026-09-18 22:25 ` [LTP] " linuxtestproject.agent
  2026-09-21  8:54 ` [LTP] [PATCH] " Petr Vorel
  0 siblings, 2 replies; 4+ messages in thread
From: Avinesh Kumar via ltp @ 2026-09-18 19:43 UTC (permalink / raw)
  To: ltp

From: Avinesh Kumar <avinesh.kumar@suse.com>

SELinux in enforcing mode silently blocks the kernel's usermode-helper
spawn for the piped core_pattern, so the helper never runs and the
test reports FAIL.

coredump01.c:126: TINFO: Testing pipe core_pattern
coredump01.c:100: TFAIL: coredump01_helper did not report any core dump

Skip with TCONF instead of failing.

Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
 testcases/kernel/coredump/coredump01.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/testcases/kernel/coredump/coredump01.c b/testcases/kernel/coredump/coredump01.c
index c4fb92e4dcb0..15aaf8c56143 100644
--- a/testcases/kernel/coredump/coredump01.c
+++ b/testcases/kernel/coredump/coredump01.c
@@ -31,12 +31,14 @@
 
 #include "coredump_common.h"
 #include "tst_kconfig.h"
+#include "tst_security.h"
 
 #define HELPER "coredump01_helper"
 #define HELPER_TIMEOUT 10
 
 static char helper_path[PATH_MAX];
 static int static_usermodehelper;
+static int selinux_enforcing;
 
 /*
  * e_ident[] and e_type live at the same file offset in ELF32 and ELF64,
@@ -89,6 +91,11 @@ static void verify_pipe_pattern(void)
 		return;
 	}
 
+	if (selinux_enforcing) {
+		tst_res(TCONF, "SELinux is enforcing, skipping pipe core_pattern");
+		return;
+	}
+
 	set_pattern("|%s %%e %%p %%s %s/res.%%p", helper_path, cwd);
 
 	pid = crash_child();
@@ -137,6 +144,8 @@ static void setup(void)
 	tst_kconfig_read(&kconfig, 1);
 	static_usermodehelper = (kconfig.choice == 'y');
 
+	selinux_enforcing = tst_selinux_enforcing();
+
 	if (tst_get_path(HELPER, path, sizeof(path)))
 		tst_brk(TCONF, "'%s' not found in $PATH", HELPER);
 
-- 
2.55.0


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

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

* Re: [LTP] coredump01: Skip pipe core_pattern under SELinux enforcing
  2026-09-18 19:43 [LTP] [PATCH] coredump01: Skip pipe core_pattern under SELinux enforcing Avinesh Kumar via ltp
@ 2026-09-18 22:25 ` linuxtestproject.agent
  2026-09-21  8:54 ` [LTP] [PATCH] " Petr Vorel
  1 sibling, 0 replies; 4+ messages in thread
From: linuxtestproject.agent @ 2026-09-18 22:25 UTC (permalink / raw)
  To: Avinesh Kumar; +Cc: ltp

Hi Avinesh,

On Fri, 18 Sep 2026 21:43:08 +0200, Avinesh Kumar wrote:
> coredump01: Skip pipe core_pattern under SELinux enforcing

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] 4+ messages in thread

* Re: [LTP] [PATCH] coredump01: Skip pipe core_pattern under SELinux enforcing
  2026-09-18 19:43 [LTP] [PATCH] coredump01: Skip pipe core_pattern under SELinux enforcing Avinesh Kumar via ltp
  2026-09-18 22:25 ` [LTP] " linuxtestproject.agent
@ 2026-09-21  8:54 ` Petr Vorel
  2026-09-22  9:25   ` Petr Vorel
  1 sibling, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2026-09-21  8:54 UTC (permalink / raw)
  To: Avinesh Kumar; +Cc: ltp

Hi Avinesh,

thanks for the fix, merged.

@Jan @Li @Michael FYI

Kind regards,
Petr

> SELinux in enforcing mode silently blocks the kernel's usermode-helper
> spawn for the piped core_pattern, so the helper never runs and the
> test reports FAIL.

> coredump01.c:126: TINFO: Testing pipe core_pattern
> coredump01.c:100: TFAIL: coredump01_helper did not report any core dump

> Skip with TCONF instead of failing.

> Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
> ---
>  testcases/kernel/coredump/coredump01.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

> diff --git a/testcases/kernel/coredump/coredump01.c b/testcases/kernel/coredump/coredump01.c
> index c4fb92e4dcb0..15aaf8c56143 100644
> --- a/testcases/kernel/coredump/coredump01.c
> +++ b/testcases/kernel/coredump/coredump01.c
> @@ -31,12 +31,14 @@

>  #include "coredump_common.h"
>  #include "tst_kconfig.h"
> +#include "tst_security.h"

>  #define HELPER "coredump01_helper"
>  #define HELPER_TIMEOUT 10

>  static char helper_path[PATH_MAX];
>  static int static_usermodehelper;
> +static int selinux_enforcing;

>  /*
>   * e_ident[] and e_type live at the same file offset in ELF32 and ELF64,
> @@ -89,6 +91,11 @@ static void verify_pipe_pattern(void)
>  		return;
>  	}

> +	if (selinux_enforcing) {
> +		tst_res(TCONF, "SELinux is enforcing, skipping pipe core_pattern");
> +		return;
> +	}
> +
>  	set_pattern("|%s %%e %%p %%s %s/res.%%p", helper_path, cwd);

>  	pid = crash_child();
> @@ -137,6 +144,8 @@ static void setup(void)
>  	tst_kconfig_read(&kconfig, 1);
>  	static_usermodehelper = (kconfig.choice == 'y');

> +	selinux_enforcing = tst_selinux_enforcing();
> +
>  	if (tst_get_path(HELPER, path, sizeof(path)))
>  		tst_brk(TCONF, "'%s' not found in $PATH", HELPER);

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

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

* Re: [LTP] [PATCH] coredump01: Skip pipe core_pattern under SELinux enforcing
  2026-09-21  8:54 ` [LTP] [PATCH] " Petr Vorel
@ 2026-09-22  9:25   ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2026-09-22  9:25 UTC (permalink / raw)
  To: Avinesh Kumar, ltp, Jan Stancek, Li Wang, Michael Menasherov

Hi Avinesh, all,

> Hi Avinesh,

> thanks for the fix, merged.

FYI I was not able to reproduce the problem on 2 older Tumbleweed versions:

$ getenforce
Enforcing

$ uname -r
7.2.0-1-default # Tumbleweed VERSION="20260826"
6.17.0 # Tumbleweed VERSION="20250310"

$ cat /proc/cmdline
... security=selinux selinux=1 ...


$ rpm -qa |grep -i selinux # Tumbleweed VERSION="20260826"
libselinux1-3.8-2.2.x86_64
libselinux-devel-3.8-2.2.x86_64
selinux-tools-3.8-2.2.x86_64
python313-selinux-3.8-2.3.x86_64
selinux-autorelabel-4.0+git7-1.2.x86_64
selinux-policy-20250305-1.2.noarch
selinux-policy-targeted-20250305-1.2.noarch
container-selinux-2.234.2-1.2.noarch
patterns-base-selinux-20241218-5.1.x86_64
libselinux1-32bit-3.8-2.2.x86_64

coredump01.c:72: TPASS: core.%e.%p.%s expanded to core.coredump01.893495.6 passed
coredump01.c:57: TPASS: Expect: /tmp/LTP_corqUjmUe/core.coredump01.893495.6 starts with ELF magic
coredump01.c:58: TPASS: e_type == ET_CORE (4)
coredump01.c:126: TINFO: Testing pipe core_pattern
coredump01.c:107: TPASS: exe == "coredump01" (coredump01)
coredump01.c:108: TPASS: pid_seen == pid (893496)
coredump01.c:109: TPASS: sig_seen == SIGABRT (6)
coredump01.c:110: TPASS: Expect: coredump01_helper read 598016 bytes of ELF core dump
coredump01.c:111: TPASS: et_core == 1 (1)

Because we have these tests failing in our openQA testing it's a real problem.
I just wonder what setup / version bump caused it. I try to update my VM to see
if I'm able to reproduce it locally.

Kind regards,
Petr


> @Jan @Li @Michael FYI

> Kind regards,
> Petr

> > SELinux in enforcing mode silently blocks the kernel's usermode-helper
> > spawn for the piped core_pattern, so the helper never runs and the
> > test reports FAIL.

> > coredump01.c:126: TINFO: Testing pipe core_pattern
> > coredump01.c:100: TFAIL: coredump01_helper did not report any core dump

> > Skip with TCONF instead of failing.

> > Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
> > ---
> >  testcases/kernel/coredump/coredump01.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)

> > diff --git a/testcases/kernel/coredump/coredump01.c b/testcases/kernel/coredump/coredump01.c
> > index c4fb92e4dcb0..15aaf8c56143 100644
> > --- a/testcases/kernel/coredump/coredump01.c
> > +++ b/testcases/kernel/coredump/coredump01.c
> > @@ -31,12 +31,14 @@

> >  #include "coredump_common.h"
> >  #include "tst_kconfig.h"
> > +#include "tst_security.h"

> >  #define HELPER "coredump01_helper"
> >  #define HELPER_TIMEOUT 10

> >  static char helper_path[PATH_MAX];
> >  static int static_usermodehelper;
> > +static int selinux_enforcing;

> >  /*
> >   * e_ident[] and e_type live at the same file offset in ELF32 and ELF64,
> > @@ -89,6 +91,11 @@ static void verify_pipe_pattern(void)
> >  		return;
> >  	}

> > +	if (selinux_enforcing) {
> > +		tst_res(TCONF, "SELinux is enforcing, skipping pipe core_pattern");
> > +		return;
> > +	}
> > +
> >  	set_pattern("|%s %%e %%p %%s %s/res.%%p", helper_path, cwd);

> >  	pid = crash_child();
> > @@ -137,6 +144,8 @@ static void setup(void)
> >  	tst_kconfig_read(&kconfig, 1);
> >  	static_usermodehelper = (kconfig.choice == 'y');

> > +	selinux_enforcing = tst_selinux_enforcing();
> > +
> >  	if (tst_get_path(HELPER, path, sizeof(path)))
> >  		tst_brk(TCONF, "'%s' not found in $PATH", HELPER);

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

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

end of thread, other threads:[~2026-09-22  9:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18 19:43 [LTP] [PATCH] coredump01: Skip pipe core_pattern under SELinux enforcing Avinesh Kumar via ltp
2026-09-18 22:25 ` [LTP] " linuxtestproject.agent
2026-09-21  8:54 ` [LTP] [PATCH] " Petr Vorel
2026-09-22  9:25   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox