Re: [PATCH v2 2/4] Add fchmodat4(), a new syscall
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Rich Felker <dalias@xxxxxxxx>
- Subject: Re: [PATCH v2 2/4] Add fchmodat4(), a new syscall
- From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 17 Jul 2019 04:02:58 +0100
- Cc: Palmer Dabbelt <palmer@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-api@xxxxxxxxxxxxxxx, Arnd Bergmann <arnd@xxxxxxxx>, rth@xxxxxxxxxxx, ink@xxxxxxxxxxxxxxxxxxxx, mattst88@xxxxxxxxx, linux@xxxxxxxxxxxxxxx, catalin.marinas@xxxxxxx, will@xxxxxxxxxx, tony.luck@xxxxxxxxx, fenghua.yu@xxxxxxxxx, geert@xxxxxxxxxxxxxx, monstr@xxxxxxxxx, ralf@xxxxxxxxxxxxxx, paul.burton@xxxxxxxx, jhogan@xxxxxxxxxx, James.Bottomley@xxxxxxxxxxxxxxxxxxxxx, deller@xxxxxx, benh@xxxxxxxxxxxxxxxxxxx, paulus@xxxxxxxxx, mpe@xxxxxxxxxxxxxx, heiko.carstens@xxxxxxxxxx, gor@xxxxxxxxxxxxx, borntraeger@xxxxxxxxxx, ysato@xxxxxxxxxxxxxxxxxxxx, davem@xxxxxxxxxxxxx, luto@xxxxxxxxxx, tglx@xxxxxxxxxxxxx, mingo@xxxxxxxxxx, bp@xxxxxxxxx, hpa@xxxxxxxxx, x86@xxxxxxxxxx, peterz@xxxxxxxxxxxxx, acme@xxxxxxxxxx, alexander.shishkin@xxxxxxxxxxxxxxx, jolsa@xxxxxxxxxx, namhyung@xxxxxxxxxx, dhowells@xxxxxxxxxx, firoz.khan@xxxxxxxxxx, stefan@xxxxxxxx, schwidefsky@xxxxxxxxxx, axboe@xxxxxxxxx, christian@xxxxxxxxxx, hare@xxxxxxxx, deepa.kernel@xxxxxxxxx, tycho@xxxxxxxx, kim.phillips@xxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
- In-reply-to: <20190717024046.GI1506@brightrain.aerifal.cx>
- References: <20190717012719.5524-1-palmer@sifive.com> <20190717012719.5524-3-palmer@sifive.com> <20190717024046.GI1506@brightrain.aerifal.cx>
- User-agent: Mutt/1.11.3 (2019-02-01)
On Tue, Jul 16, 2019 at 10:40:46PM -0400, Rich Felker wrote:
> On Tue, Jul 16, 2019 at 06:27:17PM -0700, Palmer Dabbelt wrote:
> > man 3p says that fchmodat() takes a flags argument, but the Linux
> > syscall does not. There doesn't appear to be a good userspace
> > workaround for this issue but the implementation in the kernel is pretty
> > straight-forward. The specific use case where the missing flags came up
> > was WRT a fuse filesystem implemenation, but the functionality is pretty
> > generic so I'm assuming there would be other use cases.
>
> Note that we do have a workaround in musl libc with O_PATH and
> /proc/self/fd, but a syscall that allows a proper fix with the ugly
> workaround only in the fallback path for old kernels will be much
> appreciated!
>
> What about also doing a new SYS_faccessat4 with working AT_EACCESS
> flag? The workaround we have to do for it is far worse.
Umm... That's doable, but getting into the "don't switch creds unless
needed" territory. I'll need to play with that a bit and see what
gives a tolerable variant...
What of this part wrt AT_EACCESS?
if (!issecure(SECURE_NO_SETUID_FIXUP)) {
/* Clear the capabilities if we switch to a non-root user */
kuid_t root_uid = make_kuid(override_cred->user_ns, 0);
if (!uid_eq(override_cred->uid, root_uid))
cap_clear(override_cred->cap_effective);
else
override_cred->cap_effective =
override_cred->cap_permitted;
}
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]