From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 9498F80024 for ; Wed, 26 Aug 2026 16:36:22 +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 67QGZ6NT010937; Wed, 26 Aug 2026 19:35:08 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 67QGZ6NT010937 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="liDITA10" Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 67QGZ3YW010932 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 26 Aug 2026 19:35:04 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 67QGZ3YW010932 Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-84e024d2129so1926433b3a.2 for ; Wed, 26 Aug 2026 09:35:04 -0700 (PDT) X-Gm-Message-State: AFuF++lmIAMe8Fp8xFyhGvRtNkLhjYChO8cMI03AxWEfKGyefpUip7EQ +qgtvQJZVBTGfcLmIqCsaE1+53qvHra+8xAlglWY8L5K5laHllnfssfC0wZqaW9s6eqWBwyu6i2 gGS42DEB+c+L/oQLJKmho3XIz59PWeKyY8BrV5ERMJmWgWNDjB4YCAA== X-Gm-Gg: AR+sD13vBM3+M0uVU2t/SC4Ygp22B+XQbPM3vIruzNAbsGxahFMS9JSihoVHXmuJiET /gxP5IbWfsg3gw5mUc2vMipgJCLWaXuOkYAxTvmfqx7xtGP7gn88RXcm2GmYyYP5EmCd2FdAQTS VH5C5sulI3rnoWmpjbnGge3fUoAPbOBBLvNNtFtlSlTonHNjsY6Bxc3fNH/3l5X4RC4QsPiospz 5YfZZpwLisu2Q24dElihCVlynHcjWOciodCEfGm5vOZ/VmAswX2k1vljA+py8QEE5fMs8Y9rEhB CjURCKSMlHgQBV/MsAZkEExuvxEgnbYWFDl1sikTCLUghbJmajJM8LJLno7CA0sR+NM93rqhMNV YDLeqhhMDgTgE0AZ0a7OQpDruL4GwQy1NZdUmoYOC4ih5AFSiRnaDiwl0CozdRDYpKs/HghbgMa 45LUdKbwSfnVvJ0jMPxFuC X-Received: by 2002:a05:6a00:1f17:b0:848:2c2e:c7a3 with SMTP id d2e1a72fcca58-8537648a353mr16342547b3a.16.1787762102885; Wed, 26 Aug 2026 09:35:02 -0700 (PDT) X-Received: by 2002:a05:6a00:1f17:b0:848:2c2e:c7a3 with SMTP id d2e1a72fcca58-8537648a353mr16342420b3a.16.1787762102397; Wed, 26 Aug 2026 09:35:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1787762102; cv=pass; d=google.com; s=arc-20260327; b=K9LDlPakiYbE4f7NFdHs6EV8Ooz5O4sLnEdj0fq7FLSk59ssp8vSM/oBGrqXsWEqVC lbeEIVE6yYym7H+kZG+JI5HYCNGPD/0ayifDgPovt2djxN7XQXH0Y1s+P9f2abb8uVX7 rWV+AU6p7Ljqhd4oi4OdHHMoSUNo/M8CZr5waVtRX0U1Y+Gq1ZZYX42pbe0D9WdeTv6f DPfk3zSFDF3uPdZyAjEIullwYD5yFJpZYEjk0f3EcKczosbhlUr9ohCwB5ncUVX3YjIy 7ceOSvw1EUPuNbsGkc2UJqZ/e/osuYuDWyZKQNR3bLIxT2Ips5LaXSYzclRTMZpqdUfg EAEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=mime-version:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:date :message-id:dkim-signature; bh=K/vaa4sEojjVO815CPt8XgpNZe5yRgDQCuszaVMdLwE=; fh=novrlkJ62iRW7ycDzy8NW235/kkN46vM+jsUQ9w8MdM=; b=cba7tMa8cy+JTiNGyBEOkT1/IWoXl6H68XJ/jMOomLVSKtU3QL5M/1OpdB60iPIIIO 7zEKnkdB/fJzjVz+82qDyeP5BtxfM79VsEz9Shgf55AxiCqGNP4QjsYDQgq13wpQ0g6i 61G1UfD9va7/SW8c818UiegkURq6HCrrviUJyYGMOgpGTpnnT7JeYxN+w6/DA0Aw61H0 hsrynCF009/2CPwuuc9tnD1k0R5EvrN/kCLFb5VC8E16w8zNWcEXYF02uC5IKExFfP2M 57mCMVCW0cikC7I3ODoSusIsy6jx6CaOK6YwRINnCCV3vJJuHdtq2529uP6iWpzLjXVK ImLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector2 header.b=liDITA10; arc=pass (i=1 spf=pass spfdomain=virtuozzo.com dkim=pass dkdomain=virtuozzo.com dmarc=pass fromdomain=virtuozzo.com); spf=pass (google.com: domain of khorenko@virtuozzo.com designates 2a01:111:f403:c20f::7 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from OSPPR02CU001.outbound.protection.outlook.com (mail-norwayeastazlp170130007.outbound.protection.outlook.com. [2a01:111:f403:c20f::7]) by mx.google.com with ESMTPS id d2e1a72fcca58-85359cd7615si5734229b3a.15.2026.08.26.09.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2026 09:35:02 -0700 (PDT) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 2a01:111:f403:c20f::7 as permitted sender) client-ip=2a01:111:f403:c20f::7; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector2 header.b=liDITA10; arc=pass (i=1 spf=pass spfdomain=virtuozzo.com dkim=pass dkdomain=virtuozzo.com dmarc=pass fromdomain=virtuozzo.com); spf=pass (google.com: domain of khorenko@virtuozzo.com designates 2a01:111:f403:c20f::7 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iQi8WSHu9tVE49b2bm3+DuNOEv7OBQvE1HLPqSB53KTsDs1kjpIQDAvt/d7FHMlu6wDNcLnxb+AMZktkE+oUX+ymnCu86QvtDkO60CK942zofQr0MprEbYivYhr5I+4MRxWdFufy39xraQyho2gFjvNimBX8A0VJ5m7/i+4Uool0c8ZN9yZHP/7TrKxvWHDxeq64agoeTa/8Ms/D/2K1T/DptC95CBJyjm1+k5MtFsSjtEthKp6CA/fjcDqBnd8x3eYKkVRVa2MTw1dPT0aMMdGAMlacsH21X+1QoYUP90QKuMxGreHAJUMaQQ3MRob+sK2q9aYLxjJtMtNE/5Pf7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=K/vaa4sEojjVO815CPt8XgpNZe5yRgDQCuszaVMdLwE=; b=KvEq5RsFyMehvEQOFKi2dR+misepjUSFCEmADgfCJkGOaB+jEFsWoANj6YTSirigU2edqNsVInTfFtMxrLlJ+1VMTA0mAT8eDCvJZsxmdfVtFyNSdbBQwHS01bzW6nRcq7VU7Ql3b2uAMNNnsy10RsyWLEtAylCMkpo40WWD/N7iDIGbdai0e6ubJpLuAxAcZOewZ0cP1qa9pTJcWdLL/H/5YctTv/J7pxPevXJj5tM4bI+rDYmN9Nqk5Mak/PqnsU7HK0DH+1kiSf5eiT0bI6ttdKRLGJr0yAqep4lcp00dmobrfndQ3rQPOyksGbA1/yC31DdioTUP8qH7yUyOjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K/vaa4sEojjVO815CPt8XgpNZe5yRgDQCuszaVMdLwE=; b=liDITA10/wSgPX6rAwWW7mgQwrkMhEeY3w/MbIwASXbtWD3kqTue5F1hrHWh8Dh+HQkSrCCvPrmtxy3fLsMV0MyOyF9JXNvAraKr06pkpBU14wd6AyUn0EqKuCXWmkxt+Iw0PcTKoap5/SsYzPR5A5Si8wW6Ie5+Lc1W/r5mDEE77glsHnlTpMlQBGqTWxEvOA0E7W/pP0YoKD45ct1VEec9of95JE0DQCiE+YwwQvNiqlBZpItqJR6xQ0jY5J4IQgAdASSLrfMZK0d+92AMHa3wukvq0boSUsMVJosVKd9IpA81cEph5hbgnKsWzVKn8AWRtlvnmXV6bhZWiJy84w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from PA6PR08MB10708.eurprd08.prod.outlook.com (2603:10a6:102:3c7::20) by AS8PR08MB10003.eurprd08.prod.outlook.com (2603:10a6:20b:63a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.6; Wed, 26 Aug 2026 16:34:58 +0000 Received: from PA6PR08MB10708.eurprd08.prod.outlook.com ([fe80::1999:c6db:dc55:494a]) by PA6PR08MB10708.eurprd08.prod.outlook.com ([fe80::1999:c6db:dc55:494a%4]) with mapi id 15.21.0382.004; Wed, 26 Aug 2026 16:34:58 +0000 Message-ID: Date: Wed, 26 Aug 2026 18:34:56 +0200 User-Agent: Mozilla Thunderbird To: Mirian Shilakadze , ptikhomirov@virtuozzo.com References: <20260826110415.41119-1-mirian.shilakadze@virtuozzo.com> <20260826110415.41119-2-mirian.shilakadze@virtuozzo.com> Content-Language: en-US, ru, sr From: Konstantin Khorenko In-Reply-To: <20260826110415.41119-2-mirian.shilakadze@virtuozzo.com> X-ClientProxiedBy: VI1P189CA0003.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::16) To PA6PR08MB10708.eurprd08.prod.outlook.com (2603:10a6:102:3c7::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA6PR08MB10708:EE_|AS8PR08MB10003:EE_ X-MS-Office365-Filtering-Correlation-Id: a92e4ee5-bc45-493d-70e8-08df038ff7c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|23010399003|1800799024|366016|376014|56012099006|10067099003|22082099003|18002099003|4143699003|5023799004; X-Microsoft-Antispam-Message-Info: ABbUq3EgrEsmUE2FLsAh2fIYILhjPyXEOjZFMAemGoK7/Q9qVxjCo4d/GymBptBcRAjHKQgm+HrBB0MPEu5P1qFgUTXqxKyUNvmCI5Jrnr0SBuXztuGq6hM0s+IWd9f0MfXU61u+/BBdu8PZlapoeuXp2G+CkHUhodndZYV7rhTVWIctzXc2YyApaO09RDwPG9Jayv8aNYvllkgFbgbsurAgVQEQvaJHjqqT/t9jRu1RBOwsVm5G3FrEKn+6xs2E9glEY8ogDctvYOf2CicZwqAhDlYKUx8I1uEge/goPLcNYeLwrCg+tQKB1iMtcUsl9dEaWVuXrcf1mFTSZM8o7bQcUVjyKVY1CFNR5pGSgzd7eSITrsDng+9BDwoABgRj/1dO/RWnAZfMhxah7zW51g2ecGRzwmPidCLzYHzy0i8Gy8Aa3bteDuefRSAP3B7mYehbBCKsw5ACboYEe/PHt2UeSDCGKQlPxDdKW8p8Qxu0MVM4SLfgzQUngZ2syMdiGkWTqKZWth4wZ41IszOhLljSh8WZMq9cLbTRpLbDSgHv2qOsUhw4kib3bbebzoTTljQkmoRoUjuHkCl8FmTqkcGuv1cIlY9eFoORfX22mxnMJ+KToEUfUkrjJB7TOaT7VAkAeidSZsYErE/COl0QoTQ3gUyJT9FtJGVxW+uDp7I= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA6PR08MB10708.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(23010399003)(1800799024)(366016)(376014)(56012099006)(10067099003)(22082099003)(18002099003)(4143699003)(5023799004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NmsvK2ovTUdPZ3dObTM1T0pXRlZVNXVjcXZhUHUzdGFWTVlQeU1JK29sRVV1?= =?utf-8?B?b1NDTlVQdEFoZzlVVUp4UHhIYmdUVktSZng2eUk4T1VDV083ank2TENib3Ix?= =?utf-8?B?TnFLcEZjYUpubUFwdHU3WTA5dnUxRU1jeU80elNJSXNlV0dSVkVTZ29OUmsr?= =?utf-8?B?MCtaODFKTTNwNmVUL3VDR2VKYnZScGpZNElyNnhLazhxMGVobm1MaGcrd29M?= =?utf-8?B?NEFOT0JORW1mNjRVZkRaUlc4dmRMbW94VGprRENzMW4yWS9xcmdaNVdnNDYw?= =?utf-8?B?aGh3ZTFxdkJTTzU1OTNiMkRIMWlIN0pJclVha254K2VvdDRuaGdiUno1Tm95?= =?utf-8?B?Rmp2K1o5dTFDUmRvbDRya1NBMDF6dGhlMDlrYllyeWRTZHNoSllzVXd6TFdj?= =?utf-8?B?L0RXVnBYRDNGYjRKVWZ5RTE4UzdpNzBlVzJwczFqWVJiVzlmZHV2UXl1TUxi?= =?utf-8?B?RlJ6NnE1Um4rb1JGNU1KeXpmV0JGK0QwOENyOXErZFprZ3V0NWlmUnNjbU5U?= =?utf-8?B?bVVld080M0R6TWdEZE1nSnFlS1RLZG1lVFkyNXJudjVSNndTcVNsd3lFZkFy?= =?utf-8?B?Tmo1Z2dwdUZKTFF1bG5tRWpmWFVGb1JKaWc4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enant-AuthSource: PA6PR08MB10708.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2026 16:34:58.3317 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2Hhh4hihH0mzEoI+3r01vSd1/QGMr5PytLmAfa+AkiAfyp0QJZjCxmASegDyiVZOptrPJgT26Z9u2h2m0qNmug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB10003 X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH vz10 v2 1/2] fs/kernfs, ve: hide entries from a VE without invalidating the dentry 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 On 8/26/26 13:04, Mirian Shilakadze wrote: ... > diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c > index be680eb98ed4..4a5ee299a94e 100644 > --- a/fs/kernfs/dir.c > +++ b/fs/kernfs/dir.c > @@ -1199,8 +1199,21 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags) > kernfs_info(dentry->d_sb)->ns != kn->ns) > goto out_bad; > > - if (!kernfs_d_visible(kn, kernfs_info(dentry->d_sb))) > - goto out_bad; > + if (!kernfs_d_visible(kn, kernfs_info(dentry->d_sb))) { > + /* > + * On an instance this VE created, drop the dentry as before. > + * Anywhere else the node is fine and is only outside this > + * VE's view: returning 0 would tell the VFS that the dentry > + * is stale, and it answers that with d_invalidate(), which > + * detaches every mount on that dentry in every mount > + * namespace. Report the name as missing to this caller > + * instead. > + */ > + if (kernfs_info(dentry->d_sb)->ve == get_exec_env()) kernfs of a VE may outlive the VE (and ve_struct) - if kernefs of a CT is pinned somehow while CT is stopped, there is no get_ve() or any other blocker for a Container destruction before VE kernfs is unmounted. And in case the VE1 died and VE2 is started and occasionally ve_struct got VE2 gets the same pointer, then the comparison will tell us not truth. ======= What is stored in info->ve When some VE mounts its own kernfs instance (for example, a container mounts its own sysfs), kernfs_get_tree() creates a new superblock and a pointer to the mounting task's VE is written into its kernfs_super_info (fs/kernfs/mount.c:365): info->ve = get_exec_env(); The key point: this is a raw pointer. There is no get_ve(), no taking of any other reference there. That is, the superblock does not in any way extend the lifetime of the ve_struct it points to. This was the case before the patch too - patch 1 merely added a second place where this pointer is used (the comparison in kernfs_dop_revalidate()). How a superblock can outlive its VE Normally a container's sysfs is unmounted when the container stops, and the sb dies together with it. But the mount can be "pinned" from outside: for example, the host bind-mounted the container's sysfs somewhere into its own mount namespace, or some process holds an open fd inside that mount. Then, after the container is stopped and destroyed, its ve_struct is freed (kfree), while the superblock, with info->ve pointing at already freed memory, lives on. By itself this is not a use-after-free: the pointer is never dereferenced anywhere, it is only compared with get_exec_env(). Comparing addresses with a freed object is legal - nobody tries to read through the address. Where the trap appears: address reuse kfree() returns the memory to the allocator, and the next kmalloc() of the same size may well hand out the very same address. A new container starts - its ve_struct may end up at the address where the dead container's ve_struct used to live. Now the scenario in full: 1. Container A mounts its own sysfs -> an sb with info->ve =
. 2. The host pinned that mount, container A is destroyed, the ve_struct at address X is freed. The sb is alive, info->ve = X (dangling). 3. Container B starts, its ve_struct is allocated at the same address X. 4. A task of container B, by some path (through that host-pinned mount), does a lookup of an entry hidden from it on this old sb. 5. The check kernfs_info(dentry->d_sb)->ve == get_exec_env() gives X == X -> true, even though container B did not create this instance. The code wrongly decides "this is this VE's own instance" and takes the old behavior: goto out_bad -> return 0 -> d_invalidate() instead of the new -ENOENT. Why I don't consider this a blocker The consequence of the false match is merely a fallback to today's (pre-patch) behavior: the dentry is invalidated and the mounts on that dentry are detached. But the dentry belongs to the sysfs instance of dead container A, that is, the only things that can suffer are mounts placed on top of entries of that dead instance - not the host's /sys and not container B's sysfs. Plus the scenario itself requires exotics: the host is for some reason holding a dead container's sysfs, the new VE landed at exactly the same address, and its task is walking that foreign mount. The reverse direction is safe automatically: "didn't match although it should have" is impossible, because the VE that actually created the instance is dead - it has no tasks left, there is nothing to compare against. The only possible failure is a false match, and, as shown above, it degrades into the old behavior, not into a new hole. That is why the wording was "worth being aware": the patch makes a long-existing weak spot (a pointer not backed by a reference) matter for the logic (load-bearing) for the first time, but no real harm can be extracted from it. If one wanted to close the question nicely, one could store not the pointer but, say, ve->veid, or take a get_ve() reference when setting info->ve and drop it in kernfs_free_fs_context/on sb destruction. But I would not demand that from this series. > + goto out_bad; > + up_read(&root->kernfs_rwsem); > + return -ENOENT; > + } > > up_read(&root->kernfs_rwsem); > return 1; _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel