From: Mateusz Guzik <mjguzik@gmail.com>
To: brauner@kernel.org
Cc: viro@zeniv.linux.org.uk, jack@suse.cz,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Mateusz Guzik <mjguzik@gmail.com>
Subject: [PATCH 00/10] Towards safer path_* API
Date: Sun, 13 Sep 2026 16:49:07 +0200 [thread overview]
Message-ID: <20260913144918.1606123-1-mjguzik@gmail.com> (raw)
Currently the handling is highly error-prone with consumers allowed to
arbitrarily manipulate references, notably with path_get().
In the past this resulted in preventable bugs.
The end goal, not yet achieved with this patchset, will provide an
invariant that a populated 'struct path' has precisely one set of
references on it.
While consumers can still cause leaks by neglecting to path_put(), the
footgun of path_get() can be eliminated.
With this patchset instead of hand-rolling a path copy and issuing
path_get() on it, callers can resort to path_clone() instead.
Almost all path_get() consumers get converted, most of which with
coccinelle.
Few instances are left until I figure out a nice way to sort them out.
Overall almost entirety of this patchset is a NOP.
Mateusz Guzik (10):
fs: unexport backing_file_set_user_path() and make it take the ref on
its own
fs: add path_create(), path_move() and path_clone()
fs: use path_clone() in path_init()
fs: use path_clone() and path_move() in vfs_open*
fs: use path_clone() in backing_file_set_user_path()
Coccinelle-based conversion of path_* consumers to use the new
primitives
autofs: use path_create()
fsnotify: use path_clone()
proc: use path_clone()
nfsd: use path_clone()
drivers/block/loop.c | 3 +-
fs/autofs/dev-ioctl.c | 3 +-
fs/autofs/expire.c | 4 +--
fs/backing-file.c | 2 --
fs/devpts/inode.c | 6 ++--
fs/failfs.c | 3 +-
fs/fhandle.c | 3 +-
fs/file_attr.c | 6 ++--
fs/file_table.c | 3 +-
fs/fs_struct.c | 6 ++--
fs/namei.c | 44 ++++++++++++++++++++++++------
fs/namespace.c | 3 +-
fs/nfsd/export.c | 6 ++--
fs/nfsd/nfs4xdr.c | 8 +++---
fs/notify/fanotify/fanotify.c | 6 ++--
fs/notify/fanotify/fanotify_user.c | 3 +-
fs/nsfs.c | 3 +-
fs/open.c | 10 ++-----
fs/overlayfs/params.c | 3 +-
fs/pidfs.c | 3 +-
fs/proc/base.c | 6 ++--
fs/proc/fd.c | 3 +-
fs/smb/server/vfs.c | 3 +-
fs/xfs/xfs_handle.c | 3 +-
include/linux/path.h | 14 ++++++++--
kernel/trace/bpf_trace.c | 3 +-
security/apparmor/task.c | 3 +-
security/keys/big_key.c | 3 +-
security/landlock/fs.c | 3 +-
security/landlock/syscalls.c | 3 +-
30 files changed, 87 insertions(+), 85 deletions(-)
--
2.53.0
next reply other threads:[~2026-09-13 14:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 14:49 Mateusz Guzik [this message]
2026-09-13 14:49 ` [PATCH 01/10] fs: unexport backing_file_set_user_path() and make it take the ref on its own Mateusz Guzik
2026-09-14 8:33 ` Jan Kara
2026-09-14 23:41 ` NeilBrown
2026-09-13 14:49 ` [PATCH 02/10] fs: add path_create(), path_move() and path_clone() Mateusz Guzik
2026-09-13 14:51 ` Mateusz Guzik
2026-09-14 23:46 ` NeilBrown
2026-09-15 0:05 ` NeilBrown
2026-09-15 0:10 ` NeilBrown
2026-09-13 14:49 ` [PATCH 03/10] fs: use path_clone() in path_init() Mateusz Guzik
2026-09-14 23:52 ` NeilBrown
2026-09-13 14:49 ` [PATCH 04/10] fs: use path_clone() and path_move() in vfs_open* Mateusz Guzik
2026-09-14 8:56 ` Jan Kara
2026-09-13 14:49 ` [PATCH 05/10] fs: use path_clone() in backing_file_set_user_path() Mateusz Guzik
2026-09-14 8:57 ` Jan Kara
2026-09-13 14:49 ` [PATCH 06/10] Coccinelle-based conversion of path_* consumers to use the new primitives Mateusz Guzik
2026-09-14 8:57 ` Jan Kara
2026-09-13 14:49 ` [PATCH 07/10] autofs: use path_create() Mateusz Guzik
2026-09-14 8:58 ` Jan Kara
2026-09-13 14:49 ` [PATCH 08/10] fsnotify: use path_clone() Mateusz Guzik
2026-09-14 8:36 ` Jan Kara
2026-09-13 14:49 ` [PATCH 09/10] proc: " Mateusz Guzik
2026-09-14 8:58 ` Jan Kara
2026-09-13 14:49 ` [PATCH 10/10] nfsd: " Mateusz Guzik
2026-09-14 9:01 ` Jan Kara
2026-09-14 8:53 ` [PATCH 00/10] Towards safer path_* API Jan Kara
2026-09-14 23:36 ` NeilBrown
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=20260913144918.1606123-1-mjguzik@gmail.com \
--to=mjguzik@gmail.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®