All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <brauner@kernel.org>
Cc: Jann Horn <jannh@google.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: pidfd && O_RDWR
Date: Tue, 24 Feb 2026 11:17:43 +0100	[thread overview]
Message-ID: <aZ16x0OH098LMqen@redhat.com> (raw)
In-Reply-To: <20260223-ziemlich-gemalt-0900475140e5@brauner>

On 02/23, Christian Brauner wrote:
>
> On Mon, Feb 23, 2026 at 08:21:02PM +0100, Oleg Nesterov wrote:
> > On 02/23, Oleg Nesterov wrote:
> > >
> > > 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 ?
> > >
> > > Actually the same question about some anon_inode_getfile_fmode(O_RDWR)
> > > users, for example signalfd.c.
> >
> > perhaps an accidental legacy from 628ff7c1d8d8 ("anonfd: Allow making anon
> > files read-only") ?
>
> It was always a possibility that we would support some form of
> write-like operation eventually. And we have support for setting trusted
> extended attributes on pidfds for some time now (trusted xattrs require
> global cap_sys_admin).

But why do we need O_RDWR right now? That was my question.

I can be easily wrong, but I think that pidfs_xattr_handlers logic doesn't
need it...

OK, I won't pretend I understand fs, I'll send the trivial cleanup which just
removes the unnecessary "flags | O_RDWR" in pidfd_prepare().

Oleg.


  parent reply	other threads:[~2026-02-24 10:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 10:44 [PATCH v4 0/4] pidfd: add CLONE_AUTOREAP and CLONE_PIDFD_AUTOKILL Christian Brauner
2026-02-23 10:44 ` [PATCH v4 1/4] clone: add CLONE_AUTOREAP Christian Brauner
2026-02-23 10:44 ` [PATCH v4 2/4] pidfd: add CLONE_PIDFD_AUTOKILL Christian Brauner
2026-02-23 15:47   ` Oleg Nesterov
2026-02-23 15:51     ` Oleg Nesterov
2026-02-23 17:05       ` pidfd && O_RDWR Oleg Nesterov
2026-02-23 18:14         ` David Laight
2026-02-23 19:21         ` Oleg Nesterov
2026-02-23 21:39           ` Christian Brauner
2026-02-24  9:43             ` David Laight
2026-02-24 10:17             ` Oleg Nesterov [this message]
2026-02-24 16:47               ` Christian Brauner
2026-02-23 10:45 ` [PATCH v4 3/4] selftests/pidfd: add CLONE_AUTOREAP tests Christian Brauner
2026-02-23 10:45 ` [PATCH v4 4/4] selftests/pidfd: add CLONE_PIDFD_AUTOKILL tests Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aZ16x0OH098LMqen@redhat.com \
    --to=oleg@redhat.com \
    --cc=brauner@kernel.org \
    --cc=jannh@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.