Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp1151260lqs; Wed, 6 Mar 2024 07:43:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV90lKbmKg8dmdGVSJUaU0M5xJ0zAgrF4GKiZtw1dYPp5YwOpCEX+lR5+ksnaHan0kC1Zi/bIe/G0mk6jOstqP0nYYjVvVxE0tl2ZkKaQ== X-Google-Smtp-Source: AGHT+IGgG630oi+YEvnCJfqFRSGudQ1Ny4LUijHP+sLlPpgFR9ok4leH51jSuJtIwP/mBOPthZly X-Received: by 2002:a17:90b:4397:b0:29b:6cf:6ed with SMTP id in23-20020a17090b439700b0029b06cf06edmr11589859pjb.24.1709739807016; Wed, 06 Mar 2024 07:43:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709739807; cv=pass; d=google.com; s=arc-20160816; b=cFX6me8VEFQnbRG8bsJyE3IaslcSk8NztcXMQJkh1zIUjFh6trBPnf+57bfC2UIohK yXlTb1xs7J9fMxpFUI7e9cxziHmK4XKTK8eyy2aM3V9zbgHXzxAcclvranrrnRNUeNd+ 8rPfcb8saYoqSM/qKdtryTMi5N/Jyk+lhnZncJBamW8UL2yirjTkEVwkd8XinxzliXUJ 80v+qdkS1p/JZCCT+0kiagKkGkgOIaRlyteTA+B1DNReNU3d+m0TZ0NyF2V52oruCA4m zP805WZFNupHtpaE9Ys3u9qGOu8I7R14duMrJumw9N3yhyeWcRpMroeqi6tU7vRNTd9K P+yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=lmpKyOPFUzJ+LEJ4c5jaCXB0zx3UWJMtP0zgRHJSV20=; fh=Q6nFcXeBAnf74Dgj60BsQqujinPOyAPS026vX6DBnpQ=; b=J2mZhNwdA6BCBRpNlBYVGwUMY4BhNThmUfR4qI4XVh9I0/kbzgjXdNDDTepVWZlkqY 1lF3hp58cF+Sn0+rK8q86GJJR3n+CHOAqfDj4Jet7xoUhHJrlPZ8yRfT2Fayah/H2FlC 91JeUVJazs0CoIJedB2ezVwZHtjmKP492n8Kw44OghnOi02bdRSHaJyrQ7xnSgzduhmG QkiR8mFg5vnEv1AJv64WRHsSEPotL+UDZ07eLnimstXe4qE5PwUOr4XCIS25dB+OmXh0 SDzU8IcPDNUh2pAVqC9CMQjvXSy5PsLnzF37Mb/T7DVmJcsjYsTb+rNFJTa/3NYZYyFy 7Asg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=po9PMpUb; arc=pass (i=1 spf=pass spfdomain=embeddedor.com dkim=pass dkdomain=embeddedor.com); spf=pass (google.com: domain of linux-kernel+bounces-94179-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94179-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 13-20020a170902ee4d00b001dcbcb3f53esi11726156plo.444.2024.03.06.07.43.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 07:43:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94179-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=po9PMpUb; arc=pass (i=1 spf=pass spfdomain=embeddedor.com dkim=pass dkdomain=embeddedor.com); spf=pass (google.com: domain of linux-kernel+bounces-94179-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94179-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 60F7D284F04 for ; Wed, 6 Mar 2024 15:43:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D08613540D; Wed, 6 Mar 2024 15:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=embeddedor.com header.i=@embeddedor.com header.b="po9PMpUb" Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) (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 E6E6C1353F4 for ; Wed, 6 Mar 2024 15:42:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.89.44.39 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709739774; cv=none; b=gKGpeXIZtXIJ0pcO3QsLAXE6ko51VGZFgLiQRgM9EwXhXYdBHyJ+EN7ItIfJsI2Wdjnm4wU8UEbLfOh5aj2yFig0Y7y8tYc/0pGO+IoloPdw6wemTJ7a3BLpqfIw03YbzHNFo6Uj22zURRE0QL6wNCsaaON/Jq+rJW8zX6xOerY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709739774; c=relaxed/simple; bh=L6NtDTi6IxuJr2HEz9+NlQdI/czBfiDG2fLUsEkz3Ws=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VhCBrQr6xW9dXMz2fes482byFT+yoO1QuWuCNlJImLI1JKTrBYTllB8FhGfiiA/nb8IUiY2OE8Iu0Q313vdW3n1J/7DnK/ptd/JXZXLL7wOSIR97JABflI/99tQ3gPs/BqiM2pzKowXuyZVjBhjCxFaob6Tj/S4iyrEQfqzPYOk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=embeddedor.com; spf=pass smtp.mailfrom=embeddedor.com; dkim=pass (2048-bit key) header.d=embeddedor.com header.i=@embeddedor.com header.b=po9PMpUb; arc=none smtp.client-ip=35.89.44.39 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=embeddedor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=embeddedor.com Received: from eig-obgw-5007a.ext.cloudfilter.net ([10.0.29.141]) by cmsmtp with ESMTPS id hsGJrdNMMPM1hhtPwrQVlW; Wed, 06 Mar 2024 15:42:52 +0000 Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with ESMTPS id htPvrsQdWwM25htPwr7Vsj; Wed, 06 Mar 2024 15:42:52 +0000 X-Authority-Analysis: v=2.4 cv=ZP7Rm27b c=1 sm=1 tr=0 ts=65e88efc a=1YbLdUo/zbTtOZ3uB5T3HA==:117 a=VhncohosazJxI00KdYJ/5A==:17 a=IkcTkHD0fZMA:10 a=K6JAEmCyrfEA:10 a=wYkD_t78qR0A:10 a=cm27Pg_UAAAA:8 a=VwQbUJbxAAAA:8 a=6VED1VvVYjxIH-aiRFQA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=xmb-EsYY8bH0VWELuYED:22 a=AjGcO6oz07-iQ99wixmX:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=embeddedor.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=lmpKyOPFUzJ+LEJ4c5jaCXB0zx3UWJMtP0zgRHJSV20=; b=po9PMpUbR2G7GPleV01kCDx0FG 4KF3gs0ABvVJ7iyALWRBsG0EncGjNCUrVEvX5FdPlWlGFktr5FO3ylw206TI6DwTlml15J8xfb6ei 5f/9XzMPQnre/GH874iMFN+/OTBe7toLCN04YHRHotRE7RNZOuyZFTKGaCRel9CQrdwMg8KGKrPMf cQ0Sy/HcmGLDFNx+zZQ1rD+lStj7Ezecvdmg4ytztNR1v5rR9Ub8ewLVxYr7J8uL4YuFHG7n2z9gQ lvLWxCb01Vu87+N6MjBTJOYlHecKC2Lc5NBrP601G1NA2WgpdGID5bu1W30My5F/loENuEi6L4Asw id3pXPzA==; Received: from [201.172.172.225] (port=37704 helo=[192.168.15.10]) by gator4166.hostgator.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96.2) (envelope-from ) id 1rhtPv-000nwp-0p; Wed, 06 Mar 2024 09:42:51 -0600 Message-ID: <34889a1a-4c8f-4c4d-865a-f947569f8d9c@embeddedor.com> Date: Wed, 6 Mar 2024 09:42:50 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH][next] fsnotify: Avoid -Wflex-array-member-not-at-end warning Content-Language: en-US To: Amir Goldstein , Kees Cook Cc: "Gustavo A. R. Silva" , Jan Kara , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <202403051548.045B16BF@keescook> From: "Gustavo A. R. Silva" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 201.172.172.225 X-Source-L: No X-Exim-ID: 1rhtPv-000nwp-0p X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.15.10]) [201.172.172.225]:37704 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 11 X-Org: HG=hgshared;ORG=hostgator; X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfFtxVcf9kTbbstU7V2B4omcDsrF2sFJ2rMc9OC/8fMaFg4lQBrsVFsRDDngeu2hPfFNmagMajYrSA3f1MhQCBowG3a8+2TTTiWTVcpZ8UKXOqvYJTfBn zI9IDV0TEl3CU1arB2YfrlE5Dj0YZN2F0IdZNjZ9+H7EgKXeHYdLEid6rD6QQeLtlNWbIlqKblzhYTXUbFSOQSdV5RckOU8O/Z7gvvwFfVEX+DceGs3XYozQ On 3/6/24 01:36, Amir Goldstein wrote: > On Wed, Mar 6, 2024 at 1:52 AM Kees Cook wrote: >> >> On Tue, Mar 05, 2024 at 04:18:46PM -0600, Gustavo A. R. Silva wrote: >>> -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting >>> ready to enable it globally. >>> >>> There is currently a local structure `f` that is using a flexible >>> `struct file_handle` as header for an on-stack place-holder for the >>> flexible-array member `unsigned char f_handle[];`. >>> >>> struct { >>> struct file_handle handle; >>> u8 pad[MAX_HANDLE_SZ]; >>> } f; >> >> This code pattern is "put a flex array struct on the stack", but we have >> a macro for this now: >> >> DEFINE_FLEX(struct file_handle, handle, f_handle, MAX_HANDLE_SZ); >> >> And you can even include the initializer: >> >> _DEFINE_FLEX(struct file_handle, handle, f_handle, MAX_HANDLE_SZ, >> = { .handle_bytes = MAX_HANDLE_SZ }); >> > > Indeed that looks much nicer. Yeah, I'll probably wait for this to land before I send a v2: https://lore.kernel.org/linux-hardening/20240306010746.work.678-kees@kernel.org/ Thanks -- Gustavo