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]
Message-ID: <20250307164216.GI2023217@ZenIV>
Date: Fri, 7 Mar 2025 16:42:16 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: brauner@...nel.org, jack@...e.cz, linux-kernel@...r.kernel.org,
	linux-fsdevel@...r.kernel.org, io-uring@...r.kernel.org,
	audit@...r.kernel.org, axboe@...nel.dk
Subject: Re: [PATCH] fs: support filename refcount without atomics

On Fri, Mar 07, 2025 at 05:11:55PM +0100, Mateusz Guzik wrote:
> Atomics are only needed for a combination of io_uring and audit.
> 
> Regular file access (even with audit) gets around fine without them.
> 
> With this patch 'struct filename' starts with being refcounted using
> regular ops.
> 
> In order to avoid API explosion in the getname*() family, a dedicated
> routine is added to switch the obj to use atomics.
> 
> This leaves the room for merely issuing getname(), not issuing the
> switch and still trying to manipulate the refcount from another thread.
> 
> Catching such cases is facilitated by CONFIG_DEBUG_VFS-dependent
> tracking of who created the given filename object and having refname()
> and putname() detect if another thread is trying to modify them.

Not a good way to handle that, IMO.

Atomics do hurt there, but they are only plastering over the real
problem - names formed in one thread, inserted into audit context
there and operation involving them happening in a different thread.

Refcounting avoids an instant memory corruption, but the real PITA
is in audit users of that stuff.

IMO we should *NOT* grab an audit names slot at getname() time -
that ought to be done explicitly at later points.

The obstacle is that currently there still are several retry loop
with getname() done in it; I've most of that dealt with, need to
finish that series.

And yes, refcount becomes non-atomic as the result.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ