public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v3 1/1] [STAGING] ioctl_pidfd06: Select expected errno for PIDFD_GET_INFO across pidns
@ 2026-02-20 17:39 Jan Polensky
  2026-02-22 21:35 ` Petr Vorel
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jan Polensky @ 2026-02-20 17:39 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")).

Select the expected errno based on the running kernel version to keep the
test working on kernels before and after the change, while being strict on
newer kernels to avoid accepting the legacy errno by accident.

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

diff --git a/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c b/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
index 751281bacb74..52da322db050 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 int err_nr = ESRCH;
 
 static void run(void)
 {
@@ -41,7 +42,7 @@ 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(ioctl(pidfd, PIDFD_GET_INFO, info), err_nr);
 		exit(0);
 	}
 
@@ -52,6 +53,8 @@ static void setup(void)
 {
 	if (!ioctl_pidfd_info_exit_supported())
 		tst_brk(TCONF, "PIDFD_INFO_EXIT is not supported by ioctl()");
+	if (tst_kvercmp(7, 0, 0) >= 0)
+		err_nr = EREMOTE;
 }
 
 static struct tst_test test = {
-- 
2.53.0


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

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

end of thread, other threads:[~2026-03-02 11:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-20 17:39 [LTP] [PATCH v3 1/1] [STAGING] ioctl_pidfd06: Select expected errno for PIDFD_GET_INFO across pidns Jan Polensky
2026-02-22 21:35 ` Petr Vorel
2026-02-24 10:20 ` Andrea Cervesato via ltp
2026-03-02  8:49 ` Jan Stancek via ltp
2026-03-02 11:26   ` Petr Vorel
2026-03-02 10:33 ` Cyril Hrubis

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