From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.2 v4 0/3] ve: Container start on the 26.3 kernel with libvzctl before 10.0.144
Date: Fri, 20 Nov 2026 17:34:48 +0100 [thread overview]
Message-ID: <20261120-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v4-0-ac581cf6e36d@virtuozzo.com> (raw)
The VSTOR-151265 series (26.3) hides the setup tasks of a VE from every
task of it but each other while the VE is pseudosuper, and gives the
pseudosuper relaxations to the setup tasks alone. A host task is a
setup task only if it entered while the VE was VE_STATE_STARTING; one
entering a running VE is an entered task, hidden from the container,
with the mount limit as its only relaxation.
libvzctl before 10.0.144 starts a Container like this: pseudosuper=1,
clone the init, the init writes START (the VE is RUNNING from here on),
then a helper joins the init's namespaces one by one through setns(),
opens /proc/<init>/ns/mnt, makes the ploop device nodes and mounts the
second disk inside the container. The helper is an entered task, so the
first step is refused:
Failed to open /proc/<pid>/ns/mnt: Permission denied
Failed to configure disk
Cancel init execution
Every Container start fails with libvzctl before 10.0.144, as in the
hci-8.1.0 builds before 2026-10-22 (10.0.134 in hci-8.1.0-135). libvzctl
10.0.144 (vzctl commit 8bf40747, VSTOR-151174) opens every namespace fd
before it joins the first, while the helper is still a ve0 task, and the
start works. The current hci-8.1.0 builds ship 10.0.159 and hci-8.2
ships 10.1.3 together with the 26.3 kernel, which is why the kernel CI
starts Containers on 26.3.
Patch 1 trusts every task that came from the host and has not exec'd
while the VE is pseudosuper, whichever side of START it entered on.
Patch 2 takes the ve0 case out of ve_current_is_pseudosuper(): asked
about ve0 it answers whether current is a ve0 task, so a caller that
passes ve0 in for a container task grants nothing. The one caller that
does so is the mount reservation, where ve0's INT_MAX limit grants the
mount as before.
Patch 3 is the selftest for the old start sequence: it starts a real VE
(pseudosuper, clone3 into new pid, cgroup, net and mnt namespaces,
START) and checks that a host task joining afterwards reaches the
init's namespaces and an exec'd binary does not.
Verified on a test VM with the Containers there:
+----------------------------+-------------------+-----------------+
| kernel | libvzctl 10.0.134 | libvzctl 10.1.3 |
+----------------------------+-------------------+-----------------+
| 26.3 as is | no CT starts | all start |
| 26.3 + patch 1 | all start | all start |
| 26.3 + patches 1 and 2 | all start | all start |
| RHEL 10.3 rebase as is | no CT starts | not run |
+----------------------------+-------------------+-----------------+
Patch 3 fails on 26.3 as is and passes with patches 1 and 2.
Changes in v4:
- New patch 2 takes the ve0 case out of ve_current_is_pseudosuper():
asked about ve0 it answers whether current is a ve0 task (Pasha).
Patch 1 unchanged, Mirian's Reviewed-by kept; the selftest is now
patch 3.
- Patch 3: the loop holding the init until the test releases it is a
regular braced loop, no hanging ";" (Pasha).
- Patch 3: the stop poll sleeps its 10 ms in full, nanosleep with the
remaining time after a signal, so an interrupted sleep no longer
shortens the wait for ve.state to leave RUNNING (Pasha).
- Link to v3: http://lore.virtuozzo.com/20261120-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v3-0-fb0214ce4f45@virtuozzo.com
Changes in v3:
- Rebased onto the current 26.x tip: patch 2 opens the host cgroup2
mount with open_cg2_fd() as the other ve tests do since 26182b5f9943
(Mirian).
- Patch 2: the init dying before it reports and ve.state not RUNNING
after START set errno, so the setup diagnostic no longer shows a
stale one; the cgroup2 fd is closed when the ve controller cannot be
enabled (Sashiko).
- Patch 1: Mirian's Reviewed-by, no other change.
- Link to v2: http://lore.virtuozzo.com/20261120-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v2-0-c85e827c1dba@virtuozzo.com
Changes in v2:
- Patch 1 replaced. The RFC made a host task entering a pseudosuper VE
a setup task whatever ve.state says, and such a helper, if it stays
without exec, becomes an ordinary visible task once pseudosuper is
cleared. Now, Pasha's variant: ve_current_is_pseudosuper() accepts
the entered mark too and ve_current_is_host_task() goes. An entered
task stays hidden after the clear, as before.
- Mirian's one-line alternative, relaxing only the ptrace check, would
do for the start: the disk setup that follows it runs as an entered
task with libvzctl 10.1.3 as well, and passes. Not taken because old
libvzctl runs more in-process helpers inside the VE after START
(devices, bind mounts, GPUs) that had every relaxation before 26.3,
and one predicate is easier to reason about than two.
- Patch 1 verified with the old hci-8.1.0 userspace (libvzctl 10.0.134,
ploop 10.0.47) and with 10.1.3 on the 26.3 kernel: all Containers start.
- No RFC: the two options were discussed, this is the one to apply.
- Patch 2: message and file header reworded for the new rule, the fds
leaked on the setup failure paths closed (Sashiko).
- Link to v1: http://lore.virtuozzo.com/20261119-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v1-0-06fa0b8994a8@virtuozzo.com
https://virtuozzo.atlassian.net/browse/VSTOR-156164
To: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
To: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Assisted-by: LLM
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
Konstantin Khorenko (3):
ve: trust every host task of a pseudosuper VE until it execs
ve: give the pseudosuper relaxations of ve0 to its own tasks only
selftests/ve: check a host task entering a pseudosuper VE reaches its init
fs/namespace.c | 4 +-
include/linux/mm_types.h | 4 +-
include/linux/ve.h | 2 -
kernel/ptrace.c | 2 +-
kernel/ve/ve.c | 44 +---
security/device_cgroup.c | 2 +-
tools/testing/selftests/ve/.gitignore | 1 +
tools/testing/selftests/ve/Makefile | 1 +
tools/testing/selftests/ve/ve_setup_task_test.c | 318 ++++++++++++++++++++++++
9 files changed, 339 insertions(+), 39 deletions(-)
---
base-commit: fa6cf94f94fa67a00a2ba1cab07ab3a7b93c9593
change-id: 20261119-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-e11df3a8c1ba
Best regards,
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next reply other threads:[~2026-11-20 16:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 16:34 Konstantin Khorenko [this message]
2026-11-20 16:34 ` [Devel] [PATCH hci-8.2 v4 1/3] ve: trust every host task of a pseudosuper VE until it execs Konstantin Khorenko
2026-11-20 16:34 ` [Devel] [PATCH hci-8.2 v4 2/3] ve: give the pseudosuper relaxations of ve0 to its own tasks only Konstantin Khorenko
2026-11-23 9:19 ` Pavel Tikhomirov
2026-11-24 10:02 ` Mirian Shilakadze
2026-11-20 16:34 ` [Devel] [PATCH hci-8.2 v4 3/3] selftests/ve: check a host task entering a pseudosuper VE reaches its init 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=20261120-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v4-0-ac581cf6e36d@virtuozzo.com \
--to=khorenko@virtuozzo.com \
--cc=devel@openvz.org \
--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 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.