* [PATCH] selftests/unprivileged-remount: Strip ST_VALID before flag sanity check
@ 2026-07-31 10:32 Chris Gellermann
0 siblings, 0 replies; only message in thread
From: Chris Gellermann @ 2026-07-31 10:32 UTC (permalink / raw)
To: shuah; +Cc: linux-kselftest, linux-kernel, Chris Gellermann
Musl (and potentially other non-glibc C libraries) just copies the
statfs flags received from the kernel to the user [1]. This way,
ST_VALID may end up in the f_flags, a Linux-specific flag [2] that is
generally hidden from the user. The unprivileged-remout-test
fails when checking for unknown flags.
If we run on a non-glibc C library, strip ST_VALID before sanity
checking the flags.
Link: https://git.musl-libc.org/cgit/musl/tree/src/stat/statvfs.c#n40
Link: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_statvfs.h.html
Signed-off-by: Chris Gellermann <christian.gellermann@codasip.com>
---
tools/testing/selftests/mount/unprivileged-remount-test.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/mount/unprivileged-remount-test.c b/tools/testing/selftests/mount/unprivileged-remount-test.c
index d2917054fe3a..c7bbed313495 100644
--- a/tools/testing/selftests/mount/unprivileged-remount-test.c
+++ b/tools/testing/selftests/mount/unprivileged-remount-test.c
@@ -45,6 +45,10 @@
# define MS_STRICTATIME (1 << 24)
#endif
+#ifndef ST_VALID
+# define ST_VALID (0x0020)
+#endif
+
static void die(char *fmt, ...)
{
va_list ap;
@@ -123,6 +127,9 @@ static int read_mnt_flags(const char *path)
die("statvfs of %s failed: %s\n",
path, strerror(errno));
}
+#ifndef __GLIBC__
+ stat.f_flag &= ~ST_VALID;
+#endif
if (stat.f_flag & ~(ST_RDONLY | ST_NOSUID | ST_NODEV | \
ST_NOEXEC | ST_NOATIME | ST_NODIRATIME | ST_RELATIME | \
ST_SYNCHRONOUS | ST_MANDLOCK)) {
--
2.47.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-31 10:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-31 10:32 [PATCH] selftests/unprivileged-remount: Strip ST_VALID before flag sanity check Chris Gellermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®