[LTP] [PATCH v1] ioctl_pidfd06: Accept both ESRCH and EREMOTE for PIDFD_GET_INFO
Wei Gao
wegao@suse.com
Mon Apr 6 04:35:34 CEST 2026
LTP commit f630471a6520 attempted to handle this using a kernel version
check (7.0.0). However, this is proving unreliable as the change is
appearing in earlier kernel versions (e.g., 6.19.x) due to different
release cycles or backports.
Fixes: f630471a6520 ("ioctl_pidfd06: Select expected errno for PIDFD_GET_INFO across pidns")
Signed-off-by: Wei Gao <wegao@suse.com>
---
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c b/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
index 0f24d4741..fec85d680 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c
@@ -14,7 +14,10 @@
static struct tst_clone_args *args;
static struct pidfd_info *info;
-static int err_nr = ESRCH;
+static int exp_errnos[] = {
+ ESRCH,
+ EREMOTE,
+};
static void run(void)
{
@@ -42,7 +45,10 @@ static void run(void)
args->exit_signal = SIGCHLD;
if (!SAFE_CLONE(args)) {
- TST_EXP_FAIL(ioctl(pidfd, PIDFD_GET_INFO, info), err_nr);
+ TST_EXP_FAIL_ARR(
+ ioctl(pidfd, PIDFD_GET_INFO, info),
+ exp_errnos, ARRAY_SIZE(exp_errnos)
+ );
exit(0);
}
@@ -53,9 +59,6 @@ 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.52.0
More information about the ltp
mailing list