From: no-reply@sashiko.virtuozzo.com
To: Konstantin Khorenko <khorenko@virtuozzo.com>,
Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH RFC hci-8.2 1/2] ve: mark a host task entering a pseudosuper VE as a setup task
Date: Thu, 19 Nov 2026 21:56:08 +0000 [thread overview]
Message-ID: <010701a1f5cf55ce-3b876317-ca8f-4af0-b8bc-3324d7779446-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261119-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v1-1-06fa0b8994a8@virtuozzo.com>
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@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@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
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-19 21:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 21:49 [Devel] [PATCH RFC hci-8.2 0/2] ve: Container start on the 26.3 kernel with libvzctl before 10.0.144 Konstantin Khorenko
2026-11-19 21:49 ` [Devel] [PATCH RFC hci-8.2 1/2] ve: mark a host task entering a pseudosuper VE as a setup task Konstantin Khorenko
2026-11-19 21:56 ` no-reply [this message]
2026-11-19 21:49 ` [Devel] [PATCH RFC hci-8.2 2/2] selftests/ve: check a host task entering a pseudosuper VE reaches its init Konstantin Khorenko
2026-11-19 21:54 ` no-reply
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=010701a1f5cf55ce-3b876317-ca8f-4af0-b8bc-3324d7779446-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=mirian.shilakadze@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