Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19B77C636CC for ; Tue, 7 Feb 2023 18:04:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231637AbjBGSEw (ORCPT ); Tue, 7 Feb 2023 13:04:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbjBGSEu (ORCPT ); Tue, 7 Feb 2023 13:04:50 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D47103C37; Tue, 7 Feb 2023 10:04:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E89E6CE1DF8; Tue, 7 Feb 2023 18:04:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09E2FC433EF; Tue, 7 Feb 2023 18:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675793086; bh=0VKQjQe3KQPYT8I06awoNqRWHvEBpTHUM2gBgH+dJSo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZYwaqJlBHig9pGugf90EYJfVdpnBpKabm3D56UMPURs6dquPFL57mxG4z7Jaeu9eC ohWjrDbOy85u3OT7rxQumcLwiSwBtyna0IPICP34vj2deCfwdGftyekEc+Uo7TqUXO PrlBrw0yLrkOsoPBD083QTn8hLrCpFHIZHgArzd4KpboKZlKgqvam/uwgGAV+EqLoW siBw2bO3yd2PB2DgdLb60Cd3pieRzPTwwdbZA0O9els/8DfKqFryg3pDa4ZSaJ00ie 6wZyweikC+523F09krogC9Xy2BX7YHAeZRoQRPwMRFf6cYXN6q9esVUHltGsNQDIlv pAPSn4Eso2MwQ== Date: Tue, 7 Feb 2023 18:04:44 +0000 From: Eric Biggers To: Dawei Li 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 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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