From: Yu Watanabe Date: Fri, 21 Jul 2023 16:15:59 +0000 (+0900) Subject: mountpoint-util: statx() may return EINVAL if the kernel does not support the syscall X-Git-Tag: v254-rc3~7^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=748711576662dbf697d5b4251d3fdbce6a666e7a;p=thirdparty%2Fsystemd.git mountpoint-util: statx() may return EINVAL if the kernel does not support the syscall When statx() is called with AT_STATX_DONT_SYNC, glibc's fallback code returns EINVAL. See statx_generic() in glibc. --- diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c index 3584f317876..d7b182f6dd0 100644 --- a/src/basic/mountpoint-util.c +++ b/src/basic/mountpoint-util.c @@ -223,7 +223,9 @@ int fd_is_mount_point(int fd, const char *filename, int flags) { AT_STATX_DONT_SYNC, /* don't go to the network for this – for similar reasons */ STATX_TYPE, &sx) < 0) { - if (!ERRNO_IS_NOT_SUPPORTED(errno) && !ERRNO_IS_PRIVILEGE(errno)) + if (!ERRNO_IS_NOT_SUPPORTED(errno) && /* statx() is not supported by the kernel. */ + !ERRNO_IS_PRIVILEGE(errno) && /* maybe filtered by seccomp. */ + errno != EINVAL) /* glibc's fallback method returns EINVAL when AT_STATX_DONT_SYNC is set. */ return -errno; /* If statx() is not available or forbidden, fall back to name_to_handle_at() below */ @@ -371,7 +373,9 @@ int path_get_mnt_id_at(int dir_fd, const char *path, int *ret) { AT_STATX_DONT_SYNC, /* don't go to the network, mnt_id is a local concept */ STATX_MNT_ID, &buf.sx) < 0) { - if (!ERRNO_IS_NOT_SUPPORTED(errno) && !ERRNO_IS_PRIVILEGE(errno)) + if (!ERRNO_IS_NOT_SUPPORTED(errno) && /* statx() is not supported by the kernel. */ + !ERRNO_IS_PRIVILEGE(errno) && /* maybe filtered by seccomp. */ + errno != EINVAL) /* glibc's fallback method returns EINVAL when AT_STATX_DONT_SYNC is set. */ return -errno; /* Fall back to name_to_handle_at() and then fdinfo if statx is not supported or we lack