Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3988518iog; Tue, 28 Jun 2022 06:57:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v6e4TUiihKdYP2kjj0Z6rpRWOQP2vRKmac6PY2x9ofKRHRYbovy7QEJL2APMMxhyrfX2ea X-Received: by 2002:a17:90b:350f:b0:1ed:4d69:75f3 with SMTP id ls15-20020a17090b350f00b001ed4d6975f3mr17879607pjb.17.1656424632104; Tue, 28 Jun 2022 06:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656424632; cv=none; d=google.com; s=arc-20160816; b=hQ1LAQBWrCHyR5tym2TJyzePBUozxEopuIREPrztAXvyB8UQq2iF3qPan1VMclQSTf tFjBjrA7/WyyLSEJ5HDaVNjZ0xnXKc2rOBnOVC84JCp0+kVQDcXERGC2vpL8SP4ozcK/ S+JZouD3qQ9IJLnFSE97yeNc81KwRW8ZalmhGwApUZKc9U6XqDUnWEYbAy/qXHSt2GhA EvWGukl8fiO+dKfrXziQw0X57adlRQnWws/jigbvQDhyKhDMeNeFR7/PoZ2feroXfB/C duEBVpN/6SL3h1D0f247IWKFbkrB6LnkUJqSXx8C+IHVq9l59D4dc31bJY6AisO5Y4jR aK9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gN4ZNyT9GRZ46Vwx3CUzNgwGxKE3ptwelsb3O/2waMc=; b=O2nVIcpfRH/5m0SHdOZhZehQDInhqHtkc56Oyc9EJD9WRADVrVcfpRLYf+qz+aaG/A wc6HnefXiRUNV1dGC4fy+ilGC0EOt9j9XBoHR146amNHgi2qQ+f2R7QinteeWeR8vQg3 K6oMQgU1UBQPMgHQFzdoQTGK+a0mqtpRNfjVsAnWhM3GssU/de9COMhI/9/AFR2pb6FH lrwbJ5zhFycAWu66TxBRaBF5ZXv/joPRdm6jkZXUYSfcgeJRe9OSTMr4IROjUVQDpYhA ijyOxx0YDCiLGQl45Kl1wJecMgzTMAzhhbdehsbKnAAjRNwpfhOVs5uKn7RNGlkRQWsI aBYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=SRPS2zIE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s29-20020a63451d000000b0040cf53f9b98si18385071pga.226.2022.06.28.06.56.59; Tue, 28 Jun 2022 06:57:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=SRPS2zIE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346751AbiF1NhW (ORCPT + 99 others); Tue, 28 Jun 2022 09:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346628AbiF1NhA (ORCPT ); Tue, 28 Jun 2022 09:37:00 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB9EC2BB09 for ; Tue, 28 Jun 2022 06:36:54 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id n15so19876487qvh.12 for ; Tue, 28 Jun 2022 06:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=gN4ZNyT9GRZ46Vwx3CUzNgwGxKE3ptwelsb3O/2waMc=; b=SRPS2zIET11DP06FAnMANUW30rX+F+KLnmvgpItTZuHDiHMYbx191l+udZ0BIKVo+p DUqKNFcRnPxEdciA9v/rjMoUuUABeinU5a59o91m7mO0ei+LjGwfeqP1sFK6bST4r2Sc +kwNrequilw+r3whlSvEqjUrw7uEou8aBEv26lUqmckZs7QEO1gxqNAIdKmR6ixdoBBW VwXL+VitONeiHER4+6czyOuvux/gSa01CsajOGl6xQeKgTZdOU9/PF5ai6yeP3/8Na6A VkyCaiWAoLiX3IML+rZ/qAH9obhof6Stg3VEpk4n7D6sOfmWV6A4zI2itZ9nI+NyrBEn GAtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=gN4ZNyT9GRZ46Vwx3CUzNgwGxKE3ptwelsb3O/2waMc=; b=ItcgrWLb/291Va8zmrkEmtQ9XF+Iz0C6ghdjz9x9Tz1TKklVprTPyVGOauY0QqqX2R 9U1slEMdpbXNF7KWYt9oh9vO6wmYGi6d0s3K8w3u/GP97lu/q+Sqddvr6ISOU9dTK820 +980NRYWzd6V1cV69pV/FFhTMshZQfTj8Loai9gT6Q538p7zTbyuBIOzkFsB4XPMj8IY Fu3tByobN9XMt3kyY3WdwhFjjF/HRM9pYkytM9v77F1ZZuBghc0ZSKFcDSqxF6ylp1fH WjbextzCtq1AskiHaq6J6bsrp31TlXJtxJnFzlnagx+4mLx3ErvcCW5AbS3jRBByo3Ze Wylg== X-Gm-Message-State: AJIora+t+3+XOLfEt8hxUvsS1xIMKcxW5gzcJX2AZFyHgdJN6PQ8jUX7 aMRWHnEEhhSjOki0oGgciLYQCA== X-Received: by 2002:ac8:5b0d:0:b0:31b:f519:4107 with SMTP id m13-20020ac85b0d000000b0031bf5194107mr1237416qtw.331.1656423413317; Tue, 28 Jun 2022 06:36:53 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id s10-20020a05620a29ca00b006a79479657fsm708363qkp.108.2022.06.28.06.36.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 06:36:52 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1o6BOd-002vAA-VA; Tue, 28 Jun 2022 10:36:51 -0300 Date: Tue, 28 Jun 2022 10:36:51 -0300 From: Jason Gunthorpe To: "Gustavo A. R. Silva" Cc: Daniel Borkmann , Kees Cook , linux-kernel@vger.kernel.org, x86@kernel.org, dm-devel@redhat.com, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-can@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux1394-devel@lists.sourceforge.net, io-uring@vger.kernel.org, lvs-devel@vger.kernel.org, linux-mtd@lists.infradead.org, kasan-dev@googlegroups.com, linux-mmc@vger.kernel.org, nvdimm@lists.linux.dev, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-perf-users@vger.kernel.org, linux-raid@vger.kernel.org, linux-sctp@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-usb@vger.kernel.org, virtualization@lists.linux-foundation.org, v9fs-developer@lists.sourceforge.net, linux-rdma@vger.kernel.org, alsa-devel@alsa-project.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members Message-ID: <20220628133651.GO23621@ziepe.ca> References: <20220627180432.GA136081@embeddedor> <6bc1e94c-ce1d-a074-7d0c-8dbe6ce22637@iogearbox.net> <20220628004052.GM23621@ziepe.ca> <20220628005825.GA161566@embeddedor> <20220628022129.GA8452@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220628022129.GA8452@embeddedor> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 28, 2022 at 04:21:29AM +0200, Gustavo A. R. Silva wrote: > > > Though maybe we could just switch off -Wgnu-variable-sized-type-not-at-end during configuration ? > We need to think in a different strategy. I think we will need to switch off the warning in userspace - this is doable for rdma-core. On the other hand, if the goal is to enable the array size check compiler warning I would suggest focusing only on those structs that actually hit that warning in the kernel. IIRC infiniband doesn't trigger it because it just pointer casts the flex array to some other struct. It isn't actually an array it is a placeholder for a trailing structure, so it is never indexed. This is also why we hit the warning because the convient way for userspace to compose the message is to squash the header and trailer structs together in a super struct on the stack, then invoke the ioctl. Jason