From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 695686FBF; Thu, 28 Sep 2023 18:01:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6C1DC433C7; Thu, 28 Sep 2023 18:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695924109; bh=EAdPFsmHcyWayc69u1pNQGVN/Od37LMkwOOQtSvFBiM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=bfK28RLdLGgKZCUgDzeWTBKaqWs6brrGRaSyPdFXskOVm0On6PlLojE5M/xCgEEY5 grpUMo2uaqDtijMvKbHWfOGFJG+vQA/tkSyBcl6qHWL3dn3aU/KYO5L4q/l83Nz1PF rjm7ECl0slpI4oU4YRq3Il4iqcNMzLzfgVWdoz5lG6ZAiTp3N12KGI95ZvFcFMlTR+ jbG318WOr9JpuRBEryTb1XBxjEr4Jw9k8E4/FfV1BqWFd1k5jtZEs5n6naq0zoe6ze HRJ/cpQFseJro5/YEKgl8SVwodWHkLRLpC8H6rkjRLoCIio3JUF68vh6UiBMp7cQEp W7opbVnaB1VbA== Message-ID: <00ca2e3997cc86401f7fb65d936fe5403abd5627.camel@kernel.org> Subject: Re: [PATCH 87/87] fs: move i_blocks up a few places in struct inode From: Jeff Layton To: Linus Torvalds Cc: Alexander Viro , Christian Brauner , David Sterba , Amir Goldstein , Theodore Ts'o , Eric Biederman , Kees Cook , Jeremy Kerr , Arnd Bergmann , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Greg Kroah-Hartman , Arve =?ISO-8859-1?Q?Hj=F8nnev=E5g?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Mattia Dongili , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Brad Warrum , Ritu Agarwal , Hans de Goede , Ilpo =?ISO-8859-1?Q?J=E4rvinen?= , Mark Gross , Jiri Slaby , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Sterba , David Howells , Marc Dionne , Ian Kent , Luis de Bethencourt , Salah Triki , "Tigran A. Aivazian" , Chris Mason , Josef Bacik , Xiubo Li , Ilya Dryomov , Jan Harkes , coda@cs.cmu.edu, Joel Becker , Christoph Hellwig , Nicolas Pitre , "Rafael J. Wysocki" , Ard Biesheuvel , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Namjae Jeon , Sungjong Seo , Jan Kara , Andreas Dilger , Jaegeuk Kim , OGAWA Hirofumi , Christoph Hellwig , Miklos Szeredi , Bob Peterson , Andreas Gruenbacher , Richard Weinberger , Anton Ivanov , Johannes Berg , Mikulas Patocka , Mike Kravetz , Muchun Song , Jan Kara , David Woodhouse , Dave Kleikamp , Tejun Heo , Trond Myklebust , Anna Schumaker , Chuck Lever , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Ryusuke Konishi , Anton Altaparmakov , Konstantin Komarov , Mark Fasheh , Joseph Qi , Bob Copeland , Mike Marshall , Martin Brandenburg , Luis Chamberlain , Iurii Zaikin , Tony Luck , "Guilherme G. Piccoli" , Anders Larsen , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Sergey Senozhatsky , Phillip Lougher , Steven Rostedt , Masami Hiramatsu , Evgeniy Dushistov , Chandan Babu R , "Darrick J. Wong" , Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Hugh Dickins , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , Eric Paris , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-rdma@vger.kernel.org, linux-serial@vger.kernel.org, linux-usb@vger.kernel.org, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, autofs@vger.kernel.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-efi@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, gfs2@lists.linux.dev, linux-um@lists.infradead.org, linux-mtd@lists.infradead.org, jfs-discussion@lists.sourceforge.net, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, linux-karma-devel@lists.sourceforge.net, devel@lists.orangefs.org, linux-unionfs@vger.kernel.org, linux-hardening@vger.kernel.org, reiserfs-devel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-trace-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Date: Thu, 28 Sep 2023 14:01:33 -0400 In-Reply-To: References: <20230928110554.34758-1-jlayton@kernel.org> <20230928110554.34758-3-jlayton@kernel.org> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Thu, 2023-09-28 at 10:41 -0700, Linus Torvalds wrote: > On Thu, 28 Sept 2023 at 04:06, Jeff Layton wrote: > >=20 > > Move i_blocks up above the i_lock, which moves the new 4 byte hole to > > just after the timestamps, without changing the size of the structure. >=20 > I'm sure others have mentioned this, but 'struct inode' is marked with > __randomize_layout, so the actual layout may end up being very > different. >=20 > I'm personally not convinced the whole structure randomization is > worth it - it's easy enough to figure out for any distro kernel since > the seed has to be the same across machines for modules to work, so > even if the seed isn't "public", any layout is bound to be fairly > easily discoverable. >=20 > So the whole randomization only really works for private kernel > builds, and it adds this kind of pain where "optimizing" the structure > layout is kind of pointless depending on various options. >=20 > I certainly *hope* no distro enables that pointless thing, but it's a wor= ry. >=20 I've never enabled struct randomization and don't know anyone who does. I figure if you turn that on, you get to keep all of the pieces when you start seeing weird performance problems. I think that we have to optimize for that being disabled. Even without that though, turning on and off options can change the layout...and then there are different arches, etc. I'm using a config derived from the Fedora x86_64 kernel images and hope that represents a reasonably common configuration. The only conditional members before the timestamps are based on CONFIG_FS_POSIX_ACL and CONFIG_SECURITY, which are almost always turned on with most distros. --=20 Jeff Layton