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 <[email protected]> --- 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

