* [Devel] [PATCH vz10 1/6] ve: tell ve_setup_task() which VE the task comes from
2026-11-16 10:45 [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Mirian Shilakadze
@ 2026-11-16 10:45 ` Mirian Shilakadze
2026-11-16 10:50 ` no-reply
2026-11-16 10:45 ` [Devel] [PATCH vz10 2/6] ve: hide only the tasks the host sends into a VE Mirian Shilakadze
` (5 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Mirian Shilakadze @ 2026-11-16 10:45 UTC (permalink / raw)
To: khorenko, ptikhomirov; +Cc: devel
The next changes mark a task entering a VE by where it comes from. Pass
the VE the task leaves to ve_setup_task(). No functional change.
Feature: ve: ve generic structures
https://virtuozzo.atlassian.net/browse/VSTOR-151265
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
include/linux/ve.h | 6 ++++--
kernel/ve/ve.c | 3 ++-
kernel/ve/ve_namespace.c | 7 +++++--
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/include/linux/ve.h b/include/linux/ve.h
index a400d21593b2..2fe1a1c9ff55 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -282,7 +282,8 @@ int ve_net_hide_sysctl(struct net *net);
extern bool is_ve_init_net(const struct net *net);
-void ve_setup_task(struct task_struct *p, struct ve_struct *ve);
+void ve_setup_task(struct task_struct *p, struct ve_struct *old_ve,
+ struct ve_struct *ve);
void ve_set_rpc_kill_fn(void (*fn)(struct net *, bool));
@@ -390,7 +391,8 @@ static inline struct cgroup_subsys_state *css_ve_root1(
static inline int vz_security_family_check(struct net *net, int family, int type) { return 0; }
static inline int vz_security_protocol_check(struct net *net, int protocol) { return 0; }
-static inline void ve_setup_task(struct task_struct *p, struct ve_struct *ve) { }
+static inline void ve_setup_task(struct task_struct *p, struct ve_struct *old_ve,
+ struct ve_struct *ve) { }
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 6cdfaaa4e703..29d68594bcde 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1841,7 +1841,8 @@ int ve_get_cpu_stat(struct ve_struct *ve, struct kernel_cpustat *kstat)
}
EXPORT_SYMBOL(ve_get_cpu_stat);
-void ve_setup_task(struct task_struct *task, struct ve_struct *ve)
+void ve_setup_task(struct task_struct *task, struct ve_struct *old_ve,
+ struct ve_struct *ve)
{
if (ve == &ve0)
return;
diff --git a/kernel/ve/ve_namespace.c b/kernel/ve/ve_namespace.c
index 6b12bcd605ea..82b84ed93092 100644
--- a/kernel/ve/ve_namespace.c
+++ b/kernel/ve/ve_namespace.c
@@ -106,6 +106,7 @@ int copy_ve_ns(unsigned long flags, struct task_struct *p)
{
struct user_namespace *user_ns = task_cred_xxx(p, user_ns);
struct ve_namespace *old_ve_ns = p->ve_ns;
+ struct ve_struct *old_ve = p->task_ve;
struct ve_namespace *new_ve_ns;
if (!(flags & CLONE_NEWVE)) {
@@ -123,7 +124,7 @@ int copy_ve_ns(unsigned long flags, struct task_struct *p)
p->ve_ns = new_ve_ns;
p->task_ve = new_ve_ns->ve;
- ve_setup_task(p, p->task_ve);
+ ve_setup_task(p, old_ve, p->task_ve);
return 0;
}
@@ -161,6 +162,7 @@ void free_ve_ns(struct ve_namespace *ns)
void switch_ve_namespace(struct task_struct *p, struct ve_namespace *new)
{
struct ve_namespace *old;
+ struct ve_struct *old_ve;
/*
* FIXME
@@ -170,6 +172,7 @@ void switch_ve_namespace(struct task_struct *p, struct ve_namespace *new)
scoped_guard(task_lock, p) {
old = p->ve_ns;
+ old_ve = p->task_ve;
p->ve_ns = new;
p->task_ve = new ? new->ve : &ve0;
}
@@ -177,7 +180,7 @@ void switch_ve_namespace(struct task_struct *p, struct ve_namespace *new)
if (old)
put_ve_ns(old);
- ve_setup_task(p, p->task_ve);
+ ve_setup_task(p, old_ve, p->task_ve);
}
void exit_ve_namespace(struct task_struct *p)
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread* [Devel] [PATCH vz10 2/6] ve: hide only the tasks the host sends into a VE
2026-11-16 10:45 [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Mirian Shilakadze
2026-11-16 10:45 ` [Devel] [PATCH vz10 1/6] ve: tell ve_setup_task() which VE the task comes from Mirian Shilakadze
@ 2026-11-16 10:45 ` Mirian Shilakadze
2026-11-16 10:50 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
2026-11-16 10:45 ` [Devel] [PATCH vz10 3/6] ve: hide the tasks that set up a starting VE from the rest of it Mirian Shilakadze
` (4 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Mirian Shilakadze @ 2026-11-16 10:45 UTC (permalink / raw)
To: khorenko, ptikhomirov; +Cc: devel
ve_setup_task() marks a task entering a running VE VD_VE_ENTER_TASK,
which hides it from ptrace and /proc/<pid>/exe inside the VE. A
container task gets the mark too when it setns()es into its own VE, and
the mark goes to the mm, which it may share with another task. A host
task entering a stopping or stopped VE is not hidden at all.
Mark only tasks coming from the host, and do it in every VE state but
starting, which the next change handles.
Feature: trace: prohibit tracing sensitive tasks from CT
https://virtuozzo.atlassian.net/browse/VSTOR-151265
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
kernel/ve/ve.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 29d68594bcde..4db2d06da643 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1847,8 +1847,12 @@ void ve_setup_task(struct task_struct *task, struct ve_struct *old_ve,
if (ve == &ve0)
return;
- /* this prohibits ptracing of task entered to VE from host system */
- if (VE_IS_RUNNING(ve) && task->mm)
+ /*
+ * A task the host sends into a started VE is hidden from the tasks of
+ * the VE. The mark goes to the mm, which may be shared, so a task
+ * coming from a container never gets it.
+ */
+ if (task->mm && ve_is_super(old_ve) && ve->state != VE_STATE_STARTING)
task->mm->vps_dumpable = VD_VE_ENTER_TASK;
/* Drop OOM protection. */
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [Devel] [PATCH vz10 2/6] ve: hide only the tasks the host sends into a VE
2026-11-16 10:45 ` [Devel] [PATCH vz10 2/6] ve: hide only the tasks the host sends into a VE Mirian Shilakadze
@ 2026-11-16 10:50 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
1 sibling, 0 replies; 20+ messages in thread
From: no-reply @ 2026-11-16 10:50 UTC (permalink / raw)
To: Mirian Shilakadze, khorenko, ptikhomirov; +Cc: devel
> ve_setup_task() marks a task entering a running VE VD_VE_ENTER_TASK,
> which hides it from ptrace and /proc/<pid>/exe inside the VE. A
> container task gets the mark too when it setns()es into its own VE, and
> the mark goes to the mm, which it may share with another task. A host
> task entering a stopping or stopped VE is not hidden at all.
>
> Mark only tasks coming from the host, and do it in every VE state but
> starting, which the next change handles.
>
> Feature: trace: prohibit tracing sensitive tasks from CT
> https://virtuozzo.atlassian.net/browse/VSTOR-151265
> Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116104552.102938-1-mirian.shilakadze@virtuozzo.com?part=2
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Devel] [PATCH vz10 2/6] ve: hide only the tasks the host sends into a VE
2026-11-16 10:45 ` [Devel] [PATCH vz10 2/6] ve: hide only the tasks the host sends into a VE Mirian Shilakadze
2026-11-16 10:50 ` no-reply
@ 2026-11-16 17:17 ` Konstantin Khorenko
1 sibling, 0 replies; 20+ messages in thread
From: Konstantin Khorenko @ 2026-11-16 17:17 UTC (permalink / raw)
To: Mirian Shilakadze; +Cc: devel
I won't apply this version, please send v2.
On Mon, 16 Nov 2026 14:45:45 +0400, Mirian Shilakadze wrote:
> + if (task->mm && ve_is_super(old_ve) && ve->state != VE_STATE_STARTING)
> task->mm->vps_dumpable = VD_VE_ENTER_TASK;
Item 1 of the cover letter reply: keep a host task hidden when it
moves from one VE into another.
Why: setns() into a VE needs CAP_SYS_ADMIN only, so a host task in
starting VE A can setns() into running VE B. old_ve is then A, not
ve0, so the mark is left alone. With patch 3 the mm stays
VD_VE_SETUP_TASK, B is not pseudosuper, ve_vps_dumpable() returns
VD_PTRACE_COREDUMP, and B's root can ptrace the task and read its
fds. Before the series it got VD_VE_ENTER_TASK on entering B. Only a
hand-made flow does this, vzctl and CRIU always enter from ve0.
> A
> container task gets the mark too when it setns()es into its own VE, and
> the mark goes to the mm, which it may share with another task.
Item 2 of the cover letter reply: say why a container task must not
get the mark, and that a task entering its nested VE is no longer
hidden there.
Why: the reader sees what changes but not what was wrong with it, and
the nested VE case changes behaviour without a word.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Devel] [PATCH vz10 3/6] ve: hide the tasks that set up a starting VE from the rest of it
2026-11-16 10:45 [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Mirian Shilakadze
2026-11-16 10:45 ` [Devel] [PATCH vz10 1/6] ve: tell ve_setup_task() which VE the task comes from Mirian Shilakadze
2026-11-16 10:45 ` [Devel] [PATCH vz10 2/6] ve: hide only the tasks the host sends into a VE Mirian Shilakadze
@ 2026-11-16 10:45 ` Mirian Shilakadze
2026-11-16 10:55 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
2026-11-16 10:45 ` [Devel] [PATCH vz10 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks Mirian Shilakadze
` (3 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Mirian Shilakadze @ 2026-11-16 10:45 UTC (permalink / raw)
To: khorenko, ptikhomirov; +Cc: devel
CRIU's restoring tasks enter the VE before it runs, so they stay
VD_PTRACE_COREDUMP. A container binary run during the restore, such as
the tee that post-restore runs via vzctl exec3, can open their
/proc/<pid>/fd and take CRIU's log, its /proc fd and the transport
socket.
Mark a task the host sends into a starting VE as VD_VE_SETUP_TASK.
Fork keeps the mark and exec drops it. While the VE is pseudosuper, such
a task dumps no core and is reachable only from another setup task of
the VE, so CRIU's tasks still reach each other and what they exec does
not. Once pseudosuper is cleared the mark counts as VD_PTRACE_COREDUMP,
so the restored processes become ordinary ones.
Feature: trace: prohibit tracing sensitive tasks from CT
https://virtuozzo.atlassian.net/browse/VSTOR-151265
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
fs/coredump.c | 2 +-
include/linux/mm_types.h | 4 ++++
include/linux/ve.h | 4 ++++
kernel/ptrace.c | 23 +++++++++++++++----
kernel/ve/ve.c | 48 +++++++++++++++++++++++++++++++++++-----
5 files changed, 71 insertions(+), 10 deletions(-)
diff --git a/fs/coredump.c b/fs/coredump.c
index 3d15612e3493..6977c31aad59 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -618,7 +618,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
goto fail;
/* Avoid dumping sensitive tasks */
- if (mm->vps_dumpable != VD_PTRACE_COREDUMP)
+ if (ve_vps_dumpable(mm, get_exec_env()) != VD_PTRACE_COREDUMP)
goto fail;
cred = prepare_creds();
if (!cred)
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index befdf38ef855..9067efbaccac 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -1115,6 +1115,10 @@ extern struct mm_struct init_mm;
#define VD_PTRACE_COREDUMP 1/* tasks with ptrace and coredump allowed */
#define VD_LICDATA_ACCESS 2/* tasks accessed containers license data,
* no ptrace and no coredump allowed */
+#define VD_VE_SETUP_TASK 3/* tasks the host sent into a starting VE,
+ * reachable only from each other and the
+ * only ones with the pseudosuper relaxations,
+ * VD_PTRACE_COREDUMP once pseudosuper is off */
/* Pointer magic because the dynamic array size confuses some compilers. */
static inline void mm_init_cpumask(struct mm_struct *mm)
diff --git a/include/linux/ve.h b/include/linux/ve.h
index 2fe1a1c9ff55..56c310205394 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -284,6 +284,8 @@ 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);
+int ve_vps_dumpable(struct mm_struct *mm, struct ve_struct *ve);
void ve_set_rpc_kill_fn(void (*fn)(struct net *, bool));
@@ -393,6 +395,8 @@ 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; }
+#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/ptrace.c b/kernel/ptrace.c
index faf60bb8ae2c..ff71c3e37bc1 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -284,11 +284,26 @@ static bool task_still_dumpable(struct task_struct *task, unsigned int mode)
* whose mm was already dropped in exit_mm() or a kernel thread - cannot
* have its vps_dumpable confirmed, so deny it. This closes the window
* where a dying CT task could be inspected (e.g. an fd stolen via
- * pidfd_getfd()) after exit_mm() cleared ->mm.
+ * pidfd_getfd()) after exit_mm() cleared ->mm. While its VE is
+ * pseudosuper, a setup task is only inspectable by another one.
*/
- if (!ve_is_super(get_exec_env()) &&
- (!mm || mm->vps_dumpable != VD_PTRACE_COREDUMP))
- return false;
+ if (!ve_is_super(get_exec_env())) {
+ struct ve_struct *ve = task_ve(task);
+
+ if (!mm)
+ return false;
+
+ switch (ve_vps_dumpable(mm, ve)) {
+ case VD_PTRACE_COREDUMP:
+ break;
+ case VD_VE_SETUP_TASK:
+ if (!ve_current_is_pseudosuper(ve))
+ return false;
+ break;
+ default:
+ return false;
+ }
+ }
if (mm) {
if (get_dumpable(mm) == SUID_DUMP_USER)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 4db2d06da643..f7f802dc7ffb 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1788,6 +1788,42 @@ bool ve_check_trusted_exec(struct file *file, struct filename *name)
return false;
}
+/**
+ * ve_current_is_pseudosuper - may current use the pseudosuper relaxations of @ve
+ * @ve: the VE that grants them
+ *
+ * Only a VD_VE_SETUP_TASK of @ve may, and only until pseudosuper is cleared.
+ * Exec clears VD_VE_SETUP_TASK, so the container binaries that the host tools
+ * run may not.
+ */
+bool ve_current_is_pseudosuper(struct ve_struct *ve)
+{
+ struct mm_struct *mm = current->mm;
+
+ if (ve_is_super(ve))
+ return true;
+
+ return ve->is_pseudosuper && task_ve(current) == ve &&
+ mm && mm->vps_dumpable == VD_VE_SETUP_TASK;
+}
+
+/**
+ * ve_vps_dumpable - vps_dumpable of a task as the access checks see it
+ * @mm: the task's mm
+ * @ve: the task's VE
+ *
+ * A setup task becomes an ordinary one once @ve leaves pseudosuper, which
+ * cannot be set again while @ve runs. ve0 never leaves it.
+ */
+int ve_vps_dumpable(struct mm_struct *mm, struct ve_struct *ve)
+{
+ if (mm->vps_dumpable == VD_VE_SETUP_TASK &&
+ (ve_is_super(ve) || !ve->is_pseudosuper))
+ return VD_PTRACE_COREDUMP;
+
+ return mm->vps_dumpable;
+}
+
#ifdef CONFIG_CGROUP_SCHED
int ve_show_cpu_stat(struct ve_struct *ve, struct seq_file *p)
{
@@ -1848,12 +1884,14 @@ void ve_setup_task(struct task_struct *task, struct ve_struct *old_ve,
return;
/*
- * A task the host sends into a started VE is hidden from the tasks of
- * the VE. The mark goes to the mm, which may be shared, so a task
- * coming from a container never gets it.
+ * A task the host sends into a starting VE is a setup task, one it
+ * sends into a started VE is hidden from the tasks of the VE. The
+ * mark goes to the mm, which may be shared, so a task coming from a
+ * container never gets either.
*/
- if (task->mm && ve_is_super(old_ve) && ve->state != VE_STATE_STARTING)
- task->mm->vps_dumpable = VD_VE_ENTER_TASK;
+ if (task->mm && ve_is_super(old_ve))
+ task->mm->vps_dumpable = ve->state == VE_STATE_STARTING ?
+ VD_VE_SETUP_TASK : VD_VE_ENTER_TASK;
/* Drop OOM protection. */
task->signal->oom_score_adj = 0;
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [Devel] [PATCH vz10 3/6] ve: hide the tasks that set up a starting VE from the rest of it
2026-11-16 10:45 ` [Devel] [PATCH vz10 3/6] ve: hide the tasks that set up a starting VE from the rest of it Mirian Shilakadze
@ 2026-11-16 10:55 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
1 sibling, 0 replies; 20+ messages in thread
From: no-reply @ 2026-11-16 10:55 UTC (permalink / raw)
To: Mirian Shilakadze, khorenko, ptikhomirov; +Cc: devel
> CRIU's restoring tasks enter the VE before it runs, so they stay
> VD_PTRACE_COREDUMP. A container binary run during the restore, such as
> the tee that post-restore runs via vzctl exec3, can open their
> /proc/<pid>/fd and take CRIU's log, its /proc fd and the transport
> socket.
>
> Mark a task the host sends into a starting VE as VD_VE_SETUP_TASK.
> Fork keeps the mark and exec drops it. While the VE is pseudosuper, such
> a task dumps no core and is reachable only from another setup task of
> the VE, so CRIU's tasks still reach each other and what they exec does
> not. Once pseudosuper is cleared the mark counts as VD_PTRACE_COREDUMP,
> so the restored processes become ordinary ones.
>
> Feature: trace: prohibit tracing sensitive tasks from CT
> https://virtuozzo.atlassian.net/browse/VSTOR-151265
> Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116104552.102938-1-mirian.shilakadze@virtuozzo.com?part=3
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Devel] [PATCH vz10 3/6] ve: hide the tasks that set up a starting VE from the rest of it
2026-11-16 10:45 ` [Devel] [PATCH vz10 3/6] ve: hide the tasks that set up a starting VE from the rest of it Mirian Shilakadze
2026-11-16 10:55 ` no-reply
@ 2026-11-16 17:17 ` Konstantin Khorenko
1 sibling, 0 replies; 20+ messages in thread
From: Konstantin Khorenko @ 2026-11-16 17:17 UTC (permalink / raw)
To: Mirian Shilakadze; +Cc: devel
I won't apply this version, please send v2.
On Mon, 16 Nov 2026 14:45:46 +0400, Mirian Shilakadze wrote:
> +#define VD_VE_SETUP_TASK 3/* tasks the host sent into a starting VE,
> + * reachable only from each other and the
> + * only ones with the pseudosuper relaxations,
Item 3 of the cover letter reply: fix this comment and the
ve_current_is_pseudosuper() kernel-doc.
Why: patch 5 lets VD_VE_ENTER_TASK tasks skip the mount limit too, so
setup tasks are not the only ones. The kernel-doc says "Only a
VD_VE_SETUP_TASK of @ve may", but the function returns true for any
caller when @ve is ve0.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Devel] [PATCH vz10 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks
2026-11-16 10:45 [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Mirian Shilakadze
` (2 preceding siblings ...)
2026-11-16 10:45 ` [Devel] [PATCH vz10 3/6] ve: hide the tasks that set up a starting VE from the rest of it Mirian Shilakadze
@ 2026-11-16 10:45 ` Mirian Shilakadze
2026-11-16 10:53 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
2026-11-16 10:45 ` [Devel] [PATCH vz10 5/6] fs: give the mount relaxations of a pseudosuper VE " Mirian Shilakadze
` (2 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Mirian Shilakadze @ 2026-11-16 10:45 UTC (permalink / raw)
To: khorenko, ptikhomirov; +Cc: devel
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 ++--
1 file changed, 2 insertions(+), 2 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));
}
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [Devel] [PATCH vz10 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks
2026-11-16 10:45 ` [Devel] [PATCH vz10 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks Mirian Shilakadze
@ 2026-11-16 10:53 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
1 sibling, 0 replies; 20+ messages in thread
From: no-reply @ 2026-11-16 10:53 UTC (permalink / raw)
To: Mirian Shilakadze, khorenko, ptikhomirov; +Cc: devel
> 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>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116104552.102938-1-mirian.shilakadze@virtuozzo.com?part=4
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Devel] [PATCH vz10 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks
2026-11-16 10:45 ` [Devel] [PATCH vz10 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks Mirian Shilakadze
2026-11-16 10:53 ` no-reply
@ 2026-11-16 17:17 ` Konstantin Khorenko
1 sibling, 0 replies; 20+ messages in thread
From: Konstantin Khorenko @ 2026-11-16 17:17 UTC (permalink / raw)
To: Mirian Shilakadze; +Cc: devel
I won't apply this version, please send v2.
On Mon, 16 Nov 2026 14:45:47 +0400, Mirian Shilakadze wrote:
> Use ve_current_is_pseudosuper() for both, so only setup tasks get them.
Item 4 of the cover letter reply: update the comment above
ve_pseudosuper_write().
Why: it says dropping pseudosuper "is allowed from any context". After
this patch a task in the CT that is not a setup task gets -EPERM from
cgroup_file_write() on that file.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Devel] [PATCH vz10 5/6] fs: give the mount relaxations of a pseudosuper VE only to setup tasks
2026-11-16 10:45 [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Mirian Shilakadze
` (3 preceding siblings ...)
2026-11-16 10:45 ` [Devel] [PATCH vz10 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks Mirian Shilakadze
@ 2026-11-16 10:45 ` Mirian Shilakadze
2026-11-16 10:56 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
2026-11-16 10:45 ` [Devel] [PATCH vz10 6/6] ve: give the remaining pseudosuper relaxations " Mirian Shilakadze
2026-11-16 17:17 ` [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Konstantin Khorenko
6 siblings, 2 replies; 20+ messages in thread
From: Mirian Shilakadze @ 2026-11-16 10:45 UTC (permalink / raw)
To: khorenko, ptikhomirov; +Cc: devel
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.
Use ve_current_is_pseudosuper() instead. 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.
Feature: ve: CRIU support
https://virtuozzo.atlassian.net/browse/VSTOR-151265
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
fs/namespace.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index d622d9b72d32..20a03419bc0c 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -3230,7 +3230,7 @@ int ve_devmnt_process(struct ve_struct *ve, dev_t dev, void **data_pp, int remou
* we don't check for 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,8 +3367,16 @@ 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 ||
- ve_is_super(get_exec_env());
+ struct mm_struct *mm = current->mm;
+ /*
+ * A host task that joined @ve after it started, such as the CRIU
+ * helper that mounts proc for a nested pid namespace, is not a setup
+ * task but still skips the limit while @ve is pseudosuper.
+ */
+ bool host_entered = ve->is_pseudosuper && task_ve(current) == ve &&
+ mm && mm->vps_dumpable == VD_VE_ENTER_TASK;
+ int ret = ve_is_super(ve) || ve_current_is_pseudosuper(ve) ||
+ ve_is_super(get_exec_env()) || host_entered;
/* Ignore limits in ve0 and pseudosuper cases, but still count. */
if (ret)
atomic_dec(&ve->mnt_avail_nr);
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [Devel] [PATCH vz10 5/6] fs: give the mount relaxations of a pseudosuper VE only to setup tasks
2026-11-16 10:45 ` [Devel] [PATCH vz10 5/6] fs: give the mount relaxations of a pseudosuper VE " Mirian Shilakadze
@ 2026-11-16 10:56 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
1 sibling, 0 replies; 20+ messages in thread
From: no-reply @ 2026-11-16 10:56 UTC (permalink / raw)
To: Mirian Shilakadze, khorenko, ptikhomirov; +Cc: devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] fs: subject overstates setup-only scope; host_entered open-codes
pseudosuper test
--
commit 7f9d1b2c96b4b01e7ac65283588597610de48bff
Author: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
fs: give the mount relaxations of a pseudosuper VE only to setup tasks
This commit replaces the plain ve->is_pseudosuper checks in the device mount option filter and the VE mount limit with ve_current_is_pseudosuper(). It also adds a separate exemption in ve_try_reserve_mount() for host tasks that entered the VE after it started.
> diff --git a/fs/namespace.c b/fs/namespace.c
> index d622d9b72d32..20a03419bc0c 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
[ ... ]
> @@ -3367,8 +3367,16 @@ 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 ||
> - ve_is_super(get_exec_env());
> + struct mm_struct *mm = current->mm;
> + /*
> + * A host task that joined @ve after it started, such as the CRIU
> + * helper that mounts proc for a nested pid namespace, is not a setup
> + * task but still skips the limit while @ve is pseudosuper.
> + */
> + bool host_entered = ve->is_pseudosuper && task_ve(current) == ve &&
> + mm && mm->vps_dumpable == VD_VE_ENTER_TASK;
[Severity: Low]
This isn't a bug, but the subject says the relaxations go only to setup
tasks, while the mount limit now also exempts VD_VE_ENTER_TASK tasks. The
device mount option filter in ve_devmnt_process() and ve_devmnt_verify()
still uses only ve_current_is_pseudosuper(), so the two relaxations now
differ. Could the subject and opening paragraph say so?
host_entered also repeats the is_pseudosuper, task_ve(current) == ve, mm
and vps_dumpable tests from ve_current_is_pseudosuper() in
kernel/ve/ve.c, changing only the marker value. Would a named helper next
to ve_current_is_pseudosuper() be easier to keep in sync?
> + int ret = ve_is_super(ve) || ve_current_is_pseudosuper(ve) ||
> + ve_is_super(get_exec_env()) || host_entered;
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116104552.102938-1-mirian.shilakadze@virtuozzo.com?part=5
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [Devel] [PATCH vz10 5/6] fs: give the mount relaxations of a pseudosuper VE only to setup tasks
2026-11-16 10:45 ` [Devel] [PATCH vz10 5/6] fs: give the mount relaxations of a pseudosuper VE " Mirian Shilakadze
2026-11-16 10:56 ` no-reply
@ 2026-11-16 17:17 ` Konstantin Khorenko
1 sibling, 0 replies; 20+ messages in thread
From: Konstantin Khorenko @ 2026-11-16 17:17 UTC (permalink / raw)
To: Mirian Shilakadze; +Cc: devel
I won't apply this version, please send v2.
On Mon, 16 Nov 2026 14:45:48 +0400, Mirian Shilakadze wrote:
> + bool host_entered = ve->is_pseudosuper && task_ve(current) == ve &&
> + mm && mm->vps_dumpable == VD_VE_ENTER_TASK;
Item 5 of the cover letter reply: take Sashiko's two points (subject,
helper) and update the "In case of @is_pseudosuper set" comment in
ve_devmnt_process().
Why: the subject promises the relaxations go only to setup tasks,
while the mount limit also lets host-entered tasks through. The
helper keeps the two tests in one place. The comment still describes
the old check.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Devel] [PATCH vz10 6/6] ve: give the remaining pseudosuper relaxations only to setup tasks
2026-11-16 10:45 [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Mirian Shilakadze
` (4 preceding siblings ...)
2026-11-16 10:45 ` [Devel] [PATCH vz10 5/6] fs: give the mount relaxations of a pseudosuper VE " Mirian Shilakadze
@ 2026-11-16 10:45 ` Mirian Shilakadze
2026-11-16 10:56 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
2026-11-16 17:17 ` [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Konstantin Khorenko
6 siblings, 2 replies; 20+ messages in thread
From: Mirian Shilakadze @ 2026-11-16 10:45 UTC (permalink / raw)
To: khorenko, ptikhomirov; +Cc: devel
While a VE is pseudosuper, any task in it may set NETLINK_REPAIR, set
its CT fields with prctl, write ve.features, ve.failcount, ve.pid_max
and ve.aio_max_nr, and pass the legacy device cgroup check. That
includes the container's own binaries that vzctl and CRIU run.
Use ve_current_is_pseudosuper() for these as well.
Feature: ve: CRIU support
https://virtuozzo.atlassian.net/browse/VSTOR-151265
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
kernel/sys.c | 2 +-
kernel/ve/ve.c | 8 ++++----
net/netlink/af_netlink.c | 2 +-
security/device_cgroup.c | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index 80f8b9eb17c3..21650d331a42 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2324,7 +2324,7 @@ static int prctl_set_task_ct_fields(struct task_struct *t, unsigned long arg,
#ifdef CONFIG_VE
struct ve_struct *ve __free(put_ve) = get_task_ve(t);
- if (!ve_is_super(ve) && !ve->is_pseudosuper)
+ if (!ve_is_super(ve) && !ve_current_is_pseudosuper(ve))
return -EPERM;
#endif
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index f7f802dc7ffb..ebb52a1b678d 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1075,7 +1075,7 @@ static int ve_features_write(struct cgroup_subsys_state *css, struct cftype *cft
struct ve_struct *ve = css_to_ve(css);
if (!ve_is_super(get_exec_env()) &&
- !ve->is_pseudosuper)
+ !ve_current_is_pseudosuper(ve))
return -EPERM;
down_write(&ve->op_sem);
@@ -1128,7 +1128,7 @@ static ssize_t ve_failcount_write(struct kernfs_open_file *of, char *buf,
const struct ve_failcount_entry *entry;
atomic_t *fc;
- if (!ve_is_super(get_exec_env()) && !ve->is_pseudosuper)
+ if (!ve_is_super(get_exec_env()) && !ve_current_is_pseudosuper(ve))
return -EPERM;
for (entry = ve_failcounts; entry->name; entry++) {
@@ -1228,7 +1228,7 @@ static int ve_pid_max_write_running_u64(struct cgroup_subsys_state *css,
struct nsproxy *ve_nsproxy;
if (!ve_is_super(get_exec_env()) &&
- !ve->is_pseudosuper)
+ !ve_current_is_pseudosuper(ve))
return -EPERM;
rcu_read_lock();
@@ -1446,7 +1446,7 @@ static int ve_aio_max_nr_write(struct cgroup_subsys_state *css,
{
struct ve_struct *ve = css_to_ve(css);
- if (!ve_is_super(get_exec_env()) && !ve->is_pseudosuper)
+ if (!ve_is_super(get_exec_env()) && !ve_current_is_pseudosuper(ve))
return -EPERM;
down_write(&ve->op_sem);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index f686e6ea30ce..e808d8ae3e1e 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1695,7 +1695,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
#ifdef CONFIG_VE
{
struct ve_struct *ve = get_exec_env();
- if (!ve_is_super(ve) && !ve->is_pseudosuper)
+ if (!ve_is_super(ve) && !ve_current_is_pseudosuper(ve))
return -ENOPROTOOPT;
}
#endif
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 1629896b2ea1..fdeb136a3bec 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -931,7 +931,7 @@ static int devcgroup_legacy_check_permission(short type, u32 major, u32 minor,
if (!rc) {
struct ve_struct *ve = get_exec_env();
- if (!ve_is_super(ve) && ve->is_pseudosuper)
+ if (!ve_is_super(ve) && ve_current_is_pseudosuper(ve))
return 0;
return -EPERM;
}
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [Devel] [PATCH vz10 6/6] ve: give the remaining pseudosuper relaxations only to setup tasks
2026-11-16 10:45 ` [Devel] [PATCH vz10 6/6] ve: give the remaining pseudosuper relaxations " Mirian Shilakadze
@ 2026-11-16 10:56 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
1 sibling, 0 replies; 20+ messages in thread
From: no-reply @ 2026-11-16 10:56 UTC (permalink / raw)
To: Mirian Shilakadze, khorenko, ptikhomirov; +Cc: devel
> While a VE is pseudosuper, any task in it may set NETLINK_REPAIR, set
> its CT fields with prctl, write ve.features, ve.failcount, ve.pid_max
> and ve.aio_max_nr, and pass the legacy device cgroup check. That
> includes the container's own binaries that vzctl and CRIU run.
>
> Use ve_current_is_pseudosuper() for these as well.
>
> Feature: ve: CRIU support
> https://virtuozzo.atlassian.net/browse/VSTOR-151265
> Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116104552.102938-1-mirian.shilakadze@virtuozzo.com?part=6
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Devel] [PATCH vz10 6/6] ve: give the remaining pseudosuper relaxations only to setup tasks
2026-11-16 10:45 ` [Devel] [PATCH vz10 6/6] ve: give the remaining pseudosuper relaxations " Mirian Shilakadze
2026-11-16 10:56 ` no-reply
@ 2026-11-16 17:17 ` Konstantin Khorenko
1 sibling, 0 replies; 20+ messages in thread
From: Konstantin Khorenko @ 2026-11-16 17:17 UTC (permalink / raw)
To: Mirian Shilakadze; +Cc: devel
I won't apply this version, please send v2.
On Mon, 16 Nov 2026 14:45:49 +0400, Mirian Shilakadze wrote:
> Use ve_current_is_pseudosuper() for these as well.
Item 6 of the cover letter reply: update the comment above the check
in devcgroup_legacy_check_permission().
Why: it still says everything is allowed in pseudosuper state.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE
2026-11-16 10:45 [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Mirian Shilakadze
` (5 preceding siblings ...)
2026-11-16 10:45 ` [Devel] [PATCH vz10 6/6] ve: give the remaining pseudosuper relaxations " Mirian Shilakadze
@ 2026-11-16 17:17 ` Konstantin Khorenko
2026-11-17 10:21 ` Mirian Shilakadze
6 siblings, 1 reply; 20+ messages in thread
From: Konstantin Khorenko @ 2026-11-16 17:17 UTC (permalink / raw)
To: Mirian Shilakadze; +Cc: devel
I won't apply this version, please send v2 with the changes below.
On Mon, 16 Nov 2026 14:45:43 +0400, Mirian Shilakadze wrote:
> Mirian Shilakadze (6):
> ve: tell ve_setup_task() which VE the task comes from
> ve: hide only the tasks the host sends into a VE
> ve: hide the tasks that set up a starting VE from the rest of it
> cgroup: give the CT root file writes and hidden roots only to setup
> tasks
> fs: give the mount relaxations of a pseudosuper VE only to setup tasks
> ve: give the remaining pseudosuper relaxations only to setup tasks
The design holds: the setup mark reaches only what vzctl and CRIU run
before an exec, every way into another task's fds goes through
task_still_dumpable(), and no ve0 caller loses a relaxation. What to
change for v2:
1. Patch 2 (and 3), code: a host task that moves from a starting VE
straight into a running one keeps VD_VE_SETUP_TASK and is visible
there. Keep it hidden, as it was before the series. Do not key
this on the mm mark alone: CRIU-restored processes keep
VD_VE_SETUP_TASK for life.
2. Patch 2, commit message: say why a container task must not get
VD_VE_ENTER_TASK, and that a task entering its nested VE is no
longer hidden there.
3. Patch 3, comments: the VD_VE_SETUP_TASK comment in mm_types.h says
setup tasks are the only ones with the pseudosuper relaxations,
which patch 5 makes untrue; the ve_current_is_pseudosuper()
kernel-doc leaves out that it is true for ve0.
4. Patch 4, comment: the comment above ve_pseudosuper_write() still
says dropping pseudosuper is allowed from any context.
5. Patch 5: do what Sashiko asked (the subject says "only to setup
tasks" while the mount limit also lets VD_VE_ENTER_TASK through;
a helper next to ve_current_is_pseudosuper() instead of the
open-coded host_entered), and update the "In case of
@is_pseudosuper set" comment in ve_devmnt_process().
6. Patch 6, comment: devcgroup_legacy_check_permission() still says
everything is allowed in pseudosuper state.
7. Cover letter: "vzctl and CRIU need no change, the vzctl start path
was already fixed under VSTOR-151174" is two sentences glued with a
comma, and the series also works with older libvzctl. Say what
VSTOR-151174 changed or drop the clause. Put blank lines around the
"- 1/6" list.
Details are in the replies to the patches.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE
2026-11-16 17:17 ` [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Konstantin Khorenko
@ 2026-11-17 10:21 ` Mirian Shilakadze
0 siblings, 0 replies; 20+ messages in thread
From: Mirian Shilakadze @ 2026-11-17 10:21 UTC (permalink / raw)
To: Konstantin Khorenko; +Cc: devel
On 11/16/26 9:17 PM, Konstantin Khorenko wrote:
>
> 1. Patch 2 (and 3), code: a host task that moves from a starting VE
> straight into a running one keeps VD_VE_SETUP_TASK and is visible
> there. Keep it hidden, as it was before the series. Do not key
> this on the mm mark alone: CRIU-restored processes keep
> VD_VE_SETUP_TASK for life.
>
> 2. Patch 2, commit message: say why a container task must not get
> VD_VE_ENTER_TASK, and that a task entering its nested VE is no
> longer hidden there.
>
> 3. Patch 3, comments: the VD_VE_SETUP_TASK comment in mm_types.h says
> setup tasks are the only ones with the pseudosuper relaxations,
> which patch 5 makes untrue; the ve_current_is_pseudosuper()
> kernel-doc leaves out that it is true for ve0.
>
> 4. Patch 4, comment: the comment above ve_pseudosuper_write() still
> says dropping pseudosuper is allowed from any context.
>
> 5. Patch 5: do what Sashiko asked (the subject says "only to setup
> tasks" while the mount limit also lets VD_VE_ENTER_TASK through;
> a helper next to ve_current_is_pseudosuper() instead of the
> open-coded host_entered), and update the "In case of
> @is_pseudosuper set" comment in ve_devmnt_process().
>
> 6. Patch 6, comment: devcgroup_legacy_check_permission() still says
> everything is allowed in pseudosuper state.
>
> 7. Cover letter: "vzctl and CRIU need no change, the vzctl start path
> was already fixed under VSTOR-151174" is two sentences glued with a
> comma, and the series also works with older libvzctl. Say what
> VSTOR-151174 changed or drop the clause. Put blank lines around the
> "- 1/6" list.
Thanks, all seven are fixed in v2, on hci-8.2.
For item 1, a setup task that leaves a VE while it is still pseudosuper
now counts as sent by the host, so a host task moving from a starting VE
into a running one is hidden there again. A restored process does not
count, as its VE is no longer pseudosuper by then.
I also fixed two more things I found while reworking it: ve_setup_task()
now runs before the old VE namespace is put, since that may drop the
last reference to it, and a task that setns()es into its own VE keeps
its mark.
--
Best regards, Mirian Shilakadze
Linux C Virtualization Developer, Virtuozzo.
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 20+ messages in thread