Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp32250rdb; Mon, 22 Jan 2024 10:58:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IG00wuK0m2kz8p3MAdh3CIhkD5nYH563tCqcts5svayTgvMuc/5nf/N6AOzcl1Y6qPBMpyt X-Received: by 2002:a17:907:d048:b0:a2f:c9fb:5ebf with SMTP id vb8-20020a170907d04800b00a2fc9fb5ebfmr1944644ejc.146.1705949929132; Mon, 22 Jan 2024 10:58:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705949929; cv=pass; d=google.com; s=arc-20160816; b=EI0T7aqadLAIS0boOQgYfwFZHorleuCDgLYWe0+vSvQgw6//iAnDFQEanyzbekv/Hq LA7+kO4FJdbt4uTtT631oJ09pexkTRD6F5ei2OYOwvF6o4/AABPHjjfXx3mEaQ9FSvYo WyY90sRb+TBtYRl9U05EsI1dQobQeJQET9yz2jbxkMEDqzZkKrpTwD8GSlaYpKli50YE SEVhBmdmj7MAh4WbvFPjrveIpqXoAdMAM7LqQ9/IOz8gCgcW0Ixfu9ChUSruxl+6RWtS /FRNumC9AWyVpqLPPr8d1IFY9u6/cHgBcEghoGadZ0GIVRwMWSzcFBkn4GevOHAgJNQr 8F8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=C1V5laycadZTrle8Pm37agthK5noM6Faiw6whvAvEpw=; fh=CdHDzVDnDpKDVLjdpbuZbCxgD8Su5a0wm8Wk7Fc0aYg=; b=pEfsDLXJMJ2tKzqDOWCFXgfl1c9fFzWoQrv+ca6DzdEph+EEkBwd5FuXqVnDkwWCnn ItLnsudKwEA8MMHbAMLPCf0BFuD2jCA8I7rHWDWI641CvTeTU9zLW4ZLe7esXszyeATQ 5o1kJcokjT+TLyp/Yj6w9xkqOkH2wPIcx/kOt+SA8a7SfOqbc52hwP7u9E0LiIkXLFDm xNy1uUhT7h0pU3Qx1+ILRzUsf2xDOEkXLudYo40W8iL+pkjHuHZmcQ1kjaBsaqoSK5lh VMvypHUlBC0zloztHp95E0AyWVgFmYNEfy7wTlzXIK8e9LmechPg8lmDZe61vmopCMNh GJxg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=rgP6a9lU; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-33983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33983-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b9-20020a170906490900b00a307a4b0ff3si650516ejq.928.2024.01.22.10.58.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:58:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=rgP6a9lU; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-33983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33983-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D59831F2AFD7 for ; Mon, 22 Jan 2024 18:58:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDD9E4F603; Mon, 22 Jan 2024 18:27:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="rgP6a9lU" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF86D4F5F3 for ; Mon, 22 Jan 2024 18:27:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705948047; cv=none; b=KPVzh2bSov2NmPWhSRlvsKcBceH8778j1PgmuqHtyELMwM1uj/6sFhON75mb5Rm4oiIR09m6W/p2FuzO3c0rSEM1pfQSTxxsSdcyk3pjSy1EGtqCSOmkUO71nMbub2uq4ZJm4mS50YDeUyLGaqxklWjGv1kOuIQMkNTvsH56gQA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705948047; c=relaxed/simple; bh=5LcgpOOqbLj9qSMEPJ2zpvvrKBU2HoNgldi9XXiwmX0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jqrNURNWos2pP+evbtZQvoFK/RvUFKrbVz9IWMHPL7WWwBPny9rDvpAFmTSS1gUgp4pq9jSePBVhFA2GXpdaHs9HxZ6CbFSb4z2zBqmfwQc4Hgy67YrXa2TXBSsRkBKbRi+plpW1Yop7DkmJ2YTUN6OVAf5iQn+gIw4OAyyQr30= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=rgP6a9lU; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1705948044; bh=5LcgpOOqbLj9qSMEPJ2zpvvrKBU2HoNgldi9XXiwmX0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=rgP6a9lU+BoP0ILl/Vl3hBdqjULkPu9a2J/VUgqK17YN0EOz6A6WCRYYnnPm2J7w6 vrEVuEX8fumCAVC8zc5Lkx6NSAPCLrd1vHMTMKN5tyrF+VXvA6AqbPdFJYvvDVqrVn H5QsCE63Fi2YAj20Ns77Dc69htC1/0VVIT6A01em2mCTwO1YpVADDu1TEzmDTqtzGF jTneemoWOw0T8UtmPPWwAjczT61WJAi4DXMsxB3ms0iPXCd6APkfkgV8APrRY/A7kI EsqqBvzwqLXWfiHeLkApQfrOKZ8bmvgGJa7HPJZOZadB1joTWAKvdH9UMruO6lJ7Bg 7aXoef/eWl17Q== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TJdx81lXRzTQC; Mon, 22 Jan 2024 13:27:24 -0500 (EST) Message-ID: Date: Mon, 22 Jan 2024 13:27:25 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [for-linus][PATCH 1/3] eventfs: Have the inodes all for files and directories all be the same Content-Language: en-US To: Linus Torvalds , Steven Rostedt Cc: Geert Uytterhoeven , Kees Cook , linux-kernel@vger.kernel.org, Masami Hiramatsu , Mark Rutland , Andrew Morton , Christian Brauner , Al Viro , Ajay Kaher References: <20240117143548.595884070@goodmis.org> <20240117143810.531966508@goodmis.org> <20240122100630.6a400dd3@gandalf.local.home> <20240122114743.7e46b7cb@gandalf.local.home> From: Mathieu Desnoyers In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-01-22 13:19, Linus Torvalds wrote: > On Mon, 22 Jan 2024 at 09:39, Linus Torvalds > wrote: >> >> Actually, why not juist add an inode number to your data structures, >> at least for directories? And just do a static increment on it as they >> get registered? >> >> That avoids the whole issue with possibly leaking kernel address data. > > The 'nlink = 1' thing doesn't seem to make 'find' any happier for this > case, sadly. > > But the inode number in the 'struct eventfs_inode' looks trivial. And > doesn't even grow that structure on 64-bit architectures at least, > because the struct is already 64-bit aligned, and had only one 32-bit > entry at the end. > > On 32-bit architectures the structure size grows, but I'm not sure the > allocation size grows. Our kmalloc() is quantized at odd numbers. > > IOW, this trivial patch seems to be much safer than worrying about > some pointer exposure. My only concern about the simple ino_counter static increment is what happens in the unlikely scenario of a 32-bit overflow. This is why I suggested using a bitmap to track inode allocation. It's compact, and we don't care that much about the linear bitmap scan overhead because it's far from being a fast path. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com