[Devel] [PATCH vz10 v2] fs/kernfs, ve: pin the VE that created a kernfs instance

no-reply at sashiko.virtuozzo.com no-reply at sashiko.virtuozzo.com
Tue Sep 29 19:54:50 MSK 2026


> kernfs_get_tree() stores a bare get_exec_env() pointer in
> kernfs_super_info, and since commit 8d1abf587552 ("fs/kernfs, ve:
> hide entries from a VE without invalidating the dentry")
> kernfs_dop_revalidate() compares it against the caller's VE to decide
> between dropping the dentry and answering -ENOENT.
> 
> Nothing backs that pointer with a reference: if the mount is pinned from
> outside - the host bind-mounted a Container's sysfs, or holds an fd
> inside it - the superblock outlives the Container, info->ve dangles, and
> a later Container whose ve_struct is allocated at the same address is
> mistaken for the creator of the instance. Its lookups then take the
> d_invalidate() path on the dead instance and detach the mounts placed on
> top of it.
> 
> Take a css reference on the VE for the lifetime of the superblock, so
> [ ... ]
> Fixes: 8d1abf587552 ("fs/kernfs, ve: hide entries from a VE without invalidating the dentry")
> https://virtuozzo.atlassian.net/browse/VSTOR-142552
> 
> Feature: kernfs: per-CT entries visibility and permissions configuration
> Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>

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

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260929-prep-kh-vstor-142552-kernfs-pin-ve-v2-1-0795e3aee679@virtuozzo.com?part=1




More information about the Devel mailing list