Re: pidfd && O_RDWR

From: David Laight

Date: Mon Feb 23 2026 - 13:15:13 EST


On Mon, 23 Feb 2026 18:05:44 +0100
Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> On 02/23, Oleg Nesterov wrote:
> >
> > Sorry for noise!
>
> Yes, but let me add more (off-topic) noise to this thread...
>
> pidfd_prepare() does pidfs_alloc_file(pid, flags | O_RDWR) and "| O_RDWR"
> makes no sense because pidfs_alloc_file() itself does
>
> flags |= O_RDWR;
>
> I was going to send the trivial cleanup, but why a pidfs file needs
> O_RDWR/FMODE_WRITE ?

Or why any program that gets that far through the code 'wins'
write access.

David