|
Message-ID: <20240913211404.GE10433@brightrain.aerifal.cx>
Date: Fri, 13 Sep 2024 17:14:04 -0400
From: Rich Felker <dalias@...c.org>
To: Gabriel Ravier <gabravier@...il.com>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] statx: fix ENOSYS emulation not setting stx_rdev_*
On Fri, Sep 13, 2024 at 10:00:15PM +0200, Gabriel Ravier wrote:
> The current implementation of the statx function fails to set the
> values of stx->stx_rdev_major and stx->stx_rdev_minor if the statx
> syscall fails with ENOSYS and thus the statx function has to fall back
> on fstatat-based emulation.
>
> This commit fixes this.
>
> Note: I have not strictly been able to test this in "natural
> conditions", i.e. on a kernel without statx support, but I have been
> able to test this on a kernel that has statx and fstatat support in
> two different ways:
> - by removing the call to __syscall(SYS_statx, ...) and replacing it with
> `int err = -ENOSYS;`, and
> - using a seccomp eBPF filter to catch statx syscalls and making them
> return ENOSYS
> ---
> src/linux/statx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/linux/statx.c b/src/linux/statx.c
> index 4616bff4..5f6dde92 100644
> --- a/src/linux/statx.c
> +++ b/src/linux/statx.c
> @@ -21,6 +21,8 @@ int statx(int dirfd, const char *restrict path, int flags, unsigned mask, struct
>
> stx->stx_dev_major = major(st.st_dev);
> stx->stx_dev_minor = minor(st.st_dev);
> + stx->stx_rdev_major = major(st.st_rdev);
> + stx->stx_rdev_minor = minor(st.st_rdev);
> stx->stx_ino = st.st_ino;
> stx->stx_mode = st.st_mode;
> stx->stx_nlink = st.st_nlink;
> --
> 2.46.0
Thanks. I recall back in the spring I was waiting on someone else who
proposed to fix this, but never followed up, so I'll go ahead and
merge your patch now. I also have further fixes which I'll commit
separately (attached).
Rich
View attachment "0001-statx-fix-uninitialized-attributes-mask-in-fallback-.patch" of type "text/plain" (1785 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.