From: no-reply@sashiko.virtuozzo.com
To: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>,
vasileios.almpanis@virtuozzo.com, ptikhomirov@virtuozzo.com,
Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v6 2/5] ve: Introduce override_ve/revert_ve helpers
Date: Mon, 16 Nov 2026 16:12:36 +0000 [thread overview]
Message-ID: <010701a1e521bf0e-723150fc-8b01-45f5-80f5-b1c75ecf2265-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261116-ovl-use-orig-ve-v6-2-7cfb41c8c973@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] ve: commit message omits ve_capable() change and override_ve()
rules
- [Low] ve: override_ve() error path reads ve_name(new_ve) with no pin
against ve_offline()
--
commit 1ff80fe27a47be85961240ab0b7e9287052ee68d
Author: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
ve: Introduce override_ve/revert_ve helpers
This commit adds override_ve() and revert_ve() helpers, which mirror override_creds() and revert_creds(). It also adds a task->overrided_ve field. ve_capable() and ve_capable_noaudit() now use that field, and dup_task_struct() clears it on fork.
> diff --git a/include/linux/ve.h b/include/linux/ve.h
> --- a/include/linux/ve.h
> +++ b/include/linux/ve.h
> @@ -295,6 +295,30 @@ static inline struct vdso_image *ve_get_vdso_64(struct ve_struct *ve)
> return ve->vdso_64;
> }
>
> +static inline struct ve_struct *override_ve(struct ve_struct *new_ve)
> +{
> + struct ve_struct *old_ve = current->overrided_ve;
> +
> + /* CT tasks are not supposed to switch VE context, this is a breach */
> + if (new_ve != get_exec_env() && !ve_is_super(get_exec_env())) {
> + pr_err_ratelimited("Invalid VE override: %s -> %s\n",
> + ve_name(get_exec_env()),
> + VE_IS_RUNNING(new_ve) ? ve_name(new_ve) : "(dead VE)");
[Severity: Low]
As reported by Konstantin Khorenko on v5 [1], can this read freed memory?
ve_name(new_ve) is read with no lock, RCU section or reference. The
VE_IS_RUNNING() check is racy, and ve_offline() frees ve->ve_name with a
plain kfree() and no RCU. The get_ve() reference held by the caller keeps
the ve_struct alive, but not the name string.
The message is ratelimited and the window is narrow. Would it be better
to stop printing ve_name(new_ve) here, as requested on v5?
> + return ERR_PTR(-EPERM);
> + }
> +
> + current->overrided_ve = new_ve;
> + return old_ve;
> +}
[ ... ]
> diff --git a/kernel/capability.c b/kernel/capability.c
> --- a/kernel/capability.c
> +++ b/kernel/capability.c
> @@ -389,10 +389,11 @@ EXPORT_SYMBOL(ns_capable);
> bool ve_capable(int cap)
> {
> struct cred *cred;
> + struct ve_struct *ve = current->overrided_ve ?: get_exec_env();
> bool ret;
[Severity: Low]
As reported by Konstantin Khorenko on v5 [1], the commit message never
mentions that ve_capable() and ve_capable_noaudit() now check capabilities
against current->overrided_ve instead of get_exec_env(). It also does not
say which VE switches override_ve() allows, and that it refuses a switch
by a CT task to a different VE with -EPERM.
Could the message describe these behaviour changes?
[1] https://lore.kernel.org/r/179448942112.4060562.12042466360723083159.b4-review@b4
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116-ovl-use-orig-ve-v6-0-7cfb41c8c973@virtuozzo.com?part=2
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-16 16:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 16:06 [Devel] [PATCH hci-8.1 v6 0/5] Fix kernel crash in overlayfs Vladimir Riabchun
2026-11-16 16:06 ` [Devel] [PATCH hci-8.1 v6 1/5] ve: Remove STOPPED state Vladimir Riabchun
2026-11-16 16:10 ` no-reply
2026-11-16 16:25 ` Vladimir Riabchun
2026-11-16 16:06 ` [Devel] [PATCH hci-8.1 v6 2/5] ve: Introduce override_ve/revert_ve helpers Vladimir Riabchun
2026-11-16 16:12 ` no-reply [this message]
2026-11-16 16:06 ` [Devel] [PATCH hci-8.1 v6 3/5] ve: Defer ve creds drop until ve is completely destroyed Vladimir Riabchun
2026-11-16 16:14 ` no-reply
2026-11-16 16:06 ` [Devel] [PATCH hci-8.1 v6 4/5] ovl: Keep creator VE in overlayfs superblock Vladimir Riabchun
2026-11-16 16:13 ` no-reply
2026-11-16 16:06 ` [Devel] [PATCH hci-8.1 v6 5/5] ve/overlayfs: Override VE together with creds Vladimir Riabchun
2026-11-16 16:19 ` no-reply
2026-11-16 16:52 ` Vladimir Riabchun
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=010701a1e521bf0e-723150fc-8b01-45f5-80f5-b1c75ecf2265-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=ptikhomirov@virtuozzo.com \
--cc=vasileios.almpanis@virtuozzo.com \
--cc=vladimir.riabchun@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