public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Dawei Li <set_pte_at@outlook.com>
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs: remove obsolete comments on member ordering of random layout struct
Date: Tue, 7 Feb 2023 18:04:44 +0000	[thread overview]
Message-ID: <Y+KSvGl1rPYbMFar@gmail.com> (raw)
In-Reply-To: <TYCP286MB2323C8F54CB121755B83F5D9CADB9@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM>

On Tue, Feb 07, 2023 at 09:14:08PM +0800, Dawei Li wrote:
> Structures marked with __randomize_layout are supposed to reorder layout
> of members randomly. Although layout is not guranteed to be reordered
> since dependency on hardening config, but let's not make assumption such
> as "member foo is first".
> 
> Signed-off-by: Dawei Li <set_pte_at@outlook.com>
> ---
>  include/linux/fs.h | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index c1769a2c5d70..9114c4e44154 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -585,11 +585,6 @@ is_uncached_acl(struct posix_acl *acl)
>  
>  struct fsnotify_mark_connector;
>  
> -/*
> - * Keep mostly read-only and often accessed (especially for
> - * the RCU path lookup and 'stat' data) fields at the beginning
> - * of the 'struct inode'
> - */
>  struct inode {
>  	umode_t			i_mode;
>  	unsigned short		i_opflags;
> @@ -1471,7 +1466,7 @@ struct sb_writers {
>  };
>  
>  struct super_block {
> -	struct list_head	s_list;		/* Keep this first */
> +	struct list_head	s_list;

If these comments are just talking about how the fields are arranged for best
performance (the inode comment definitely is; the super_block one is a bit
ambiguous), rather than for correctness, they are perfectly fine to keep.  It
still makes sense to do those sort of manual structure layout optimizations on
commonly used structures like these, because they still benefit everyone who
doesn't have CONFIG_RANDSTRUCT enabled (i.e., almost everyone).

- Eric

      reply	other threads:[~2023-02-07 18:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 13:14 [PATCH] fs: remove obsolete comments on member ordering of random layout struct Dawei Li
2023-02-07 18:04 ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+KSvGl1rPYbMFar@gmail.com \
    --to=ebiggers@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=set_pte_at@outlook.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox