ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns
PATCH v2 1/1 ioctl_pidfd06: accept EREMOTE/ESRCH for PIDFD_GET_INFO across pidns
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).
--- testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c +3 -1
@@ -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 ); }
Signature · 5 lines
2.53.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Jan,
Quoted 6 lines
PIDFD_GET_INFOsemantics changed for pidfds referring to tasks without a PID in the caller's current pid namespace (commitab89060fbc92e("pidfs: return-EREMOTEwhenPIDFD_GET_INFOis called on another ns")).Accept both errnos to keep the test working on kernels with and without the change (including backports).
LGTM, thanks!
Kind regards,
Petr
Quoted 26 lines
Signed-off-by Jan Polensky <[email protected]>--- testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c +3
-1@@ -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 ); }
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
LGTM
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 25 lines
PIDFD_GET_INFOsemantics changed for pidfds referring to tasks without a PID in the caller's current pid namespace (commitab89060fbc92e("pidfs: return-EREMOTEwhenPIDFD_GET_INFOis 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 <[email protected]>--- testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c +1
-0@@ -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 ) {
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c static void run(void) · line 43
Quoted 2 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c +0
-0@@ -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;
...
}testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c static void run(void) · line 46
Quoted 4 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c +2
-1if (!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
Quoted 6 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c +0
-0exit (0 ); }Signature · 1 line
2.53.0
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
...
Quoted 10 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c static void run(void) · line 42
Quoted 6 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c +1
-0+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.
Quoted 9 lines
static int
err_nr=ARRAY_SIZE(exp_errnos);static void setup(void)
{ ... if (tst_kvercmp(9, 19, 0) >= 0) err_nr = 1; ... }
+1
Quoted 6 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c static void run(void) · line 46
Quoted 4 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c +2
-1if (!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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 2 lines · Cyril Hrubis
Hi!
Quoted 1 line
PIDFD_GET_INFOsemantics changed for pidfds referring to tasks without a PID
[snip]
Quoted 15 lines
Quoted 1 line
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; ... }
Quoted 6 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c static void run(void) · line 46
Quoted 4 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c +2
-1if (!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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp