Messages in this thread | | | Date | Thu, 25 Apr 2024 02:43:58 +0100 | From | Al Viro <> | Subject | Re: [PATCH v2 0/2] implement OA2_INHERIT_CRED flag for openat2() |
| |
On Wed, Apr 24, 2024 at 05:43:02PM -0700, Andy Lutomirski wrote:
> I like that, but you're blocking it the wrong way. My concern is that > someone does dfd = open("/proc/PID/fd/3") and then openat(dfd, ..., > OA2_INHERIT_CRED); IIRC open("/proc/PID/fd/3") is extremely magical > and returns the _same open file description_ (struct file) as PID's fd > 3.
No, it doesn't. We could implement that, but if we do that'll be *not* a part of procfs and it's going to be limited to current task only.
There are two different variants of /dev/fd/* semantics - one is "opening /dev/fd/42 is an equivalent of dup(42)", another is "opening /dev/fd/42 is an equivalent of opening the same fs object that is currently accessed via descriptor 42". Linux is doing the latter, and we can't switch - that would break a lot of userland software, including a lot of scripts.
I'm not saying I like the series, but this particular objection is bogus - open via procfs symlinks is *not* an equivalent of dup() and that is not going to change.
| |