[PATCH bpf-next v1 02/11] namei: add vfs_walk_ancestors()

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Oct 13 17:00:10 UTC 2026


> Add a callback-based walk over a path and its ancestors, built on
> __path_walk_parent(): the kernel owns the loop and the callback must
> not sleep, so an rcu-walk engine can be added later without changing
> the API.
> 
> Internally the walk is a stepwise engine - vfs_walk_start(),
> vfs_walk_next(), vfs_walk_end(), static to namei.c for now, with the
> walk state declared in fs/internal.h - and vfs_walk_ancestors() is a
> loop over it.  The position's flags live in the walk state, where the
> next step needs them anyway: stepping off a disconnected position
> resumes at the root of its mount.  A later patch exposes the engine so
> an iterating consumer can drive it, with every step and invariant
> staying in namei.c.
> 
> Disconnected root dentries are reported to the callback instead of
> terminating the walk.  A disconnected mountpoint landed on by a mount
> crossing - the one position this walk visits that a
> dget_parent()/follow_up() loop never does - is additionally flagged
> VFS_WALK_POS_MOUNTPOINT, so security callers can reproduce their
> pre-conversion evaluation sequence exactly.
> 
> Suggested-by: NeilBrown <neil at brown.name>
> Suggested-by: Christian Brauner <brauner at kernel.org>
> Signed-off-by: Justin Suess <utilityemal77 at gmail.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013164800.2906577-1-utilityemal77@gmail.com?part=2




More information about the Linux-security-module-archive mailing list