[PATCH v2] linux: return UNSUPPORTED in tst-mount if !support_can_chroot
Florian Weimer
fweimer@redhat.com
Fri Jul 15 15:44:24 GMT 2022
* Carlos O'Donell:
>> I think you should call and check support_enter_mount_namespace instead,
>> to make sure that the test does not modify the original mount namespace.
>
> Like this in the child?
>
> diff --git a/sysdeps/unix/sysv/linux/tst-mount.c b/sysdeps/unix/sysv/linux/tst-mount.c
> index 502d7e3433..d19d70d42d 100644
> --- a/sysdeps/unix/sysv/linux/tst-mount.c
> +++ b/sysdeps/unix/sysv/linux/tst-mount.c
> @@ -107,7 +107,11 @@ do_test (void)
>
> pid_t pid = xfork ();
> if (pid == 0)
> - subprocess ();
> + {
> + if (!support_enter_mount_namespace ())
> + FAIL_UNSUPPORTED ("could not enter new mount namespace");
> + subprocess ();
> + }
Yes, except that you need to change
xwaitpid (pid, &status, 0);
TEST_VERIFY (WIFEXITED (status));
as well, to handle status 77.
I'm not entirely sure the fork is necessary, though.
Thanks,
Florian
More information about the Libc-alpha
mailing list