OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
To: Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH vz10] fs/kernfs, ve: pin the VE that mounted a kernfs instance
Date: Tue, 29 Sep 2026 11:06:37 +0200	[thread overview]
Message-ID: <179067279723.3771826.10255714771184588776.b4-review@b4> (raw)
In-Reply-To: <20260928-prep-kh-vstor-142552-kernfs-pin-ve-v1-1-7297e159e813@virtuozzo.com>

> 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
> the comparison always names the VE that really created the instance.

This race of ve pointer reused and superblock being given to other ve
(the one which reused the pointer) is supper low probability. Each new
ve will get its own netns and thus it's own sysfs sb, it wont ever look
on the old ve superblock and thus on this stale matching ve pointer.

So practically we can avoid extra reference to ve here, as an Admin
giving old ve kernfs superblock to a new ve is not realy our usecase and
only breaks sysfs visibility.

Except that looks good.

Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

-- 
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-09-29  9:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 16:41 Konstantin Khorenko
2026-09-29  9:06 ` Pavel Tikhomirov [this message]
2026-09-29 11:21 ` Mirian Shilakadze

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=179067279723.3771826.10255714771184588776.b4-review@b4 \
    --to=ptikhomirov@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    /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