OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH RFC hci-8.2 0/2] ve: Container start on the 26.3 kernel with libvzctl before 10.0.144
@ 2026-11-19 21:49 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:49 ` [Devel] [PATCH RFC hci-8.2 2/2] selftests/ve: check a host task entering a pseudosuper VE reaches its init Konstantin Khorenko
  0 siblings, 2 replies; 5+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 21:49 UTC (permalink / raw)
  To: Mirian Shilakadze, Pavel Tikhomirov; +Cc: devel

The VSTOR-151265 series (26.3) hides the setup tasks of a VE from every
other task of it while the VE is pseudosuper. ve_setup_task() marks a
host task a setup task only while the VE is VE_STATE_STARTING; a host
task entering afterwards is a VD_VE_ENTER_TASK and does not see them.

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()
and only then opens /proc/<init>/ns/mnt. The open comes from an ENTER
task of a pseudosuper VE, so it is refused:

  Failed to open /proc/<pid>/ns/mnt: Permission denied
  Failed to configure disk
  Cancel init execution

Every Container start fails on the hci-8.1 userspace (libvzctl 10.0.134
and older). 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; hci-8.2 ships 10.1.3 together
with the 26.3 kernel.

Verified on a test VM with the six 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         | not run         |
  | RHEL 10.3 rebase as is     | no CT starts      | not run         |
  | RHEL 10.3 rebase + patch 1 | all start         | not run         |
  +----------------------------+-------------------+-----------------+

So the 26.3 kernel depends on a libvzctl version and does not say so:
no commit of the series, its Jira or kernel.spec names libvzctl >=
10.0.144, and no vz kernel spec ever carried a Conflicts: on vzctl or
libvzctl. A node that gets the kernel, or a ReadyKernel patch with the
series, without the libvzctl update loses every Container start.

Two ways out, hence the RFC:

1. Apply patch 1. A host task that enters a VE while it is still
   pseudosuper becomes a setup task whatever ve.state says, so the old
   start sequence works again. The price: such a helper, if it stays in
   the VE without exec, turns into an ordinary task once pseudosuper is
   cleared (VD_VE_SETUP_TASK counts as VD_PTRACE_COREDUMP then), so the
   container can reach its host fds, while as an ENTER task it stays
   hidden for good. Mirian's view: the kernel is right, userspace must
   be 10.0.144 or newer.

2. Drop patch 1 and declare the dependency instead: Conflicts:
   libvzctl < 10.0.144 in kernel.spec, a release note, or both. Patch 2
   is then wrong as it stands and can be turned round to check the
   series' contract: a host task joining a running pseudosuper VE does
   not reach the init, namespace fds opened before joining work, an
   exec'd binary does not reach it.

Patch 2 is the selftest for the start sequence of libvzctl before
10.0.144: 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.
It fails on 26.3 as is and passes with patch 1.

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 (2):
      ve: mark a host task entering a pseudosuper VE as a setup task
      selftests/ve: check a host task entering a pseudosuper VE reaches its init

 kernel/ve/ve.c                                  |  17 +-
 tools/testing/selftests/ve/.gitignore           |   1 +
 tools/testing/selftests/ve/Makefile             |   1 +
 tools/testing/selftests/ve/ve_setup_task_test.c | 284 ++++++++++++++++++++++++
 4 files changed, 295 insertions(+), 8 deletions(-)
---
base-commit: c1acd2c05aa3ebe0313958e2bd09f60f2040a5cb
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-19 21:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox