public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] linux: return UNSUPPORTED in tst-mount if support_become_root fails
@ 2022-07-14  3:23 Michael Hudson-Doyle
  2022-07-14 11:24 ` Adhemerval Zanella Netto
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Michael Hudson-Doyle @ 2022-07-14  3:23 UTC (permalink / raw)
  To: libc-alpha

Otherwise 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
---
 sysdeps/unix/sysv/linux/tst-mount.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/tst-mount.c b/sysdeps/unix/sysv/linux/tst-mount.c
index 502d7e3433..bd75c9e704 100644
--- a/sysdeps/unix/sysv/linux/tst-mount.c
+++ b/sysdeps/unix/sysv/linux/tst-mount.c
@@ -103,7 +103,8 @@ subprocess (void)
 static int
 do_test (void)
 {
-  support_become_root ();
+  if (!support_become_root ())
+    FAIL_UNSUPPORTED("could not become root");
 
   pid_t pid = xfork ();
   if (pid == 0)
-- 
2.34.1


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

end of thread, other threads:[~2022-07-19  2:51 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14  3:23 [PATCH] linux: return UNSUPPORTED in tst-mount if support_become_root fails Michael Hudson-Doyle
2022-07-14 11:24 ` Adhemerval Zanella Netto
2022-07-14 19:03   ` Carlos O'Donell
2022-07-14 19:18 ` DJ Delorie
2022-07-14 22:50   ` Michael Hudson-Doyle
2022-07-14 23:16     ` DJ Delorie
2022-07-15  0:06 ` [PATCH v2] linux: return UNSUPPORTED in tst-mount if !support_can_chroot Michael Hudson-Doyle
2022-07-15  7:07   ` Florian Weimer
2022-07-15 15:35     ` Carlos O'Donell
2022-07-15 15:44       ` Florian Weimer
2022-07-17 21:44         ` Michael Hudson-Doyle
2022-07-15 21:01       ` Michael Hudson-Doyle
2022-07-16  0:26         ` Carlos O'Donell
2022-07-17 23:16   ` [PATCH v3] linux: return UNSUPPORTED from tst-mount if entering mount namespace fails Michael Hudson-Doyle
2022-07-18 12:59     ` Carlos O'Donell
2022-07-18 18:59       ` Michael Hudson-Doyle
2022-07-19  2:51         ` Carlos O'Donell
2022-07-18 13:13     ` Mark Wielaard
2022-07-18 13:45       ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).