Linux filesystem development
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: NeilBrown <neil@brown.name>
Cc: Kees Cook <kees@kernel.org>,
	Joel Granados <joel.granados@kernel.org>,
	linux-fsdevel@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3?] proc_sysctl: remove rcu_dereference() for accessing ->sysctl
Date: Fri, 4 Jul 2025 03:03:48 +0100	[thread overview]
Message-ID: <20250704020348.GN1880847@ZenIV> (raw)
In-Reply-To: <175159315670.565058.128329102948224076@noble.neil.brown.name>

On Fri, Jul 04, 2025 at 11:39:16AM +1000, NeilBrown wrote:
> On Fri, 04 Jul 2025, Al Viro wrote:
> > On Mon, Jun 16, 2025 at 12:49:51PM +1000, NeilBrown wrote:
> > 
> > > The reality is that ->sysctl does not need rcu protection.  There is no
> > > concurrent update except that it can be set to NULL which is pointless.
> > 
> > I would rather *not* leave a dangling pointer there, and yes, it can
> > end up being dangling.  kfree_rcu() from inside the ->evict_inode()
> > may very well happen earlier than (also RCU-delayed) freeing of struct
> > inode itself.
> 
> In that case could we move the proc_sys_evict_inode() call from
> proc_evict_inode() to proc_free_inode(), and replace kfree_rcu() with
> kfree()?

proc_free_inode() can be called from softirq context, so we'd need to
touch all sysctl_lock users for that.  Definitely a larger patch that
way, if nothing else...

      reply	other threads:[~2025-07-04  2:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-15 23:00 [PATCH v3?] proc_sysctl: remove rcu_dereference() for accessing ->sysctl NeilBrown
2025-06-15 23:57 ` Al Viro
2025-06-16  2:49   ` NeilBrown
2025-07-03 23:43     ` Al Viro
2025-07-04  1:02       ` Al Viro
2025-07-04  1:39         ` NeilBrown
2025-07-04  2:19           ` Al Viro
2025-07-04  1:39       ` NeilBrown
2025-07-04  2:03         ` Al Viro [this message]

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=20250704020348.GN1880847@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=joel.granados@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil@brown.name \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox