From: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
To: khorenko@virtuozzo.com, ptikhomirov@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.2 v2 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks
Date: Tue, 17 Nov 2026 14:13:24 +0400 [thread overview]
Message-ID: <20261117101329.225854-5-mirian.shilakadze@virtuozzo.com> (raw)
In-Reply-To: <20261117101329.225854-1-mirian.shilakadze@virtuozzo.com>
While a VE is pseudosuper, any task in it may write the read-only files
of the container's root cgroup and sees the hidden cgroup roots. That
includes the container's own binaries that vzctl and CRIU run during
start or restore. quotaon at start can rewrite the root memory.max, and
any of them can write 0 to ve.pseudosuper, which ends the window early
and makes CRIU's restoring tasks reachable again.
Use ve_current_is_pseudosuper() for both, so only setup tasks get them.
Feature: ve: CRIU support
https://virtuozzo.atlassian.net/browse/VSTOR-151265
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
kernel/cgroup/cgroup.c | 4 ++--
kernel/ve/ve.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 77903a56b79e..b0f2e7a24b5f 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4765,7 +4765,7 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,
if (!ve_is_super(get_exec_env())
&& test_bit(CGRP_VE_ROOT, &cgrp->flags)
- && !get_exec_env()->is_pseudosuper
+ && !ve_current_is_pseudosuper(get_exec_env())
&& !(cft->flags & CFTYPE_VE_WRITABLE))
return -EPERM;
@@ -6947,7 +6947,7 @@ int ve_hide_cgroups(struct cgroup_root *root)
* Hide ve cgroup in CT for docker, still showing it to pseudosuper
* (criu), and also hide non-virtualized cgroups.
*/
- return !ve_is_super(ve) && !ve->is_pseudosuper &&
+ return !ve_is_super(ve) && !ve_current_is_pseudosuper(ve) &&
((root->subsys_mask & hidden_mask) ||
!is_virtualized_cgroot(root));
}
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 1cf4e71e8779..785d0ed4a05e 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1019,9 +1019,9 @@ static u64 ve_pseudosuper_read(struct cgroup_subsys_state *css, struct cftype *c
* operations such as mounting cgroups from inside of VE context
* is allowed in a sake of container restore for example.
*
- * While dropping pseudosuper privilegues is allowed from
- * any context to set this value up one have to be a real
- * node's owner.
+ * To set this value up one have to be a real node's owner.
+ * Inside the VE only its setup tasks may drop it, see
+ * cgroup_file_write().
*/
static int ve_pseudosuper_write(struct cgroup_subsys_state *css, struct cftype *cft, u64 val)
{
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-17 10:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 10:13 [Devel] [PATCH hci-8.2 v2 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Mirian Shilakadze
2026-11-17 10:13 ` [Devel] [PATCH hci-8.2 v2 1/6] ve: tell ve_setup_task() which VE the task comes from Mirian Shilakadze
2026-11-17 10:20 ` no-reply
2026-11-17 10:13 ` [Devel] [PATCH hci-8.2 v2 2/6] ve: hide only the tasks the host sends into a VE Mirian Shilakadze
2026-11-17 10:22 ` no-reply
2026-11-17 10:13 ` [Devel] [PATCH hci-8.2 v2 3/6] ve: hide the tasks that set up a starting VE from the rest of it Mirian Shilakadze
2026-11-17 10:27 ` no-reply
2026-11-17 11:40 ` Konstantin Khorenko
2026-11-17 10:13 ` Mirian Shilakadze [this message]
2026-11-17 10:30 ` [Devel] [PATCH hci-8.2 v2 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks no-reply
2026-11-17 10:13 ` [Devel] [PATCH hci-8.2 v2 5/6] fs: keep the mount relaxations of a pseudosuper VE from container binaries Mirian Shilakadze
2026-11-17 10:33 ` no-reply
2026-11-17 11:40 ` Konstantin Khorenko
2026-11-17 10:13 ` [Devel] [PATCH hci-8.2 v2 6/6] ve: give the remaining pseudosuper relaxations only to setup tasks Mirian Shilakadze
2026-11-17 10:35 ` no-reply
2026-11-17 11:40 ` [Devel] [PATCH hci-8.2 v2 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Konstantin Khorenko
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=20261117101329.225854-5-mirian.shilakadze@virtuozzo.com \
--to=mirian.shilakadze@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=ptikhomirov@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