Re: [PATCH v4 2/5] fs: Add fchmodat2()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Alexey Gladkov <legion@xxxxxxxxxx>
- Subject: Re: [PATCH v4 2/5] fs: Add fchmodat2()
- From: Christian Brauner <brauner@xxxxxxxxxx>
- Date: Tue, 11 Jul 2023 19:05:44 +0200
- Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, linux-api@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, viro@xxxxxxxxxxxxxxxxxx, James.Bottomley@xxxxxxxxxxxxxxxxxxxxx, acme@xxxxxxxxxx, alexander.shishkin@xxxxxxxxxxxxxxx, axboe@xxxxxxxxx, benh@xxxxxxxxxxxxxxxxxxx, borntraeger@xxxxxxxxxx, bp@xxxxxxxxx, catalin.marinas@xxxxxxx, christian@xxxxxxxxxx, dalias@xxxxxxxx, davem@xxxxxxxxxxxxx, deepa.kernel@xxxxxxxxx, deller@xxxxxx, dhowells@xxxxxxxxxx, fenghua.yu@xxxxxxxxx, fweimer@xxxxxxxxxx, geert@xxxxxxxxxxxxxx, glebfm@xxxxxxxxxxxx, gor@xxxxxxxxxxxxx, hare@xxxxxxxx, hpa@xxxxxxxxx, ink@xxxxxxxxxxxxxxxxxxxx, jhogan@xxxxxxxxxx, kim.phillips@xxxxxxx, ldv@xxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, linux@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, luto@xxxxxxxxxx, mattst88@xxxxxxxxx, mingo@xxxxxxxxxx, monstr@xxxxxxxxx, mpe@xxxxxxxxxxxxxx, namhyung@xxxxxxxxxx, paulus@xxxxxxxxx, peterz@xxxxxxxxxxxxx, ralf@xxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, stefan@xxxxxxxx, tglx@xxxxxxxxxxxxx, tony.luck@xxxxxxxxx, tycho@xxxxxxxx, will@xxxxxxxxxx, x86@xxxxxxxxxx, ysato@xxxxxxxxxxxxx, Palmer Dabbelt <palmer@xxxxxxxxxx>
- In-reply-to: <f2a846ef495943c5d101011eebcf01179d0c7b61.1689092120.git.legion@kernel.org>
- References: <cover.1689074739.git.legion@kernel.org> <cover.1689092120.git.legion@kernel.org> <f2a846ef495943c5d101011eebcf01179d0c7b61.1689092120.git.legion@kernel.org>
On Tue, Jul 11, 2023 at 06:16:04PM +0200, Alexey Gladkov wrote:
> On the userspace side fchmodat(3) is implemented as a wrapper
> function which implements the POSIX-specified interface. This
> interface differs from the underlying kernel system call, which does not
> have a flags argument. Most implementations require procfs [1][2].
>
> There doesn't appear to be a good userspace workaround for this issue
> but the implementation in the kernel is pretty straight-forward.
>
> The new fchmodat2() syscall allows to pass the AT_SYMLINK_NOFOLLOW flag,
> unlike existing fchmodat.
>
> [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/fchmodat.c;h=17eca54051ee28ba1ec3f9aed170a62630959143;hb=a492b1e5ef7ab50c6fdd4e4e9879ea5569ab0a6c#l35
> [2] https://git.musl-libc.org/cgit/musl/tree/src/stat/fchmodat.c?id=718f363bc2067b6487900eddc9180c84e7739f80#n28
>
> Co-developed-by: Palmer Dabbelt <palmer@xxxxxxxxxx>
> Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxx>
> Signed-off-by: Alexey Gladkov <legion@xxxxxxxxxx>
> Acked-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> fs/open.c | 18 ++++++++++++++----
> include/linux/syscalls.h | 2 ++
> 2 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/fs/open.c b/fs/open.c
> index 0c55c8e7f837..39a7939f0d00 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -671,11 +671,11 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
> return err;
> }
>
> -static int do_fchmodat(int dfd, const char __user *filename, umode_t mode)
> +static int do_fchmodat(int dfd, const char __user *filename, umode_t mode, int lookup_flags)
Should all be unsigned instead of int here for flags. We also had a
documentation update to that effect but smh never sent it.
user_path_at() itself takes an unsigned as well.
I'll fix that up though.
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]