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 5A7C880027 for ; Fri, 20 Nov 2026 16:36:11 +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 6AKGYua4006776; Fri, 20 Nov 2026 19:34:56 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AKGYua4006776 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="gNW+5yNP" 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 6AKGYsvu006754 (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 6AKGYsvu006754 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-c504bdea834so90170166b.1 for ; Fri, 20 Nov 2026 08:34:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHiAP1SSqBI/lT1dnbWkfRKMSada+nT7rJmQEqSQOikvTsjSKX3Lgm/iY5pyVTQm5MfpZmm8g==@openvz.org X-Gm-Message-State: APuU4Z+b3yf/VMEdYhn3TDCVD+01baAatku41OsIagrAHOzdkT9k/m/w I4ifsM50dFKAsB+Deasi6zBDbQmdVDS3hW7qedWJYNfUgiDVAPxRJSc17eALiXs9Yprv6fXiuLS /UUdPTP7l6Q8DB/DmDDnRbQjDniBLbuty0nM87ciXvqW8zfACNOPY6A== X-Gm-Gg: AZFdTZcHCKxWe34bPGe5ZoQc7C/EEyRe0aVG/Uy0fX1TyzIxPwmJY2P+nlK4+LtseJ3 yDWciL5xTr3072/YDRN1OVBG9HHTVyMExZ1TkYRQ0fu801ovitU9kFHGRqHlI1CSbW5uAdFoBbb mnjF9U0ITEzqBq554oXetN2JkHwqD6Q+6FptQsCDvmOscrIIc9xduG2ctxAvGdvUp814ILejbzz LTGks0eUzfxqLzChuypHGxKAepQISYUfWNV7EF8hIEuIexRokHnKkaRlfwCG4nw74cPXVxbYECk 5/sytF+wd52cBDTwGgqmP2HqJG4HHheWv70x+zMx/XHDp/R+x3a62S/ZlMfaNek2iyQoLZ1Efc+ oRXlFOWcla1qdvW4kiw== X-Received: by 2002:a17:907:6ea8:b0:c51:3bde:bfd0 with SMTP id a640c23a62f3a-c513bdec070mr345212266b.47.1795192493959; Fri, 20 Nov 2026 08:34:53 -0800 (PST) X-Received: by 2002:a17:907:6ea8:b0:c51:3bde:bfd0 with SMTP id a640c23a62f3a-c513bdec070mr345210166b.47.1795192493547; 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=pJ84uOHVgBGCIF6gPbGpBEITmFQDKAON4W0BOOpQWYu9HjxzeQ2t9Q8PsTTPyKdAJP UwafyEClvuYqOrfj4hq2An+e6AWvE6VTKUSbPHtwXRwcx4AgdSGLQkua+heyQbVeU+G6 6jR612E3U8gP4YSttb3IXJUjldqxhHxJy6jWjlVUGykDzXDuQthPT7juRBYXLdz+t4yf w7sR8ymdCmMOiQbm1UAUo6JVrVcmfosLwhQSQ2HZwhQxS24lw0nqwmHCvAdm8r1RLXGS C4DDumso1mxf1E8rJ5i1T2LI6UgebCJHb52rfwOiHEbfAjbp5frSZ7rc/R060oF0khfM KdDw== 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=62CdDvvK9mR4s6+q0Muwi6iVSYV+uz8+r9e3AVs2ogU=; fh=xqcbrIOv/j1NC9DwWL7cs9wu5dYsNcrfZRJG6Y55lVA=; b=a5RvuKXU5yyR2jIyhymI4OPXuk6N2HvRBuY/0qmV1jipVI3HAKiv4SOoh44nIU3EK8 JrjtqU9wnpsGdly05KQZTzJ8F+mQ4CF9h0Jw8iRqQGA3HoyDGK0JpqKhl9j1KxkRkofb NDvtaBMhhDXmIrhry2FSa2mMopssYTdlrLZxefrSTapfurypC9mfYIz22pgaQydoSn5p 1P/NhzhnDw4RsqyuAgeeSqfqpLe2Ci/qcveI0xuerQQle8ksYIE/81SIfyRAPpR6ZHv6 FyqSFOhnC/QVGkliVHaO1pl9iFfnwgeu8QVfJ2WTPDyeJorbDLZhzvA1Kt88gh/AfCXy sjeg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=gNW+5yNP; 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-c513b0dbe6bsi229221166b.378.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=gNW+5yNP; 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=62CdDvvK9mR4s6+q0Muwi6iVSYV+uz8+r9e3AVs2ogU=; b=gNW+5yNP7nLnFkKeWTA R/xMqscmF0eOBLPgYiCms2RISGXmgXHrAgNoszUoo7027izoEF4mVdgorw+6/gohaJxDQlDQ9vZGT N4eYj8SqcQdWLoZ2MYiC/GPmW6mZ0qdI2wyQJoBn4Sb/+gA9Zszg5iR45oMgGt2RTZvzyFw8TgvQm Tom01OObqfqBSjVs7t6fGboeWtK83UgFcFbLRe8LTaqX3Q79z0x5sF8af/bm2/ypfE9vjNYFvrnIg 66JHFMACbxdF6Lap0PCPJqbeD6IZ0ohgtIYy4olyLaejgJ+Ex9YU4ugwJMyjPlw3LsL1fearz3XpL ABRJtdOTVEGQx4Q==; 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 1xURZZ-00AYn4-0t; Fri, 20 Nov 2026 17:34:49 +0100 From: Konstantin Khorenko Date: Fri, 20 Nov 2026 17:34:50 +0100 MIME-Version: 1.0 Message-Id: <20261120-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v4-2-ac581cf6e36d@virtuozzo.com> References: <20261120-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v4-0-ac581cf6e36d@virtuozzo.com> In-Reply-To: <20261120-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v4-0-ac581cf6e36d@virtuozzo.com> To: Mirian Shilakadze , Pavel Tikhomirov X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3045; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=vbkrPTq8VrVj/17jZCfF+q21YBNNwSYR+dYWAtKK35E=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBrAHarfMn2l2+mXzoYSxRvCmRTiIsczXq/9GGrL dKJH9exukuJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCawB2qwAKCRBRlgpH+WFc KuX1EADGU7bNu2ca4U2FbHTY0KUGyvFVL8iq4xDfW/mvDUQJrHeKKpFcVhaf18fkz3dPHR6PuX1 WvEoefq1adpSh6gsVF2W599FpAVA2e76UrhTgS7k4F0yac+Vsj2tvYeTWmQqYl519rXyGMGVXoh NfOjrpnNCselhI3rwBDTLUkAVuTkcYKy79g0T5ef0ulQoGbZKbMxqBRhUrEJFysF6I9/UyG8wEt Okzlb1VW0cnbp5OVlHqMwYU0XUiBmMGCb6lLhR7BLdFIRJWw/Ehr5y4F2iPpD2aLf8kDG9SeCDi oJCSDEKynm7FsTx8qMZdXrW5McPbBagNv3ZdqJ2p21FkCw/HiHtSsXUAJC35g3Ntt33x7nngs/W 5N0oUWdQu4L6Kvl2dRNR+p2/hfelY6bu28NGaNyTOIOFlqb5QwILkIdlkRucCZCWioGmhDS9SSI iqtUZEsXHFkxAtC/2mnyztkWnq/a79D3vN/astYs7Etcf8NiZJuXJ+Q2vWzY4kuUxSjO5tmZIVR mCcnSql7b+WUWZ/Xw62CXWLZQz6N1LKGuwjFnZueVz4+/8kmGguyj+HawqPKmgNNhjpDV3GtTRV r6i4UQTkXAeclh60NjgalvkIE+KZhBhbDUevu68gNIG5tK4e/y8T0s7d4AY7SowU2GbV+uRnfMp oJ/N2upkjlV0s6A== 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 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. Let the ve0 branch ask whether current is a ve0 task instead. 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 Signed-off-by: Konstantin Khorenko --- kernel/ve/ve.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index 0ad145b38b54b..7bbc1106ba389 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -1784,17 +1784,18 @@ 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)) - return true; + return ve_is_super(get_exec_env()); return ve->is_pseudosuper && task_ve(current) == ve && mm && (mm->vps_dumpable == VD_VE_SETUP_TASK || -- 2.43.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel