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 0E6D78002A for ; Fri, 20 Nov 2026 14:26:36 +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 6AKEPINv026217; Fri, 20 Nov 2026 17:25:19 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AKEPINv026217 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="n+NMnQSZ" Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AKEPDg4026196 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Fri, 20 Nov 2026 17:25:13 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AKEPDg4026196 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-c506f007ae2so105333066b.1 for ; Fri, 20 Nov 2026 06:25:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEbHpWBhKVUv8RU8Z47RkreCU/5ixoTodwNl9kWsPJCXidJdYoWhkXmzXrwndJmymyMrakvGw==@openvz.org X-Gm-Message-State: APuU4Z/cBIjE0s+vZSsJXGxc0UBllU0vGiEnNAppM128zce+0YC2Ah9/ dH+xhmQVbqdS01IYjb2+gpdqoyfol0eicAvBIqPSLu/jYT6te2rD4phMhwVI+vOGi5GU+pXBJ2C WkUA3WO9kIB2CdqgnnDhTS8vBVYhFiSosWsv3SiU5zemYBVU7dzcYUw== X-Gm-Gg: AYBFou3pTPF6p6R+SzwZyyPofrc2D8FlLAjZ0SIwvDDainVch9tnHQDYQkbxu/GcBO6 JbKV0Dl6JB7TbFziT+NtuwLNNRHEE3PjDl6AnfjHNyuobZoLkPXq5RlTY1LUfm7fCNlR0Nr1Bo5 cWwbYeS2tcbF/Z79B3IwpT7hiv0X7fw/k7jyj2e1TjA9YA14abkoWVuCw/VH95d7SiAaPoCB57Q +1G/Mf5cIbSExHfgn8I1yAHgHdOKUKL8tq50K/s5G2QKypU8Cy/+h64K5NsruZl1RyvsRdD7pC7 vGm9dHMX/leWQLpZ1JVHQMuIHF5evcy8JTkrFiWsVMWXtwB4+9pHZEfhdCPmnAgD5yJf3p2aWuE o8j3YLyIqc8hy9VURjQ== X-Received: by 2002:a17:906:9555:b0:c50:52b5:e17 with SMTP id a640c23a62f3a-c513a5e1d53mr254398166b.13.1795184712967; Fri, 20 Nov 2026 06:25:12 -0800 (PST) X-Received: by 2002:a17:906:9555:b0:c50:52b5:e17 with SMTP id a640c23a62f3a-c513a5e1d53mr254395866b.13.1795184712349; Fri, 20 Nov 2026 06:25:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795184712; cv=none; d=google.com; s=arc-20260327; b=KEm3V9aQOU5xcXfTHpJIWg3X8RMFMup2hQelQnE1GYxwYDXwGOr4bOxCFi2Z0Jx1UM o6TrbP5FJS5UTRW+dOVjDxKzo1ZVmNDqtqwOSbScNjVJETg0QTbn5/SHWt8JJnYzil4f yfdodWMU2kNmUcxsq2udmUUCqYa31EqeRl/oPAxEVOJc3qDQhJ0q6wWFCNGx1s6vRSd6 haP+caHgfeu69fOqtQrK01/hHJGkm9hxd5DxHuy78meUYwsu06svxzz6nXsd0vwukJSG KqQQ0Y9ER/oRl0cTd1jW+SobbSv0fW1Q/d2SqANUpXXRh4W4ifkXA3seVr0EHCHNmubx KOUw== 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=YCrzP1WLmEJ4E28kuUjxjkUWCTq+4ZgAplGHYkT5lm4=; fh=xqcbrIOv/j1NC9DwWL7cs9wu5dYsNcrfZRJG6Y55lVA=; b=qOSKY1FZV9SmMp6YwXaJUP03BloWYQluvEVmORV+o5UQkD6okIvyg/PttDBBk8G8vZ 1AR82k1fXYdGaAabzexvre80uTYZer0ZHzbZs8ONdaVsf9O8+ORtliiqo/D3jX0XFh9T Aag2v/LX4YsdnbAKJFqr01v6xEfwTnhfV2rBbyXtWP+qNilgRPSLhUropp11IJy+mvMO Bft4ElsU1W0YkD4/DXWCmyxXNaB/ZFI212fMxYWi7iBcEmU0Qll7VVrVIzTGgkxCInEc OkypN70QIUFRoPTaGGD0MZLQC76eNFnc7JXVwYGL4MevgVhBhgmb/WRMX/WJ4tTjhX6P pcbQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=n+NMnQSZ; 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-c513b0db3a0si209847966b.367.2026.11.20.06.25.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 06:25:12 -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=n+NMnQSZ; 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=YCrzP1WLmEJ4E28kuUjxjkUWCTq+4ZgAplGHYkT5lm4=; b=n+NMnQSZN8f6PTbPpgf LH5Yi9AJD2RpfdO5tRu1VKfHKi/NFzQNhznfMhUjkb5rzLAy/hR6bUcUPoWEN8m48hKL6E7JkQHT6 O2VCYJgugsyD82m0SXfemkhzDkOolaSIv3sLxyicgo0xwJ+G5hX3odEHctsEuzyU0vC1u0lN+Pmhg WdBubE2vLsm3tJZ426Ea/sDn8QxOzGD9xyhI8tDluS91nVdhoGDXlhB7drojFtZHGuxF4IxXIAyz1 4FttqkUea8SK+5YPmacmJfMo9SGaHjDlPBMAtFkNO5mJOwWMRR2+XOPozMS3bClnnVrScsL5cwzD8 1l/sazBqVgDmFtA==; 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 1xUPY3-0085mG-3C; Fri, 20 Nov 2026 15:25:08 +0100 From: Konstantin Khorenko Date: Fri, 20 Nov 2026 15:25:08 +0100 Message-Id: <20261120-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v3-0-fb0214ce4f45@virtuozzo.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAERYAGsC/6WPwW7DIBBEfyXi3KUssYndU/+j6gHwOlCrxgIbp Y7878XOpeqxPc7Mat7OnSWKnhJ7Od1ZpOyTD2MR56cTs06PVwLfFc2kkAoRWzAVTJEmGFyINA4 BcppDBKwVqgoyQaJ5mWDWaYAp0dKFtEwUgRC7/qwbi0az0l5Ken87yG/MWQ8Nl+z9EaTFfJCdd +5+anQiMFGP1u1WiP7qx+eHAdGhAMVRcgESkV9qjlwqfuN5LUnI617h/P7l1zEz48H896KMIEC oXgvTtG2lm9fs47yEdQ3chs9jTJY/WFL8nSULyzY1NfJisTP6N2vbtm+3NqpRzAEAAA== 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=5386; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=Eqf5BA5MPpLzSC6cuHVUR9UeF6Cl1twczp+5YeEW82w=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBrAFhGuDMJN9g/kzhy1TmTgtvMvwpVdic+VMjbH Md+U4nAm8+JAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCawBYRgAKCRBRlgpH+WFc KiNzD/9ETJWH9Uxnjf+MHKNAo7ZTS+2yZCSfP8OoWv6/qq5i+1K5Jab+poSthFfwByUMnhtGoVH TgjyytMum44mQ6PWvdquyRNj6MkAKUKd9DoI87Ha7RcQgz48vx2LWkpAf+LMYV9oBzBLWULLez0 CVlPx676ykqZrpIuileBDk3qs3YsoRUlzypZrya67Hd1oenYF5c0QVYLjHcu4eXOiJuRKVgHP95 hgZHB9NWaoODoa6i5qiRoNB+wfMhrQXQ1xgfPex5TRGY41dS+pTnMNhDYvwT/Rxy0whStOh7TJi 1ETovbN/rfM/1WjcxRyo0Gmt/O6yQvIyumEOpvDkxoyPQIGja8WKVw7PfwPh4ipTe4uWuR25FPp nJ/Lx92kMWBnFxAEZJWgH6hd9yBCqoWigEvlPVnAlF8TeWTsZPBjbxhFrlc2/EFkVLBIlya/RPZ XBR/2TUB2BLNBfnmwqoTd5f7D6AQAExBtvp93YQV3EI8yGO/kpDJXVwVzMPzh/WDdzM5VbGgB6F mXVw1Ajs232jrXI3Za6Br7M6LwKQKNiOWphG39vFCClmyfr8aJ/WSXLSccmlDm7zS+op/ZULJgd 6IJQWux0jLjVPFR4glCe3NWb/bLAc5xpQvAFq2U/r31OJYjEN5ue+shjxhIvBnGlG2qaDfEcZd2 XHeK8MxprvSZa3g== 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 v3 0/2] 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, hci-8.1's 10.0.134 among them. 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. 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 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 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 | all start | | RHEL 10.3 rebase as is | no CT starts | not run | +----------------------------+-------------------+-----------------+ Patch 2 fails on 26.3 as is and passes with patch 1. 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 hci-8.1 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 (2): ve: trust every host task of a pseudosuper VE until it execs 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 | 43 +--- 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 | 304 ++++++++++++++++++++++++ 9 files changed, 324 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