From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3BD22C2BD09 for ; Fri, 28 Jun 2024 14:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8Iy9UTF+2cix8fJn+GOJgAFhj+ncoQvHE0SUu1Zpe+M=; b=DLfjvDw3zsqqNt2H+0SOyY2xso K4uffh8iVFBjzJJvCRnChksPI2PiYMi2uKHLhx/QE3edOmtgmInr8bXv0TYkQycSEsDL+DhADUH9O CwZDoqCV7d785fUAwafRFd88Y1J1KIWFnWWuC0av5emdEmiSK3Ugyssds+kZm+2UNq6Skvivxyhs0 vwPiEjmLRRN+f+OF3bghM3V0FFsRiiWxHd0aCaVy0rSWiIre/9oQ0Wql3EDxMmARNgk5EoZAPa6/L 2AeMhWX9zwWRmnrqeIv7rNtJomiocnnJIKTrXm0R1L9Vl7qThi3SzwvREf7v8+Bwg3JGFzWivvAbS yabMzI5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNCds-0000000E1fJ-0KeL; Fri, 28 Jun 2024 14:32:00 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNCdi-0000000E1dU-2wc7 for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 14:31:52 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 088C862199; Fri, 28 Jun 2024 14:31:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ED4CC116B1; Fri, 28 Jun 2024 14:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1719585108; bh=Mn07VvKw7mIUWBJQd1Z/D4eKm3Eed4gC7mHD2nA7nZk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uYw4G9Hc3xl4Vbt5ovsjvHdfoWUMxAGwl/Zzp0n2pPdqpH8YO5F6EWeTv41FRhZ2D 5vD7GRu20BwWsvfZBCUuFngSUpRC5lBulPDRO1LoFjE7MQjA6SkqtF0GhCltcp9773 tlPPV/G1DC/LOqOYrL508bdEsxVfHV2ljqpz3yyE= Date: Fri, 28 Jun 2024 16:31:46 +0200 From: Greg Kroah-Hartman To: Kees Cook Cc: Jiri Slaby , Nathan Chancellor , "Gustavo A. R. Silva" , Bill Wendling , Justin Stitt , linux-serial@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, stable@vger.kernel.org Subject: Re: [PATCH] tty: mxser: Remove __counted_by from mxser_board.ports[] Message-ID: <2024062800-doodle-pelvis-4798@gregkh> References: <20240529-drop-counted-by-ports-mxser-board-v1-1-0ab217f4da6d@kernel.org> <202406271009.4E90DF8@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202406271009.4E90DF8@keescook> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_073150_838957_0B613BDE X-CRM114-Status: GOOD ( 25.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jun 27, 2024 at 10:14:05AM -0700, Kees Cook wrote: > On Wed, May 29, 2024 at 02:29:42PM -0700, Nathan Chancellor wrote: > > Work for __counted_by on generic pointers in structures (not just > > flexible array members) has started landing in Clang 19 (current tip of > > tree). During the development of this feature, a restriction was added > > to __counted_by to prevent the flexible array member's element type from > > including a flexible array member itself such as: > > > > struct foo { > > int count; > > char buf[]; > > }; > > > > struct bar { > > int count; > > struct foo data[] __counted_by(count); > > }; > > > > because the size of data cannot be calculated with the standard array > > size formula: > > > > sizeof(struct foo) * count > > > > This restriction was downgraded to a warning but due to CONFIG_WERROR, > > it can still break the build. The application of __counted_by on the > > ports member of 'struct mxser_board' triggers this restriction, > > resulting in: > > > > drivers/tty/mxser.c:291:2: error: 'counted_by' should not be applied to an array with element of unknown size because 'struct mxser_port' is a struct type with a flexible array member. This will be an error in a future compiler version [-Werror,-Wbounds-safety-counted-by-elt-type-unknown-size] > > 291 | struct mxser_port ports[] __counted_by(nports); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > > 1 error generated. > > > > Remove this use of __counted_by to fix the warning/error. However, > > rather than remove it altogether, leave it commented, as it may be > > possible to support this in future compiler releases. > > > > Cc: stable@vger.kernel.org > > Closes: https://github.com/ClangBuiltLinux/linux/issues/2026 > > Fixes: f34907ecca71 ("mxser: Annotate struct mxser_board with __counted_by") > > Signed-off-by: Nathan Chancellor > > Since this fixes a build issue under Clang, can we please land this so > v6.7 and later will build again? Gustavo is still working on the more > complete fix (which was already on his radar, so it won't be lost). > > If it's easier/helpful, I can land this via the hardening tree? I was > the one who sent the bad patch originally. :) > I don't see this in my queue anywhere, sorry, can you resend it? Or feel free to take it through your trees, no objection from me there. thanks, greg k-h