Thread (24 messages) 24 messages, 10 authors, 2023-10-01

Re: [PATCH 87/87] fs: move i_blocks up a few places in struct inode

From: Jeff Layton <jlayton@kernel.org>
Date: 2023-09-28 18:01:55
Also in: autofs, bpf, ceph-devel, gfs2, linux-btrfs, linux-cifs, linux-efi, linux-ext4, linux-f2fs-devel, linux-fsdevel, linux-hardening, linux-mm, linux-nfs, linux-rdma, linux-s390, linux-security-module, linux-serial, linux-trace-kernel, linux-um, linux-unionfs, linux-usb, linux-xfs, lkml, netdev, ntfs3, ocfs2-devel, platform-driver-x86, selinux, v9fs

On Thu, 2023-09-28 at 10:41 -0700, Linus Torvalds wrote:
On Thu, 28 Sept 2023 at 04:06, Jeff Layton [off-list ref] wrote:
quoted
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.
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.

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.

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.

I certainly *hope* no distro enables that pointless thing, but it's a worry.
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.
-- 
Jeff Layton [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help