From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 0830280027 for ; Fri, 20 Nov 2026 16:36:15 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AKGZ1EJ006799; Fri, 20 Nov 2026 19:35:02 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AKGZ1EJ006799 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="eBCnyCLV" Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AKGYs6B006761 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Fri, 20 Nov 2026 19:34:54 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AKGYs6B006761 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-c50657eaef0so99322166b.3 for ; Fri, 20 Nov 2026 08:34:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErENTUE90SDPuksoBBPNvjg4IEdu4Al1VcWFLy77Ku7bW+ifN9aDzO1MhuVUKQpHfgeqVaSrUA==@openvz.org X-Gm-Message-State: APuU4Z8hlVrKVL6MBIkMCmoyujdNuQjN4JGV6JJitx4wliHaZ6+Nve46 sYmBswhUSd/fbaNlbxVb5Fp8cL8Dd656+dHq2bKzx5CAEf449e3KMJ+H5aJMIFsNS9AHFhMkMpz rZtkj/xPP4UPKpo346tVoLk427yaQpT5tUBm2ZkC2NOQcJieLn6iS1A== X-Gm-Gg: AZFdTZdJFH2LXd3uK37GsQ24dbrg7chp9x7R5/gc9JhFHDoLw4LvQ6HpvmO0jEzK8uk xBpMtqEM6ewQzZHmSlND7UMZMlQRwoH0NFZE+z/KbD16rekWQ26At5jflFPTYmMZAiq4p5gdiim haJItWwpJLoNs/Sz3EmhaMdXF10VFC79itkhU/hNmahyQNLPUX/1nEg5v8c2Rz6pdngO5wK60qV ojcTYK7WNMtZ+hg0R55Sgm2jQ5NKewOwjww76Cvx7cXhuhF3PmBOLyYyAruS1WkIX5D+K2P1Y61 e5RKkekBLhLJUA7+2aqBhMzbqee3xN6rzg8o8typuB7q8not2sj+6ilp6CrXTjlTPaYKyWQvxRH vQzBgBWFo9X+1LY3H X-Received: by 2002:a17:906:fa82:b0:c50:4b6e:329 with SMTP id a640c23a62f3a-c513a5eaea2mr289389366b.15.1795192494170; Fri, 20 Nov 2026 08:34:54 -0800 (PST) X-Received: by 2002:a17:906:fa82:b0:c50:4b6e:329 with SMTP id a640c23a62f3a-c513a5eaea2mr289386566b.15.1795192493504; Fri, 20 Nov 2026 08:34:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795192493; cv=none; d=google.com; s=arc-20260327; b=RCU73mYs9px92X4g9j9BiD6vs8ZfCNjkIzwE1MSbwSDmM9VhMqXYeosvYVHAIJPJsX Crr601wP3ePZcu9KA2tHlld8E3tL5tlKjwoVhyswvI9pNnpjyqpw+GquE43J6EJ1EFo5 ZHSPImXdHlCzDkVSzWCoSOJhvFh5jJ/BzeqDJ8Bq6z6NDh4VwLRJoRZD0LoQEHiPQgLW TsWuHRQP+R5RT4gKAdUcYJBnZtQFjEneXQxxfzAY/Wm8eetf8gCY4JOPKatfTCI6KJzH hYG2Utmt6lRGG/H/afYOHW96C7JKBPcI+wKkarBdb3A+xANcjNaiS9+FDT8qBYSTpF8G 4WKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:dkim-signature; bh=bQb+wwyY/9H83NruE/JK+tdV/cRwcrKv2/rYP9LwSzU=; fh=xqcbrIOv/j1NC9DwWL7cs9wu5dYsNcrfZRJG6Y55lVA=; b=hCcMzRFaKTL36QYvdISLPqFFDyxB+Qu3U8iiExeRkN8/1QWylNrRUL06hbLsfwz+2A dEZxmI47OUKeLUwX729/MpsGuqFrPr7YfLApjtyBQv+csp9JMVlTrZAeLOSTuBpmvWkv 6O66ZU1CWlQQ1Xab1sa9cBmopliqfFUlskbYjChfSvaspN2jPJoQ9PusOrVGZLv0BSgi g+axoYUvHPx8sEzQErKKp78PdB4XcCP6apYfMqC7JcOrOf2PNdZkKVJ1TPwrcn6mBRx0 QpMZiCIF88J2qGoOV8RpqMIpW4gFQ7tKdLHZbQJzUK+SLBnWMEk+F8KOLmypdwYPJQmh iapw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=eBCnyCLV; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id a640c23a62f3a-c513afe3aecsi234380666b.76.2026.11.20.08.34.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 08:34:53 -0800 (PST) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=eBCnyCLV; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Content-Type:MIME-Version:Message-Id:Date:Subject :From; bh=bQb+wwyY/9H83NruE/JK+tdV/cRwcrKv2/rYP9LwSzU=; b=eBCnyCLV2OjeiGSoDIZ BozoTWjJSmtOGn9/f2MiPspX7QqJDuanToJK2dy6woWX/vbzMPt3XzsValPrq/q+/MpHIdwTvSwBR ytFmZ7TARgZMfla7J9zlKLW1/jxbuDQ25kZZprdVVwaUpz0iLzFicC2QqAtd3PD0pz9epe363X5+i rsdQbKaaILjXR52+xpRgmuZBKlkep3uiea6x2++yMb9X5n992N2jYWvo1PCoin3HJCRXxm7jBIU3y AY0+IpDDVxU+ZVWslBwcEPVvYMqfImYwj5ax9UidfEbUmJMuWAEf8fIuOqCiW5imlO1cmc8zn8LLl IiXQLotzuiXMdag==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xURZY-00AYn4-2r; Fri, 20 Nov 2026 17:34:48 +0100 From: Konstantin Khorenko Date: Fri, 20 Nov 2026 17:34:48 +0100 Message-Id: <20261120-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v4-0-ac581cf6e36d@virtuozzo.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAKh2AGsC/63PwU6EMBAG4FfZ9OzUTiksePI9jIe2DEslUtJCs 7Lh3S3sxRhP6nFmmv/rf2ORgqPInk43Fii56PyYB/VwYrbX44XAtXlmUsgKERswCqZAEwy9DzQ OHlKcfQAsK6wUJIJI8zLBrOMAU6Sl9XGZKAAhtl2ha4tGs5yeQzp3PeQX1lsHNZfs9X6Ii3kjO +/u/tToSGCCHm2/r3xwFzc+3hcQehRQcZRcgETk55IjlxW/8rTmi0/rHtG7/ZcfR82Eh/nnRgl BgKg6LUzdNErXz8mFefHr6rn170eZJL9YUvzektmydUm1PFtsjf7JKv7JKrLVGSFRWVKdKr9b2 7Z9AlD/+f04AgAA X-Change-ID: 20261119-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-e11df3a8c1ba To: Mirian Shilakadze , Pavel Tikhomirov X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6686; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=Iq4yYWbP7iaLEVxJ+oRGcXT5csbQtOyl8V67we+0T/I=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBrAHar93lCDa0QCwxySnZzIVcRkDIkiUNmUBIVt TBazpYIPpiJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCawB2qwAKCRBRlgpH+WFc KlNzD/9pU1RnvCa2aWrRPwaiMxDzON0AxUEOwGxRzrRc3EZY9/22FF3YWRRcaZy9POiOFjj8qPk OZyOnTO0V9frXBj6pcBy/YWILVavbYbQFqxejDLxEP8WJ94sfPSu3st2zSMvbqIoXI6FvJvFjxo wZYS3UWTMyaaaR2J47D9NK1f4LMDnoWi96wTLqmQ8WztegbGJSQvhJkwKpKeteBr/Cb/u/sD1mU 6Hi/hkYbW7h6fncGBLNjo94G85UWA5qnvmEn2g1bIVpMN+wVqVsYiOn8nvcWzGL4KjLaaVcL7ZN sqrO0YhHtsC12ttlT+UF9d4/ePMok/YLhve+/D+GzqfAiu/3ZZIkSBt5BYC+gP7CU4BqyvLlc31 gUnKRQVyS9Lh3b3WTNBWnmwji44lUst5b8SvKfCauTYtJGAxQb309ZvboZ8RY7zGYZQBkm+E69i BcL6edNfNxbp+DhBdjvpxbRrypdp1XtY58TRigGfSZKI5H8U4nj+RiiDWGNKvQFcwgbiH/LSiyl 8ZRZW1w54AXHJRlk5xzVxbFH0p1OCBF4WRbqMSP0vRD1H1wZVBXFwUeAzCKk1epU76S/hafCl9I 20lEoB8Mo2B9O2HsWegs8Py4UxC7Ag89Rpfx0FgtKNkELGs2Yxn304YvoiWARpk5hSHwYPtPmWu 0kEliD5OTc/e80g== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true 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 X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org 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//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//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 To: Pavel Tikhomirov Assisted-by: LLM Signed-off-by: Konstantin Khorenko --- 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