public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/1] [STAGING] ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns
@ 2026-02-19 16:30 Jan Polensky
  2026-02-19 20:06 ` Petr Vorel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jan Polensky @ 2026-02-19 16:30 UTC (permalink / raw)
  To: chrubis, pvorel; +Cc: Linux Test Project

PIDFD_GET_INFO semantics changed for pidfds referring to tasks without a PID
in the caller's current pid namespace (commit ab89060fbc92e ("pidfs: return
-EREMOTE when PIDFD_GET_INFO is called on another ns")).

Accept both errnos to keep the test working on kernels with and without the
change (including backports).

Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
 testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c b/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
index 751281bacb74..6b4bc3191e37 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
@@ -14,6 +14,7 @@
 
 static struct tst_clone_args *args;
 static struct pidfd_info *info;
+static const int exp_errnos[] = {EREMOTE, ESRCH};
 
 static void run(void)
 {
@@ -41,7 +42,8 @@ static void run(void)
 	args->exit_signal = SIGCHLD;
 
 	if (!SAFE_CLONE(args)) {
-		TST_EXP_FAIL(ioctl(pidfd, PIDFD_GET_INFO, info), ESRCH);
+		TST_EXP_FAIL_ARR(ioctl(pidfd, PIDFD_GET_INFO, info), exp_errnos,
+				ARRAY_SIZE(exp_errnos));
 		exit(0);
 	}
 
-- 
2.53.0


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

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

* Re: [LTP] [PATCH v2 1/1] [STAGING] ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns
  2026-02-19 16:30 [LTP] [PATCH v2 1/1] [STAGING] ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns Jan Polensky
@ 2026-02-19 20:06 ` Petr Vorel
  2026-02-20 10:08 ` Andrea Cervesato via ltp
  2026-02-20 10:48 ` Cyril Hrubis
  2 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2026-02-19 20:06 UTC (permalink / raw)
  To: Jan Polensky; +Cc: Linux Test Project

Hi Jan,

> PIDFD_GET_INFO semantics changed for pidfds referring to tasks without a PID
> in the caller's current pid namespace (commit ab89060fbc92e ("pidfs: return
> -EREMOTE when PIDFD_GET_INFO is called on another ns")).

> Accept both errnos to keep the test working on kernels with and without the
> change (including backports).

LGTM, thanks!
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

> Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> ---
>  testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c b/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
> index 751281bacb74..6b4bc3191e37 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
> @@ -14,6 +14,7 @@

>  static struct tst_clone_args *args;
>  static struct pidfd_info *info;
> +static const int exp_errnos[] = {EREMOTE, ESRCH};

>  static void run(void)
>  {
> @@ -41,7 +42,8 @@ static void run(void)
>  	args->exit_signal = SIGCHLD;

>  	if (!SAFE_CLONE(args)) {
> -		TST_EXP_FAIL(ioctl(pidfd, PIDFD_GET_INFO, info), ESRCH);
> +		TST_EXP_FAIL_ARR(ioctl(pidfd, PIDFD_GET_INFO, info), exp_errnos,
> +				ARRAY_SIZE(exp_errnos));
>  		exit(0);
>  	}

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

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

* Re: [LTP] [PATCH v2 1/1] [STAGING] ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns
  2026-02-19 16:30 [LTP] [PATCH v2 1/1] [STAGING] ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns Jan Polensky
  2026-02-19 20:06 ` Petr Vorel
@ 2026-02-20 10:08 ` Andrea Cervesato via ltp
  2026-02-20 10:48 ` Cyril Hrubis
  2 siblings, 0 replies; 6+ messages in thread
From: Andrea Cervesato via ltp @ 2026-02-20 10:08 UTC (permalink / raw)
  To: Jan Polensky, chrubis, pvorel; +Cc: Linux Test Project

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

* Re: [LTP] [PATCH v2 1/1] [STAGING] ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns
  2026-02-19 16:30 [LTP] [PATCH v2 1/1] [STAGING] ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns Jan Polensky
  2026-02-19 20:06 ` Petr Vorel
  2026-02-20 10:08 ` Andrea Cervesato via ltp
@ 2026-02-20 10:48 ` Cyril Hrubis
  2026-02-20 11:33   ` Petr Vorel
  2026-02-20 15:05   ` Jan Polensky
  2 siblings, 2 replies; 6+ messages in thread
From: Cyril Hrubis @ 2026-02-20 10:48 UTC (permalink / raw)
  To: Jan Polensky; +Cc: Linux Test Project

Hi!
> PIDFD_GET_INFO semantics changed for pidfds referring to tasks without a PID
> in the caller's current pid namespace (commit ab89060fbc92e ("pidfs: return
> -EREMOTE when PIDFD_GET_INFO is called on another ns")).
> 
> Accept both errnos to keep the test working on kernels with and without the
> change (including backports).
> 
> Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> ---
>  testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c b/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
> index 751281bacb74..6b4bc3191e37 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
> @@ -14,6 +14,7 @@
>  
>  static struct tst_clone_args *args;
>  static struct pidfd_info *info;
> +static const int exp_errnos[] = {EREMOTE, ESRCH};
>  
>  static void run(void)
>  {
> @@ -41,7 +42,8 @@ static void run(void)
>  	args->exit_signal = SIGCHLD;
>  

I would be stricter for new kernels, we do not want the new value
reverted back by an accident. So what about:

static int err_nr = ARRAY_SIZE(exp_errnos);

static void setup(void)
{
	...
	if (tst_kvercmp(9, 19, 0) >= 0)
		err_nr = 1;
	...
}

>  	if (!SAFE_CLONE(args)) {
> -		TST_EXP_FAIL(ioctl(pidfd, PIDFD_GET_INFO, info), ESRCH);
> +		TST_EXP_FAIL_ARR(ioctl(pidfd, PIDFD_GET_INFO, info), exp_errnos,
> +				ARRAY_SIZE(exp_errnos));
				^
				err_nr

>  		exit(0);
>  	}
>  
> -- 
> 2.53.0
> 

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH v2 1/1] [STAGING] ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns
  2026-02-20 10:48 ` Cyril Hrubis
@ 2026-02-20 11:33   ` Petr Vorel
  2026-02-20 15:05   ` Jan Polensky
  1 sibling, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2026-02-20 11:33 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Linux Test Project

...
> > +static const int exp_errnos[] = {EREMOTE, ESRCH};

> >  static void run(void)
> >  {
> > @@ -41,7 +42,8 @@ static void run(void)
> >  	args->exit_signal = SIGCHLD;


> I would be stricter for new kernels, we do not want the new value
> reverted back by an accident. So what about:

So we might want to add this to ground rules.

> static int err_nr = ARRAY_SIZE(exp_errnos);

> static void setup(void)
> {
> 	...
> 	if (tst_kvercmp(9, 19, 0) >= 0)
> 		err_nr = 1;
> 	...
> }

+1

> >  	if (!SAFE_CLONE(args)) {
> > -		TST_EXP_FAIL(ioctl(pidfd, PIDFD_GET_INFO, info), ESRCH);
> > +		TST_EXP_FAIL_ARR(ioctl(pidfd, PIDFD_GET_INFO, info), exp_errnos,
> > +				ARRAY_SIZE(exp_errnos));
> 				^
> 				err_nr

+1

Kind regards,
Petr

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

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

* Re: [LTP] [PATCH v2 1/1] [STAGING] ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns
  2026-02-20 10:48 ` Cyril Hrubis
  2026-02-20 11:33   ` Petr Vorel
@ 2026-02-20 15:05   ` Jan Polensky
  1 sibling, 0 replies; 6+ messages in thread
From: Jan Polensky @ 2026-02-20 15:05 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Linux Test Project

On Fri, Feb 20, 2026 at 11:48:53AM +0100, Cyril Hrubis wrote:
> Hi!
> > PIDFD_GET_INFO semantics changed for pidfds referring to tasks without a PID
[snip]
> >
>
> I would be stricter for new kernels, we do not want the new value
> reverted back by an accident. So what about:
>
> static int err_nr = ARRAY_SIZE(exp_errnos);
>
> static void setup(void)
> {
> 	...
> 	if (tst_kvercmp(9, 19, 0) >= 0)
> 		err_nr = 1;
> 	...
> }
>
> >  	if (!SAFE_CLONE(args)) {
> > -		TST_EXP_FAIL(ioctl(pidfd, PIDFD_GET_INFO, info), ESRCH);
> > +		TST_EXP_FAIL_ARR(ioctl(pidfd, PIDFD_GET_INFO, info), exp_errnos,
> > +				ARRAY_SIZE(exp_errnos));
> 				^
> 				err_nr
Hi Cyril,

thanks for the suggestion. I agree with you.
I tested the change on v6.18.5 and v6.19.0.

I’ll send v3 with the err_nr update as proposed.

Thanks,
Jan


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

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

end of thread, other threads:[~2026-02-20 15:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-19 16:30 [LTP] [PATCH v2 1/1] [STAGING] ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns Jan Polensky
2026-02-19 20:06 ` Petr Vorel
2026-02-20 10:08 ` Andrea Cervesato via ltp
2026-02-20 10:48 ` Cyril Hrubis
2026-02-20 11:33   ` Petr Vorel
2026-02-20 15:05   ` Jan Polensky

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