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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 863A0CE7A86 for ; Fri, 22 Sep 2023 21:58:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbjIVV6G (ORCPT ); Fri, 22 Sep 2023 17:58:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbjIVV6F (ORCPT ); Fri, 22 Sep 2023 17:58:05 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BB37CA; Fri, 22 Sep 2023 14:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=34Jgc2qKDQ7wZQCdQoB+y51xg6Z4aiKgekUDpK+B2q0=; b=xbClNM2ZujAWPSEjhHMFgl7DgQ j0dHNcmvLgtvUpx4pPQ/1hPRDD3mx6KZQwcElTzta9vpWqrUJirWpx84mQP55EoXkIMkx7adAPhBo Hu4OVyiOj1XpObdJoWnHR/j1ZM9lF/rnkSnWU7u0nRXLW92rgFqgRaEdU9xTzeY6RzP0UJvrAcrgb ov46fTdVQ8DjIg8aMVQtUL3w4lJjjcNfOf/6eiSgVYo4/cXp3RZHOikHC8tQyUUlzlsrgk+HfzKFE 9VsqMBRo7OV6ZDHmGs1uIhT5CS+jELqM+kGDuRrs4Y6MMiPvkVHYM8ZMyXDxPzw+W5OBI/vxBQeio ufSgba4g==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qjo9s-009sqR-2p; Fri, 22 Sep 2023 21:57:56 +0000 Date: Fri, 22 Sep 2023 14:57:56 -0700 From: Luis Chamberlain To: Kees Cook Cc: linux-modules@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH] module: Annotate struct module_notes_attrs with __counted_by Message-ID: References: <20230922175253.work.237-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230922175253.work.237-kees@kernel.org> Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 22, 2023 at 10:52:53AM -0700, Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > As found with Coccinelle[1], add __counted_by for struct module_notes_attrs. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Luis Chamberlain > Cc: linux-modules@vger.kernel.org > Signed-off-by: Kees Cook Thanks, applied and pushed! Luis