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 8637980032 for ; Fri, 27 Nov 2026 17:41: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 6ARHdvJs024317; Fri, 27 Nov 2026 20:39:58 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ARHdvJs024317 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="mCfqIcM0" Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6ARHdmdm024292 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Fri, 27 Nov 2026 20:39:48 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ARHdmdm024292 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-c50a8e37286so812253566b.3 for ; Fri, 27 Nov 2026 09:39:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErFyOeSYQVxoKXioKAlcUgtL2C4sr5FGfxulkrS3aXIHuchFaHgOBKRsqu/ajCZm4gvxqoOaWQ==@openvz.org X-Gm-Message-State: APuU4Z8gyL/z3+Ngi2A0BL0AEysAq2zPgivslJenIa3nVKkJh0nGymUp WF4U09vKLWFP0J64s1u0ry2LAk9khN4uh7r31CLQpgY8XDTMNXrwIpwxCae5XF2pV/JBN6pBwRW KS1i0bXv0P9j1HVmS70Z3aEQzJTRxI29l6+lpBH56oe6tgZrnMZFIfg== X-Gm-Gg: AZFdTZfKg59pA2Ojtdv1eamv6NfDRhsW60MihwpJ6Az0QxPkKP1uMkcCg6lW34Oo5I3 B6JFzi15XEIBnAzSjuj+kGm7Ohmw+4fDNLI66v7XlXIUyqbF8mCcBBzNbOShCz2XPBmOG8SlGhE JUOpER5UNlp8V9hThbRF3Wi36JI2BtIRy/oXAQMMaM6NGY4zVrxF/ybf+RD2M6laTbhs/OjQr8t v7dyhwZT5JRMgc20FjPjccuB2QKlhRzIi3+cWtb9zxQJGlN3XnANNCFSglmqUMW4JfUpTZsJXXv 3s3BITK21tG8wnTyjysXJuyyLzpFddkHj9jj1ws38difnWw0H9LT3qt7n0dV56iNQCp3zHmD1jc W7xkxBiyGvmzYdBaVHw== X-Received: by 2002:a17:907:a890:b0:c4d:31c5:e30 with SMTP id a640c23a62f3a-c513ab12652mr2307785766b.49.1795801188507; Fri, 27 Nov 2026 09:39:48 -0800 (PST) X-Received: by 2002:a17:907:a890:b0:c4d:31c5:e30 with SMTP id a640c23a62f3a-c513ab12652mr2307783466b.49.1795801187959; 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=SvL3hxH2HL0eD1oIjJOktCY/hleGHTqYaVwGFxszEQ+F7aQlOIg6D4oErg9RLxlkCy Izb3+aCsFyoInO3UyO1ZUEc67ZbDiPockPNyIsG3PyDp9z0gLuVDdWpXkqdWmUpC5eLu wIctPc7XZNzIbX/qI8LV/u4RCN1YrGTjEowbbaiMi3mGy5WrozA7WQyYfINYc5e+conj kpiDg58vpYpKmxxF5sMErfbeZA8rTX57+GQSVeQZ/Nha0ZDQX1BPe2bArRENahLPx2sh J5S4HV2JuUAOn4WDZGcftRfZ/baFO55YPsLBeM0AqZsqCPK0PUCo24yIDzXQEOpZwv90 agtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=Dh9MYaGv4YAjarZTU9HLMNkOXMq5tHx10HdTv9VpSOA=; fh=xqcbrIOv/j1NC9DwWL7cs9wu5dYsNcrfZRJG6Y55lVA=; b=cebw5CvukiKE/XRzNzGK4bsVOHPthDH+g0Ezii+11n4RLV9fzqIU5GaUssCRJeVwo6 vncUzWbjUv5Cj/UPpvnnR52jpqLctCqmyu4DFK+fmWpg7DCZqtQk1Sjbk1bVNjbAJ/Hm uBtE10NLflaeg967I3VhU75UXAhoPkjtoOF5AbJYHVYw+ALS1/6Kra1wjz2EtaZgqgoC 3q7AFpsXHEsp5r1eQIKiImUBiiBDawWjYi7dlj4uLxiJPhfPK0QHwOfCA42uk5gR8qMq 7oiVKXsug+vFeUiS+RBVSfjvMgYskG5NLrAx6+XtHVpOyt8nL8FqrfhxsfkI6t410A0S Q9Ag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=mCfqIcM0; 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-c513b06c091si1554333066b.219.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=mCfqIcM0; 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=Message-Id:Content-Type:MIME-Version:Subject:Date :From; bh=Dh9MYaGv4YAjarZTU9HLMNkOXMq5tHx10HdTv9VpSOA=; b=mCfqIcM011rIb+w6Kpw glstvwOPyZ1nE/cioGgp/CZ7GJoMnA96lZ4Zozt+O4YqM3cLRzJxzApst8vSLqtuFWQoX9iZIRD6O 9cOPMFWGs+4QxSimZt+oMMZ+3ZL7e5nMCUJtBcN1kba6u0FLgqWPMPhajAoUAuPbY581+t+3eQIV1 oEGs9howKVH4U4DRa5rc7TTvEsilgZNCMFgJIoLTkkMdViISPgkrfXodQIceLYA+7RwkklZm0drR+ A4zDiOyg0nYXp4sFBuFt9nw/WQLFTktOVIkpBZTWF/5DF9cECJne5f5AJ69vnvXp/7SxGeNkgFp4I xZCkYGEFZ9xchew==; 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-3C; Fri, 27 Nov 2026 18:39:43 +0100 From: Konstantin Khorenko Date: Fri, 27 Nov 2026 18:39:44 +0100 MIME-Version: 1.0 Message-Id: <20261127-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v5-2-32c4b6342ec2@virtuozzo.com> References: <20261127-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v5-0-32c4b6342ec2@virtuozzo.com> In-Reply-To: <20261127-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v5-0-32c4b6342ec2@virtuozzo.com> To: Mirian Shilakadze , Pavel Tikhomirov X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3398; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=q1X7tp/v5Lh7VqQfl15Iqzhqx35oI2hBECGqLWFKBbo=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBrCcBiA3nNLeufcKg/wLS0KJGZpygGeaQrm5clH ZKGH1tz98uJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCawnAYgAKCRBRlgpH+WFc KtYuEACD1gr4Detvh6VwnMBJqcFMt+ucZCHexcjBBnLd/gGLGALQIgaHbWlviVsS18WmVqrEgZC 5l3K9dGQnymkAGdhCzjSOSDioX5iydXuCLrUP3YM9llVZHwRBNLOOv41I0Z4BL6lDbQE89xTpW1 oP49LBI1DnXreDvnJFVSbMvhwG/3Q7iz5yQ77QQhqj9LCJFEeKDfrfznsgNdx/bwF//izJcDMZM 4dMwV5kYoD9P4XhZ121a9+1FJTc20v7UztORCI0uj4acPbszK9gM1SxzCQLxrF3L4KGaaQB5CoR LiRYn2FSvsxonp890KJggLo1Z3ZZ4Yj6U4AyM1F6QROJwt7bQ/jRfRm4Mzqu6e6eX/44SiAUet3 dVRcsI1QvgDCrg622cUZyNIFr6ZcfV9zIDGJ/iOZbdbA5jjsJHjSFfnshNKYeMyvpk6C9wEZspR Qv9OPp6pKNdmIbBGUFAfRgjCWtB5HjbLszGPShA2OhwEvJkFm4Z7SsNbpL9MnThaj/Qyc+okwMh KpdJnqD1caStvnchXYqiAUgXnYdQOk/yOfPEkTTfuoU0V4oyhcd86+js/kRLdj65QINlhilz3SX Eyc8huYPZ6XkW572W3XdgBuN89BsQQUC60HKLbplt1S2RBW7qc3OnzkLTBU68DArBW2oNHQqPV7 MuTreW6WUu4SgpA== 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 2/3] ve: give the pseudosuper relaxations of ve0 to its own tasks only 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 ve_current_is_pseudosuper() answers yes whenever the VE it is asked about is ve0, whoever asks. The line keeps the behaviour of ve0 being statically pseudosuper, but it reads as a grant to any task: a container task would get the relaxations of the host from a caller that passes it ve0. Grant nothing to a task outside the VE asked about, and in ve0 grant to every task of it. The relaxations of a VE belong to the tasks the host sent into it, and for ve0 those are its own tasks, no mark involved. No caller but one sees a different answer: - devcgroup_legacy_check_permission(), netlink_setsockopt() for NETLINK_REPAIR, cgroup_file_write(), ve_hide_cgroups(), prctl_set_task_ct_fields(), ve_devmnt_verify() and ve_devmnt_process() pass the caller's own VE behind a !ve_is_super() check; - ve_features_write(), ve_failcount_write(), ve_pid_max_write_running_u64() and ve_aio_max_nr_write() pass the css of a CFTYPE_NOT_ON_ROOT file, which ve0 does not have; - task_still_dumpable() asks only about a VD_VE_SETUP_TASK of a VE other than ve0, ve_vps_dumpable() reports ve0's as VD_PTRACE_COREDUMP. ve_try_reserve_mount() does pass ve0 for a VE task: a host helper that joined the VE cgroup but still sits in the host's mount namespace owns its bind mounts through ve0. Its reservation now goes through ve0's mnt_avail_nr like any counted one; the counter starts at INT_MAX and has no cgroup file to lower it, so the mount is granted as before. https://virtuozzo.atlassian.net/browse/VSTOR-156164 Feature: trace: prohibit tracing sensitive tasks from CT Suggested-by: Pavel Tikhomirov Reviewed-by: Pavel Tikhomirov Reviewed-by: Mirian Shilakadze Signed-off-by: Konstantin Khorenko --- kernel/ve/ve.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index 0ad145b38b54b..bcdac9c846a1c 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -1784,19 +1784,23 @@ bool ve_check_trusted_exec(struct file *file, struct filename *name) * ve_current_is_pseudosuper - may current use the pseudosuper relaxations of @ve * @ve: the VE that grants them * - * Always true for ve0. Otherwise only a host task of @ve may, one the host - * sent in while @ve was starting (VD_VE_SETUP_TASK) or after that - * (VD_VE_ENTER_TASK), and only until pseudosuper is cleared. Exec clears - * both marks, so the container binaries that the host tools run may not. + * The relaxations of ve0 belong to its own tasks. Those of a container + * belong to a host task of @ve, one the host sent in while @ve was starting + * (VD_VE_SETUP_TASK) or after that (VD_VE_ENTER_TASK), and only until + * pseudosuper is cleared. Exec clears both marks, so the container binaries + * that the host tools run may not. */ bool ve_current_is_pseudosuper(struct ve_struct *ve) { struct mm_struct *mm = current->mm; - if (ve_is_super(ve)) + if (task_ve(current) != ve) + return false; + + if (ve_is_super(get_exec_env())) return true; - return ve->is_pseudosuper && task_ve(current) == ve && mm && + return ve->is_pseudosuper && mm && (mm->vps_dumpable == VD_VE_SETUP_TASK || mm->vps_dumpable == VD_VE_ENTER_TASK); } -- 2.43.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel