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 7D9AA80032 for ; Fri, 27 Nov 2026 17:41:19 +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 6ARHe4G0024347; Fri, 27 Nov 2026 20:40:05 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ARHe4G0024347 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="dOjoej4h" Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6ARHdmWA024298 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Fri, 27 Nov 2026 20:39:49 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ARHdmWA024298 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-6ba810fb766so6600915a12.0 for ; Fri, 27 Nov 2026 09:39:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEktrGTmydyFOh+VU8HtdBJSMFA8K+QU0f1gJjxhO4CyefNjoqspYA1PDeQYhibzBxoD5DGpw==@openvz.org X-Gm-Message-State: APuU4Z8Z4qVqMYgmBnT7yt5bMCtjc8uEeAKAKoBb4n9mA9Ju/Hcd6AzI xF2CT9YKZx8MMiFMtXxVD3Qz5NwwI6yl8/eSO2RhJyldNz6M1KaZoVcH5OUrKMeZE4UlwqXRRnz 6ncIAR8hbxchIVtZMvPERNRMHmJil7xdS9FKLgWZvw/ECAQmSaJW2/A== X-Gm-Gg: AZFdTZesBnHcE0VmlPS0EZPfoAVYXWOUB8jxwCYgVqd7gab6hW3hxQPhXuynswEOsI6 q/Uvlm8IM9FQkjHMTQ4+6GN4s/NLTEMBOsBwIn2vIWGvCLn1l6CkWP6MqTio8/cRR8p0MgDZDPE +wlQVT9/GSuMG+Wx4ZGU8EYVJ9zWY6+wdiuIM0n4L5Icx1ES2KgLNGMcuHj+bh+5igKHKwWN+Fo TUXnM2SWjd0JjGHyALE5e8H5pV82LvYTP7xf3wfREeTtR63jzJ9urpjuctV3r7pkmjZDEzIOAZ0 /zfS3BeyWgTV/P33IjKJtHMnh1yGDilgtt3lIxN0XaCK+zIBU2zThS0M9tsyqMUg0VhLwXT8sw7 IwPlhdnCAIKcRfggU X-Received: by 2002:a05:6402:84e:b0:6b8:ac39:bb7b with SMTP id 4fb4d7f45d1cf-6ba37f07a02mr18050292a12.45.1795801188275; Fri, 27 Nov 2026 09:39:48 -0800 (PST) X-Received: by 2002:a05:6402:84e:b0:6b8:ac39:bb7b with SMTP id 4fb4d7f45d1cf-6ba37f07a02mr18050281a12.45.1795801187800; Fri, 27 Nov 2026 09:39:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795801187; cv=none; d=google.com; s=arc-20260327; b=EmBJjzJSKmGhcZLsqn1a/qFDi+ga3kZWahAry1gMfBZax8PhNCc0ZKlRC2l6ZrH7MP uitmLg7cwhF65j17JaWVk0DafbCiK3a0hVpWzea5B/N844YfECJgfiErlSW1PhG7UuPE vOut67cEQ8IaDk/XV7+jcAgcWQ3N9nrs7mkfmj0yUAqaarBcaUSeqYP+Md3jkKX+qSu0 KLXGyoyVGkynH2KVvLNVVOSV7ofu/Y/rHFIhl72QzyYVYdUib84791/IrAN9NjyS8ePQ mCHWBcxz76nZsMz6jctPDiHZXgYEdHfdUJS40/m3hKpwJRSvebvoWnqELGdlQrCit3Vg Yz8w== 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=VEQ80zJYoycbdMsoF+4waOSMsrucrqctox/RziGNc3Q=; fh=xqcbrIOv/j1NC9DwWL7cs9wu5dYsNcrfZRJG6Y55lVA=; b=FeXXMqNiaUZvRveg2S8huPD0eibk2GCyVaPtIfonOxCln6JeptQ6Q94j/uvNOx2tbi o4g+r8h48BV/tPk6KZ3yOcg4eegqHiX7CMgG14mh1BsP35T7Cu32FllqeAorehH9xPUn yamLsRsxhfTq1kdoG5mG0cvJzUtFTbGj9/ST20zQaN/3cTInb2z1H7KMandYZZ9nRiiI 3XfB4sVqxd8zvaHiSIEIRAfouDv/D4zGYTw1OPkT1LziCR1f+SumzYgP9tOTTnIcBoT/ P3BkInAd3czj4nJCKsvCHBhyWeAOBrG9NyTx9pPze4jbA2J/JX84kxFpoPqa/6P0MsiY o1jQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=dOjoej4h; 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 4fb4d7f45d1cf-6bba5e82e95si505054a12.105.2026.11.27.09.39.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Nov 2026 09:39:47 -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=dOjoej4h; 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=VEQ80zJYoycbdMsoF+4waOSMsrucrqctox/RziGNc3Q=; b=dOjoej4hhSekvRljqZA VHaNuwbucykluTLzSMLkN/mKFr6kMUBtz2uDSY6QtsOYI5YoVfsPEmhZmVxntP24JsBlR6YdYl5T/ Na07wRjmaXV/n4Naw+TUHJ/PL7yJtpepkhSlhJ8t1HtRsd2/++0PHAZMfj7P/UPbTiSds+3YbOTfI 2Kv0/Ex0M1Gs8K8aXek5/8b+lXTXLXyFxy3KwTjvdyJfYNgPPJb48eu8xTDMfilBhWfs17/T2uc35 HlkTwVmvgfU3Nir2uGu7cOYBk6LOb+jbGQRLN0A5OqN10Tu5wjgH+oc8M+XJ5sp1M6uiNH7AZVdzX 8ZnIriuMXcTC2Nw==; 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 1xWzv2-00CAsq-1w; Fri, 27 Nov 2026 18:39:43 +0100 From: Konstantin Khorenko Date: Fri, 27 Nov 2026 18:39:42 +0100 Message-Id: <20261127-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v5-0-32c4b6342ec2@virtuozzo.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAF7ACWsC/63PQW7DIBAF0KtErDuUwZg4XfUeVReAxzGNaiywU eoody92NlWVVZvlzKD/+BeWKHpK7GV3YZGyTz4MZaifdsz1ZjgS+LbMTAqpEfEAVsEYaYRTHyI NpwA5TSEC1hq1gkyQaJpHmEw6wZhobkOaR4pAiG1XmcahNaykl5DOnzf5jfXOQ8Mle78d0mw/y E2ruz61JhHYaAbXr6sQ/dEPz7cFxB4FaI6SC5CIfF9z5FLzM89LuYS8rBG9X3/5tdXMuJn/bpQ RBAjdGWGbw0GZ5jX7OM1hWQJ34XMrk+UPS4q/W7JYrqmpkXuHrTX3rOpBVlWszgqJypHqVH3PU g+yVLGMqxt0naZKt7+t6/X6DSWggHakAgAA 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=7223; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=XG6df+KWhuanuMKVg/QMSs4uVGv7usLB8yeR5aS7DLc=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBrCcBhb5uE6Hfq1sgzEiLBbu6VP3ej2lm2Oeznn nB9fFKOy6iJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCawnAYQAKCRBRlgpH+WFc KkAIEACuYrQDcLC9MiDKicR8NyD/W9+oEhMHkaoDhYa6mub5ID1nKI5U2+xexN9rOIIZWlFwaho xMVRki/EzlGp9AjwP/rM2PzwtNqHp9jksgbSPkKmK0KnHxa0dTBinmcMsvqdE9udxkoj5lN34/3 zfEYpjGkeDM4DjgqNbpvh7eoLNq8ZxdHjy5iKpiZzceg+8hNSqI6zDVfWIteOcbS3SXDbkdJp55 QO7sZotyfPJaDD3o5Hew5+aTSJLFtAN1BWN0p1s9ihj7yPdsPi/1TgSczRtBjXpVr6aOLHgDRhw 2+YylORXyfAgK3w76krcnKiAjn+rYH3nkPOUzSzV3z7wZ75Mca7WL+rhplrD1PS4rtMUx6XvX1U jb9HvYq6YgVi9C5kk2n4AyZ4E9yeiU6hAoDQRuvfHnpQLZHTU4gHK9+06TwHAKChyirZ6kcgWT3 qXI+Chgr5TqfskRzozmmEw3HEKEbTPE/uQaodSc+SEscmwcBp9QLw6xoLJu5u3/DvXkMnB8AcuJ vep31CJMC5GRHnDW1OJ588fnWbToYFUVF8A3qMl8momLZEUNPvDVuWfB938uPCOhh7NCzaqBnlT 3JzITbCoO1Mpnv6B7aKnNM5aNOcuneXDM4AWCKuXRjpXw0UALARDC1jA2F/+9qyKGVQ+88juFpg JqJmM+kDm1PCDyw== 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 v5 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 v5: - Patch 2: Pasha's form of ve_current_is_pseudosuper(): a task outside the VE asked about gets nothing, then ve0 grants to every task of it (Pasha, Mirian). get_exec_env() is current->task_ve, so every caller gets the same answer as in v4; not re-run on the test VM. - Rebased onto the current 26.x tip, no conflicts. - Pasha's and Mirian's Reviewed-by on every patch. - Link to v4: http://lore.virtuozzo.com/20261120-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v4-0-ac581cf6e36d@virtuozzo.com 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 | 47 ++-- 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, 342 insertions(+), 39 deletions(-) --- base-commit: 68d7c50146a213c9fe56c90da20fbacf3c81a1f1 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