lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 28 Jan 2024 16:19:35 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>, Mathieu Desnoyers
 <mathieu.desnoyers@...icios.com>, LKML <linux-kernel@...r.kernel.org>,
 Linux Trace Devel <linux-trace-devel@...r.kernel.org>, Christian Brauner
 <brauner@...nel.org>, Ajay Kaher <ajay.kaher@...adcom.com>, Geert
 Uytterhoeven <geert@...ux-m68k.org>, linux-fsdevel
 <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH] eventfs: Have inodes have unique inode numbers

On Sun, 28 Jan 2024 12:53:31 -0800
Linus Torvalds <torvalds@...ux-foundation.org> wrote:

> Honestly, you should just *always* do refcounting. No "free after RCU
> delay" as an alternative. Just refcount it.
> 
> Now, the RCU delay may be needed if the lookup of said structure
> happens under RCU, but no, saying "I use SRCU to make sure the
> lifetime is at least X" is just broken.
> 
> The refcount is what gives the lifetime. Any form of RCU-delaying
> should then be purely about non-refcounting RCU lookups that may
> happen as the thing is dying (and said lookup should *look* at the
> refcount and say "oh, this is dead, I'm not returning this".

The deleting of the ei is done outside the VFS logic. I use SRCU to
synchronize looking at the ei children in the lookup. On deletion, I
grab the eventfs_mutex, set ei->is_freed and then wait for SRCU to
finish before freeing.

The lookup checks ei->is_freed and doesn't do anything if set, but most
that logic is under the SRCU, which is what I want to make sure is
finished before the ei is deleted.

Hmm, I still need the logic for iput(), as dentry->d_fsdata can still
access the ei. That's where I need to have the ref counters. For a
lookup, I need to up the ref count when I create a new inode for the ei
or its children. Then in the iput() I decrement the ei ref count. I can
only free the ei if the ref count is zero.

The ref count is for knowing if an ei is referenced by a
dentry->d_fsdata, and the SRCU is to make sure there's no lookups
accessing an ei.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ