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 17:01:25 -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 13:08:55 -0800
Linus Torvalds <torvalds@...ux-foundation.org> wrote:

> On Sun, 28 Jan 2024 at 12:53, Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
> >
> > 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.  
> 
> Put another way, the only reason for any RCU should be that you don't
> use locking at lookup, and the normal lookup routine should follow a
> pattern something like this:
> 
>     rcu_read_lock();
>     entry = find_entry(...);
>     if (entry && !atomic_inc_not_zero(&entry->refcount))
>         entry = NULL;
>     rcu_read_unlock();
> 
> and the freeing should basically follow a pattern like
> 
>     if (atomic_dec_and_test(&entry->refcount))
>         rcu_free(entry);

Basically you are saying that when the ei is created, it should have a
ref count of 1. If the lookup happens and does the
atomic_inc_not_zero() it will only increment if the ref count is not 0
(which is basically equivalent to is_freed).

And then we can have deletion of the object happen in both where the
caller (kprobes) deletes the directory and in the final iput()
reference (can I use iput and not the d_release()?), that it does the
same as well.

Where whatever sees the refcount of zero calls rcu_free?

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ