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 5/6] fs: keep the mount relaxations of a pseudosuper VE from container binaries
Date: Tue, 17 Nov 2026 14:13:25 +0400 [thread overview]
Message-ID: <20261117101329.225854-6-mirian.shilakadze@virtuozzo.com> (raw)
In-Reply-To: <20261117101329.225854-1-mirian.shilakadze@virtuozzo.com>
While a VE is pseudosuper, any task in it skips the device mount option
filter and the VE mount limit, including the container's own binaries
that vzctl and CRIU run.
Give the option filter relaxation only to setup tasks. The mount limit
also lets through a host task that joined the VE after it started, such
as the CRIU helper that mounts proc for a nested pid namespace during
restore. Without that, restoring such a container near its mount limit
fails. Add ve_current_is_host_task() for the two kinds of host task.
Feature: ve: CRIU support
https://virtuozzo.atlassian.net/browse/VSTOR-151265
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
fs/namespace.c | 12 ++++++------
include/linux/ve.h | 2 ++
kernel/ve/ve.c | 14 ++++++++++++++
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index d622d9b72d32..fd6ef93ed403 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -3226,11 +3226,11 @@ int ve_devmnt_process(struct ve_struct *ve, dev_t dev, void **data_pp, int remou
if (devmnt->dev == dev) {
err = ve_devmnt_check(data, devmnt->allowed_options);
/*
- * In case of @is_pseudosuper set, ie restore procedure,
- * we don't check for allowed options filtering, since
+ * Setup tasks of a pseudosuper VE, ie the restore
+ * procedure, skip the allowed options filtering, since
* restore mode is special.
*/
- if (ve->is_pseudosuper)
+ if (ve_current_is_pseudosuper(ve))
err = 0;
if (!err && !remount)
@@ -3255,7 +3255,7 @@ int ve_devmnt_process(struct ve_struct *ve, dev_t dev, void **data_pp, int remou
* the way userspace tool restore container
* it might be nonempty as well.
*/
- if (ve->is_pseudosuper) {
+ if (ve_current_is_pseudosuper(ve)) {
err = 0;
} else if (((char *)*data_pp)[0] == '\0') {
err = 0;
@@ -3330,7 +3330,7 @@ int ve_devmnt_verify(struct ve_struct *ve, dev_t dev, char *opts, bool new_mount
bool found = false;
int err = 0;
- if (ve->is_pseudosuper)
+ if (ve_current_is_pseudosuper(ve))
return 0;
mutex_lock(&ve->devmnt_mutex);
@@ -3367,7 +3367,7 @@ int ve_devmnt_verify(struct ve_struct *ve, dev_t dev, char *opts, bool new_mount
static inline int ve_try_reserve_mount(struct ve_struct *ve)
{
- int ret = ve_is_super(ve) || ve->is_pseudosuper ||
+ int ret = ve_is_super(ve) || ve_current_is_host_task(ve) ||
ve_is_super(get_exec_env());
/* Ignore limits in ve0 and pseudosuper cases, but still count. */
if (ret)
diff --git a/include/linux/ve.h b/include/linux/ve.h
index 56c310205394..5859550eb07c 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -285,6 +285,7 @@ extern bool is_ve_init_net(const struct net *net);
void ve_setup_task(struct task_struct *p, struct ve_struct *old_ve,
struct ve_struct *ve);
bool ve_current_is_pseudosuper(struct ve_struct *ve);
+bool ve_current_is_host_task(struct ve_struct *ve);
int ve_vps_dumpable(struct mm_struct *mm, struct ve_struct *ve);
void ve_set_rpc_kill_fn(void (*fn)(struct net *, bool));
@@ -396,6 +397,7 @@ static inline int vz_security_protocol_check(struct net *net, int protocol) { re
static inline void ve_setup_task(struct task_struct *p, struct ve_struct *old_ve,
struct ve_struct *ve) { }
static inline bool ve_current_is_pseudosuper(struct ve_struct *ve) { return true; }
+static inline bool ve_current_is_host_task(struct ve_struct *ve) { return true; }
#define ve_vps_dumpable(mm, ve) ((mm)->vps_dumpable)
static inline void ve_set_rpc_kill_fn(void (*fn)(struct net *, bool)) { }
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 785d0ed4a05e..afa846593a11 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1804,6 +1804,20 @@ bool ve_current_is_pseudosuper(struct ve_struct *ve)
return ve_is_super(ve) || ve_current_has_mark(ve, VD_VE_SETUP_TASK);
}
+/**
+ * ve_current_is_host_task - is current a host task of pseudosuper @ve
+ * @ve: the VE
+ *
+ * Always true for ve0. Otherwise true for a setup task of @ve and for a host
+ * task that joined @ve after it started, such as the CRIU helper that mounts
+ * proc for a nested pid namespace, until pseudosuper is cleared.
+ */
+bool ve_current_is_host_task(struct ve_struct *ve)
+{
+ return ve_current_is_pseudosuper(ve) ||
+ ve_current_has_mark(ve, VD_VE_ENTER_TASK);
+}
+
/**
* ve_vps_dumpable - vps_dumpable of a task as the access checks see it
* @mm: the task's mm
--
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:15 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 ` [Devel] [PATCH hci-8.2 v2 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks Mirian Shilakadze
2026-11-17 10:30 ` no-reply
2026-11-17 10:13 ` Mirian Shilakadze [this message]
2026-11-17 10:33 ` [Devel] [PATCH hci-8.2 v2 5/6] fs: keep the mount relaxations of a pseudosuper VE from container binaries 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-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.