From: no-reply@sashiko.virtuozzo.com
To: ptikhomirov@virtuozzo.com,
Konstantin Khorenko <khorenko@virtuozzo.com>,
Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v4 5/5] ve/overlayfs: Override VE together with creds
Date: Mon, 9 Nov 2026 19:49:27 +0000 [thread overview]
Message-ID: <010701a1c1dbc46a-09b3db06-4bcb-439b-848f-69df34074a4b-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261109-ovl-use-orig-ve-v4-5-88e65484dc5b@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] ovl: ovl_override_creds() fails with WARN and -EPERM for CT callers of a foreign-VE overlay
--
commit 9e04559c3517d9690eb025bf97e30b602d11f4ca
Author: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
ve/overlayfs: Override VE together with creds
This patch changes ovl_override_creds() to also override the VE
(through override_ve()) using ofs->creator_ve. It returns both the old
cred and the old VE in a new struct ovl_creds_desc, and converts all
overlayfs callers to the new ovl_override_creds()/ovl_revert_creds()
pair. The stated goal is to let a host user access an overlayfs created
inside a CT without ve_capable() checks failing.
Link: https://virtuozzo.atlassian.net/browse/VSTOR-142405
> diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
> index f95090f0d29c..d28d572d6099 100644
> --- a/fs/overlayfs/util.c
> +++ b/fs/overlayfs/util.c
[ ... ]
> @@ -63,11 +63,27 @@ struct dentry *ovl_workdir(struct dentry *dentry)
> return ofs->workdir;
> }
>
> -const struct cred *ovl_override_creds(struct super_block *sb)
> +/* On error no revert is needed. */
> +int ovl_override_creds(struct super_block *sb, struct ovl_creds_desc *desc)
> {
> struct ovl_fs *ofs = OVL_FS(sb);
>
> - return override_creds(ofs->creator_cred);
> + desc->ve = override_ve(ofs->creator_ve);
> + if (IS_ERR(desc->ve))
> + return PTR_ERR(desc->ve);
> +
> + desc->cred = override_creds(ofs->creator_cred);
> + return 0;
> +}
[Severity: Medium]
Can this turn a previously working access into a WARN plus -EPERM for
tasks running in a container?
ovl_fill_super() stores ofs->creator_ve = get_ve(get_exec_env()), so
creator_ve is the VE of the mounting task. Every converted entry point
(ovl_lookup(), ovl_permission(), ovl_getattr(), ovl_iterate(),
ovl_open_realfile(), the xattr and copy-up paths) now calls
ovl_override_creds(), which calls override_ve(ofs->creator_ve).
With CONFIG_VE, override_ve() in include/linux/ve.h does:
if (WARN_ON(new_ve != get_exec_env() && !ve_is_super(get_exec_env())))
return ERR_PTR(-EPERM);
That condition is true for any non-host task whose VE differs from
creator_ve. One example is a CT task reaching a host-mounted overlay
through a bind mount or mount propagation. Another is a CT task reaching
another CT's overlay. In both cases, ovl_override_creds() returns -EPERM
and the operation fails.
Before this patch only the creds were swapped, so that access worked.
Each failure now also emits a WARN backtrace, which is a panic with
panic_on_warn. Is this reachable from within a container?
The commit message covers only the host-accessing-CT direction and does
not mention this one. Is it intended that a CT task accessing an overlay
created in a different VE fails with -EPERM?
If it is intended, would it be better to avoid the WARN_ON backtrace on
this path, for example by checking the VE relationship in
ovl_override_creds() before calling override_ve()?
[ ... ]
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261109-ovl-use-orig-ve-v4-0-88e65484dc5b@virtuozzo.com?part=5
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-09 19:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 19:35 [Devel] [PATCH hci-8.1 v4 0/5] Fix kernel crash in overlayfs Vladimir Riabchun
2026-11-09 19:35 ` [Devel] [PATCH hci-8.1 v4 1/5] ve: Remove STOPPED state Vladimir Riabchun
2026-11-09 19:41 ` no-reply
2026-11-09 19:36 ` [Devel] [PATCH hci-8.1 v4 2/5] ve: Introduce override_ve/revert_ve helpers Vladimir Riabchun
2026-11-09 19:43 ` no-reply
2026-11-09 19:52 ` Vladimir Riabchun
2026-11-09 19:36 ` [Devel] [PATCH hci-8.1 v4 3/5] ve: Defer ve context drop until ve is completely destroyed Vladimir Riabchun
2026-11-09 19:44 ` no-reply
2026-11-09 19:36 ` [Devel] [PATCH hci-8.1 v4 4/5] ovl: Keep creator VE in overlayfs superblock Vladimir Riabchun
2026-11-09 19:45 ` no-reply
2026-11-09 19:36 ` [Devel] [PATCH hci-8.1 v4 5/5] ve/overlayfs: Override VE together with creds Vladimir Riabchun
2026-11-09 19:49 ` no-reply [this message]
2026-11-09 19:56 ` 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=010701a1c1dbc46a-09b3db06-4bcb-439b-848f-69df34074a4b-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=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