All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/14] configfs cleanups and fixes
@ 2026-05-19  7:06 Al Viro
  2026-05-19  7:06 ` [RFC PATCH 01/14] configfs_lookup(): don't leave ->s_dentry dangling on failure Al Viro
                   ` (14 more replies)
  0 siblings, 15 replies; 60+ messages in thread
From: Al Viro @ 2026-05-19  7:06 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Andreas Hindborg, Breno Leitao, Linus Torvalds, Christian Brauner,
	Jan Kara

A bunch of configfs patches; fix for UAF caught while doing dentry memory
safety audit + stuff cherry-picked from old branches, up to the minimal
switch to d_make_persistent().

There's a *lot* more still rotting in the old configfs branches (the
earliest stuff there is from back in 2018), but I would prefer to deal
with that gradually - the last thing I want is yet another variant of
the same pile sitting around to be sorted out someday ;-/

The stuff in this pile:
	* minimal UAF fix for configfs_lookup() (ancient, but you'd
need the allocation of in-core inode to fail at the right time, and if
the things are controllable for attacker to that degree, the system is
already FUBAR)
	* obvious cleanup in configfs_mkdir() - no need to do a manual
analogue of take_dentry_name_snapshot() when we are not going to modify
the copy we make.
	* sorting out the argument types for a bunch of "iterate over
configfs_dirent subtree" functions; being able to switch back and forth
between dentry and configfs_dirent (via ->d_fsdata and ->s_dentry resp.)
doesn't mean we need to without a good reason.	Passing dentry only to
use it for ->d_fsdata isn't one, especially when some callers get it as
some_configfs_dirent->s_dentry in the first place.
	* partially untangle creation and removal of directory trees;
ideally I'd like to use simple_recursive_removal() for the latter
and create-then-move-in-place for the former, but that takes a _lot_
of preliminary massage.  For now just get it to the point where we can
regularize the refcount mess - some objects are pinned once, some twice,
for no good reason.
	* switch to d_make_persistent() on creation side with
simple_rmdir() and simple_unlink() on removals.
	* sanitize attribute removal - we don't want full
__simple_unlink() there *and* we ought to lock the inode for i_nlink
updates.
	* do *not* update the timestamps of directory when looking an
attribute up; stat foo/bar shouldn't update the modification time of foo.


	Fixes aside, the main result is that configfs is finally switched
to tree-in-dcache machinery.  It's *not* making use of recursive removal
helpers yet, and it still does the bloody awful "build subtree in full
sight of userland, with possibility of failure halfway through and need
to unroll" that forces the locking model from hell; dealing with that
is a separate patch series, once this one is out of the way.  However,
it is using DCACHE_PERSISTENT properly now.  And apparmorfs is the sole
remaining user of __simple_{unlink,rmdir}() at that point.

	This branch (7.1-rc4-based) lives in
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git #work.configfs
Individual patches in followups.  It has been lightly tested, but it
obviously needs more beating.

	Review and testing would be very welcome.

Al Viro (14):
  configfs_lookup(): don't leave ->s_dentry dangling on failure
  configfs_mkdir(): use take_dentry_name_snapshot()
  configfs_detach_prep(): pass configfs_dirent instead of dentry
  configfs_depend_prep(): pass configfs_dirent instead of dentry
  configfs_do_depend_item(): pass configfs_dirent instead of dentry
  configfs_detach_rollback(): pass configfs_dirent instead of dentry
  populate_group(): move cleanup on failure to the sole caller
  populate_attrs(): move cleanup to the sole caller
  configfs_remove_dir(), detach_attrs(): switch to passing dentry
  switch configfs_detach_{group,item}() to passing dentry
  configfs: dentry refcount needs to be pinned only once
  configfs: mark pinned dentries persistent
  kill configfs_drop_dentry()
  configfs_create(): lift parent timestamp updates into callers

 fs/configfs/configfs_internal.h |   1 -
 fs/configfs/dir.c               | 225 ++++++++++++++------------------
 fs/configfs/inode.c             |  25 ----
 fs/configfs/symlink.c           |   3 +-
 4 files changed, 97 insertions(+), 157 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 60+ messages in thread

end of thread, other threads:[~2026-06-03  8:28 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19  7:06 [RFC PATCH 00/14] configfs cleanups and fixes Al Viro
2026-05-19  7:06 ` [RFC PATCH 01/14] configfs_lookup(): don't leave ->s_dentry dangling on failure Al Viro
2026-05-19  9:57   ` Jan Kara
2026-05-21 16:38   ` Breno Leitao
2026-05-19  7:06 ` [RFC PATCH 02/14] configfs_mkdir(): use take_dentry_name_snapshot() Al Viro
2026-05-19  9:59   ` Jan Kara
2026-05-21 16:54   ` Breno Leitao
2026-05-19  7:06 ` [RFC PATCH 03/14] configfs_detach_prep(): pass configfs_dirent instead of dentry Al Viro
2026-05-19 10:12   ` Jan Kara
2026-05-21 17:03   ` Breno Leitao
2026-05-19  7:06 ` [RFC PATCH 04/14] configfs_depend_prep(): " Al Viro
2026-05-19 10:18   ` Jan Kara
2026-05-19  7:06 ` [RFC PATCH 05/14] configfs_do_depend_item(): " Al Viro
2026-05-19 10:25   ` Jan Kara
2026-05-19  7:06 ` [RFC PATCH 06/14] configfs_detach_rollback(): " Al Viro
2026-05-19 10:26   ` Jan Kara
2026-05-19  7:06 ` [RFC PATCH 07/14] populate_group(): move cleanup on failure to the sole caller Al Viro
2026-05-19 10:29   ` Jan Kara
2026-05-19  7:06 ` [RFC PATCH 08/14] populate_attrs(): move cleanup " Al Viro
2026-05-19 10:31   ` Jan Kara
2026-05-19  7:06 ` [RFC PATCH 09/14] configfs_remove_dir(), detach_attrs(): switch to passing dentry Al Viro
2026-05-19 10:42   ` Jan Kara
2026-05-19  7:06 ` [RFC PATCH 10/14] switch configfs_detach_{group,item}() " Al Viro
2026-05-19 12:10   ` Jan Kara
2026-05-19  7:06 ` [RFC PATCH 11/14] configfs: dentry refcount needs to be pinned only once Al Viro
2026-05-19 13:21   ` Jan Kara
2026-05-19  7:06 ` [RFC PATCH 12/14] configfs: mark pinned dentries persistent Al Viro
2026-05-19 13:03   ` Jan Kara
2026-05-19  7:06 ` [RFC PATCH 13/14] kill configfs_drop_dentry() Al Viro
2026-05-19 13:12   ` Jan Kara
2026-05-19 14:44     ` Linus Torvalds
2026-05-19 15:37     ` Al Viro
2026-05-19 21:06       ` Jan Kara
2026-05-19  7:06 ` [RFC PATCH 14/14] configfs_create(): lift parent timestamp updates into callers Al Viro
2026-05-19 13:23   ` Jan Kara
2026-06-03  7:47 ` [PATCH v2 00/18] configfs cleanups and fixes Al Viro
2026-06-03  7:47   ` [PATCH v2 01/18] configfs_lookup(): don't leave ->s_dentry dangling on failure Al Viro
2026-06-03  7:47   ` [PATCH v2 1/3] get rid of impossible checks in detach_attrs()/configfs_detach_item() Al Viro
2026-06-03  7:53     ` Al Viro
2026-06-03  8:09       ` Christian Brauner
2026-06-03  8:28         ` Al Viro
2026-06-03  7:47   ` [PATCH v2 2/3] configfs_detach_item(): victim is never negative Al Viro
2026-06-03  7:47   ` [PATCH v2 02/18] configfs: fix lockless traversals of ->s_children Al Viro
2026-06-03  7:47   ` [PATCH v2 3/3] configfs: expand the call of simple_rmdir() Al Viro
2026-06-03  7:48   ` [PATCH v2 03/18] configfs_mkdir(): use take_dentry_name_snapshot() Al Viro
2026-06-03  7:48   ` [PATCH v2 04/18] configfs_detach_prep(): pass configfs_dirent instead of dentry Al Viro
2026-06-03  7:48   ` [PATCH v2 05/18] configfs_depend_prep(): " Al Viro
2026-06-03  7:48   ` [PATCH v2 06/18] configfs_do_depend_item(): " Al Viro
2026-06-03  7:48   ` [PATCH v2 07/18] configfs_detach_rollback(): " Al Viro
2026-06-03  7:48   ` [PATCH v2 08/18] populate_group(): move cleanup on failure to the sole caller Al Viro
2026-06-03  7:48   ` [PATCH v2 09/18] populate_attrs(): move cleanup " Al Viro
2026-06-03  7:48   ` [PATCH v2 10/18] configfs_remove_dir(), detach_attrs(): switch to passing dentry Al Viro
2026-06-03  7:48   ` [PATCH v2 11/18] switch configfs_detach_{group,item}() " Al Viro
2026-06-03  7:48   ` [PATCH v2 12/18] configfs: dentry refcount needs to be pinned only once Al Viro
2026-06-03  7:48   ` [PATCH v2 13/18] configfs: mark pinned dentries persistent Al Viro
2026-06-03  7:48   ` [PATCH v2 14/18] kill configfs_drop_dentry() Al Viro
2026-06-03  7:48   ` [PATCH v2 15/18] configfs_create(): lift parent timestamp updates into callers Al Viro
2026-06-03  7:48   ` [PATCH v2 16/18] configs_attach_item(): drop unused parent_item argument Al Viro
2026-06-03  7:48   ` [PATCH v2 17/18] configfs_attach_group(): drop the " Al Viro
2026-06-03  7:48   ` [PATCH v2 18/18] create_default_group(): pass parent's dentry instead of config_group Al Viro

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.