[Devel] [PATCH RFC hci-8.2 1/2] ve: mark a host task entering a pseudosuper VE as a setup task
no-reply at sashiko.virtuozzo.com
no-reply at sashiko.virtuozzo.com
Fri Nov 20 00:56:08 MSK 2026
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] ve: stale ENTER_TASK docs/branch after ve_setup_task() marks
pseudosuper entrants SETUP
- [Low] ve: host tasks entering a pseudosuper VE lose ptrace hiding once
pseudosuper clears
--
commit 7c48a2417efa8cba2799a83bd32623176d1b8aec
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
ve: mark a host task entering a pseudosuper VE as a setup task
ve_setup_task() now marks a host task entering a VE as VD_VE_SETUP_TASK while the VE is pseudosuper, not only while it is VE_STATE_STARTING. This lets the libvzctl helper that setns()es into an already running VE still reach the init task during disk setup.
> diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
> --- a/kernel/ve/ve.c
> +++ b/kernel/ve/ve.c
> @@ -1899,18 +1899,19 @@ void ve_setup_task(struct task_struct *task, struct ve_struct *old_ve,
> return;
>
> /*
> - * 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. A setup
> - * task leaving a VE that is still pseudosuper was sent by the host
> - * too. The mark goes to the mm, which may be shared, so a task coming
> - * from a container never gets either. A setup task leaving a VE that
> - * is not pseudosuper drops the mark: after pseudosuper is cleared it
> - * cannot be told from the restored processes.
> + * A task the host sends into a VE (from ve0, or a setup task of a
> + * VE still pseudosuper) becomes a setup task if the VE starts or
> + * stays pseudosuper, else one hidden from the VE's tasks.
> + *
> + * The mark lives in the mm, which may be shared, so a task from a
> + * container keeps its mark, except a setup mark of a VE that left
> + * pseudosuper: it is an ordinary task now.
> */
> if (mm && old_ve != ve) {
> if (ve_is_super(old_ve) ||
> ve_vps_dumpable(mm, old_ve) == VD_VE_SETUP_TASK)
> - mm->vps_dumpable = ve->state == VE_STATE_STARTING ?
> + mm->vps_dumpable = ve->state == VE_STATE_STARTING ||
> + ve->is_pseudosuper ?
> VD_VE_SETUP_TASK : VD_VE_ENTER_TASK;
> else if (mm->vps_dumpable == VD_VE_SETUP_TASK)
> mm->vps_dumpable = VD_PTRACE_COREDUMP;
[Severity: Low]
Is the VD_VE_ENTER_TASK arm of ve_current_is_host_task() still reachable
after this change?
ve_current_has_mark(ve, VD_VE_ENTER_TASK) requires ve->is_pseudosuper,
but ve_setup_task() now gives a host entrant VD_VE_ENTER_TASK only when
the VE is neither starting nor pseudosuper. If pseudosuper cannot be set
on a running VE (ve_pseudosuper_write() returning -EBUSY), that arm can
no longer match in normal operation.
The kerneldoc of ve_current_is_host_task() still describes a host task
that joined the VE after it started, such as the CRIU helper, as a case
separate from a setup task. The VD_VE_SETUP_TASK comment in
include/linux/mm_types.h still says "tasks the host sent into a starting
VE". Could both comments be updated, the dead arm removed or justified,
and the changelog say that CRIU-style helpers joining a running
pseudosuper VE now pass the stricter ve_current_is_pseudosuper() checks
and not only the weaker host-task check?
[Severity: Low]
This problem is only partly about the libvzctl helper: the mark is now
applied to every host task entering a pseudosuper VE, whatever its
ve->state. Once pseudosuper is cleared, ve_vps_dumpable() reports a
VD_VE_SETUP_TASK mm as VD_PTRACE_COREDUMP. Before this patch such a task
stayed VD_VE_ENTER_TASK, which ptrace denies and proc_exe_link() refuses.
Can a host task that setns()es into the VE in that window, and stays
alive without exec, then be ptraced by container tasks and have its
/proc/<pid>/exe read after pseudosuper clears? The libvzctl helper is not
affected because exec drops the mark, but the commit message and the code
comment only mention the exec case.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply at sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261119-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v1-0-06fa0b8994a8@virtuozzo.com?part=1
More information about the Devel
mailing list