[PATCH v3] linux: return UNSUPPORTED from tst-mount if entering mount namespace fails

Carlos O'Donell carlos@redhat.com
Mon Jul 18 13:45:35 GMT 2022


On 7/18/22 09:13, Mark Wielaard wrote:
> Hi Michael,
> 
> On Mon, Jul 18, 2022 at 11:16:57AM +1200, Michael Hudson-Doyle via Libc-alpha wrote:
>> Before this the test fails if run in a chroot by a non-root user:
>>
>> warning: could not become root outside namespace (Operation not permitted)
>> ../sysdeps/unix/sysv/linux/tst-mount.c:36: numeric comparison failure
>>    left: 1 (0x1); from: errno
>>   right: 19 (0x13); from: ENODEV
>> error: ../sysdeps/unix/sysv/linux/tst-mount.c:39: not true: fd != -1
>> error: ../sysdeps/unix/sysv/linux/tst-mount.c:46: not true: r != -1
>> error: ../sysdeps/unix/sysv/linux/tst-mount.c:48: not true: r != -1
>> ../sysdeps/unix/sysv/linux/tst-mount.c:52: numeric comparison failure
>>    left: 1 (0x1); from: errno
>>   right: 9 (0x9); from: EBADF
>> error: ../sysdeps/unix/sysv/linux/tst-mount.c:55: not true: mfd != -1
>> ../sysdeps/unix/sysv/linux/tst-mount.c:58: numeric comparison failure
>>    left: 1 (0x1); from: errno
>>   right: 2 (0x2); from: ENOENT
>> error: ../sysdeps/unix/sysv/linux/tst-mount.c:61: not true: r != -1
>> ../sysdeps/unix/sysv/linux/tst-mount.c:65: numeric comparison failure
>>    left: 1 (0x1); from: errno
>>   right: 2 (0x2); from: ENOENT
>> error: ../sysdeps/unix/sysv/linux/tst-mount.c:68: not true: pfd != -1
>> error: ../sysdeps/unix/sysv/linux/tst-mount.c:75: not true: fd_tree != -1
>> ../sysdeps/unix/sysv/linux/tst-mount.c:88: numeric comparison failure
>>    left: 1 (0x1); from: errno
>>   right: 38 (0x26); from: ENOSYS
>> error: 12 test failures
>>
>> Checking that the test can enter a new mount namespace is more correct
>> than just checking the return value of support_become_root() as the test
>> code changes the mount namespace it runs in so running it as root on a
>> system that does not support mount namespaces should still skip.
>>
>> Also change the test to remove the unnecessary fork.
> 
> Tested on x86_64, inside a fedora container where this patch turns the
> FAIL into an UNSUPPORTED. And "outside" a container on fedora where
> this patch makes misc/tst-mount still PASS.

If you test a patch please feel free to provide the Tested-by: tag which patchwork
will aggregate so when I apply the patch from git-pw your tag will get added and
end up in the commit (similar to b4).

It records the amazing work you did by testing a patch! :-)

-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list