From patchwork Sat Nov 25 21:49:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 169801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2173174vqx; Sat, 25 Nov 2023 13:55:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3EqjucpksYxDlFwGnQ0vsqCGbGd9DX1HyYUe7M55PBwAuocMezOxeZSUN6WiODIF9FrrT X-Received: by 2002:a17:902:c10c:b0:1cf:7cfc:c39b with SMTP id 12-20020a170902c10c00b001cf7cfcc39bmr9293485pli.7.1700949329144; Sat, 25 Nov 2023 13:55:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700949329; cv=none; d=google.com; s=arc-20160816; b=yY6v2BiOjxfGQxkm4lZikUiywyg0QOjf7LclMjudbqCEGxC5LS+b0HECn64P30vwLt BPw/VF5WFwtGlmPYWWBydQ5wCrdAOO3ioGf566L0pllGH7R8Ikf9dSFwCaFuPenTFzKX /MO2UQcdHYfMeQ6WCpHEuvtIQQJOE+n1F5WwO99CR/4Fug6YsUsQVUSNeLpK7Q3+xYsx 4myJfojxRDUWv7WFoXqeitA6u4+9UywY6hi7lI85AQzKJibPl/gPtF8SQDMhvLdiXjyC PLPUNYCtX38P2IQ2ub36g5DpevZ2cVdGv8t1e1QrQqxMrP2cl2fM43hlaQOcpGpDchjT 3AqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=lGXCACIM+h5kjv/q3OSbszjeArbBMy6yB1TPBpx6yWc=; fh=7wmdA1qVHgrlnv2ZDExOJR9m0dU1O1M8Q1IBS1FwPzk=; b=0qky3ywiahvQ60Z0DkxaotUIDbRggBOxoNFGv/DIFLhgGR6Hg/TKpG3AkMaz6W8p/B YwgC5iLMe0i0Q470XAwpX3xQ8PI0IcuWq+d4Efh93x7ocm8j4GNlsbMfSvv9yv9y4C9I L73LsGu51pWVL1f0N2i1tDCOLxgZHnuo8hJeZkI92lIvAQ86kzrrVGVsr88JOL3ASPg4 RDeVM8Ycl6tmXjl3XaKq+ZnRylR8B1wW6GQnF6ix1FSiCXVkRH3zzIbZ1h512ziUpGDB kwGSjRtcFslxcA/BnD0RAV1IwznNMGvNf6piNhHimca9GpTYCdHz9KcbKYSy/nd1yDni 4FtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p5EdWPOv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id ju17-20020a170903429100b001cfa55f95absi3970689plb.515.2023.11.25.13.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 13:55:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p5EdWPOv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 09D758076CB3; Sat, 25 Nov 2023 13:55:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229511AbjKYVtK (ORCPT + 99 others); Sat, 25 Nov 2023 16:49:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjKYVtJ (ORCPT ); Sat, 25 Nov 2023 16:49:09 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6C15101 for ; Sat, 25 Nov 2023 13:49:16 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65BBFC433C7; Sat, 25 Nov 2023 21:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700948956; bh=p01SNS2qZBDCVzSPkDLOFpFyded+GzvCX/9pasvl/5c=; h=Date:From:To:Cc:Subject:From; b=p5EdWPOv9u1qJKMRE6lTDg9F6QiT6VyEGHnF+Dw7bajfbIxE1aBNMa0pu3hCgJeHy uO+wXDbs6TC7LsZfDiQK/yGaL77QXcrH0ik5rJdbdFiVnjTTqLKfne2hQcV8UIBQZ3 1Cp5pPT+FXaP7AgvT7AnRJLgVhz4tQIzFu/X8j7NzTVP9jPKEFjrMgjm53gHDg1xxG SV/6GuBLu3j1u9jjN+/yNHvMrU2t3zSHRMHlFgfrm1WvX/C+LsRDKN1hv+TrJ0GHfm xnsIBiTzc5m8Nrn9GWPiXQvp89uCxZm00UmC7mMUQI+a8pnSPZOHzlPWgf6LohPEmS HFwZaNWeT8Zzg== Date: Sat, 25 Nov 2023 15:49:12 -0600 From: "Gustavo A. R. Silva" To: Kees Cook Cc: linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH][next] gcc-plugins: randstruct: Update code comment in relayout_struct() Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sat, 25 Nov 2023 13:55:26 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783574643753181300 X-GMAIL-MSGID: 1783574643753181300 Update code comment to clarify that the only element whose layout is not randomized is a proper C99 flexible-array member. This update is complementary to commit 1ee60356c2dc ("gcc-plugins: randstruct: Only warn about true flexible arrays") Signed-off-by: Gustavo A. R. Silva --- scripts/gcc-plugins/randomize_layout_plugin.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/gcc-plugins/randomize_layout_plugin.c b/scripts/gcc-plugins/randomize_layout_plugin.c index 910bd21d08f4..746ff2d272f2 100644 --- a/scripts/gcc-plugins/randomize_layout_plugin.c +++ b/scripts/gcc-plugins/randomize_layout_plugin.c @@ -339,8 +339,7 @@ static int relayout_struct(tree type) /* * enforce that we don't randomize the layout of the last - * element of a struct if it's a 0 or 1-length array - * or a proper flexible array + * element of a struct if it's a proper flexible array */ if (is_flexible_array(newtree[num_fields - 1])) { has_flexarray = true;