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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 E62E5E732E3 for ; Thu, 28 Sep 2023 15:17:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9410110E679; Thu, 28 Sep 2023 15:17:10 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id EDF1610E67E; Thu, 28 Sep 2023 15:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; 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=trot3+TGWG2OOMY4ChPeFe3zf2LJzFBVfmF3pbXC7Xo=; b=higqqnDmzxmr+X3cfpKInvzj3o BqvWpQGHvH67nWnfc0XAoOqx9PXGwtMHNh9pxk0oebmPzjEX7R+4f1blAH9+4S5qw796Lv7aWaopn OPEn6RhhEua/OPFIH6MXBzs3xY7lHtUt4TfCx9LWA934JiaFnKl0qFh0Ub9wyXDq+MkAtH+KdS4Fs iT7lhSmKl2qB1wdOkkBOoUayyFaiRkkAAvxfl1txVMTS8BQaJQ6dwujlhoA/q8pHzkc5mItIlOlSp DNC4wfQi03pP2QScb9qLX4GTmyrx8Ej+PdIPFaND/La/DZ03zb1Y7aNBQFiRh8eLvGG0z1FOzaW4j Y90I6VGQ==; Received: from [177.34.168.16] (helo=[192.168.0.8]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1qlskm-009K4n-35; Thu, 28 Sep 2023 17:16:36 +0200 Message-ID: <708d9fa0-0957-796a-ecc1-9ad4fdae6339@igalia.com> Date: Thu, 28 Sep 2023 12:16:16 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: Kees Cook , David Airlie References: <20230922173110.work.084-kees@kernel.org> <20230922173216.3823169-9-keescook@chromium.org> From: Maira Canal In-Reply-To: <20230922173216.3823169-9-keescook@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Intel-gfx] [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Karol Herbst , Tom Rix , llvm@lists.linux.dev, dri-devel@lists.freedesktop.org, Chris Wilson , Prike Liang , Huang Rui , Gerd Hoffmann , Andrzej Hajda , Marijn Suijten , Evan Quan , Emma Anholt , amd-gfx@lists.freedesktop.org, Kuogee Hsieh , VMware Graphics Reviewers , Ben Skeggs , nouveau@lists.freedesktop.org, David Airlie , Alex Deucher , Lijo Lazar , Yifan Zhang , linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, Kevin Wang , Abhinav Kumar , Maxime Ripard , Nathan Chancellor , Le Ma , Gurchetan Singh , Rodrigo Vivi , virtualization@lists.linux-foundation.org, Neil Armstrong , Xiaojian Du , Lang Yu , Bjorn Andersson , Nick Desaulniers , linux-kernel@vger.kernel.org, Hawking Zhang , Melissa Wen , Dmitry Baryshkov , Nirmoy Das , freedreno@lists.freedesktop.org, =?UTF-8?Q?Christian_K=c3=b6nig?= , linux-hardening@vger.kernel.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Hi Kees, On 9/22/23 14:32, 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 v3d_perfmon. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Emma Anholt > Cc: Melissa Wen > Cc: David Airlie > Cc: Daniel Vetter > Cc: dri-devel@lists.freedesktop.org > Signed-off-by: Kees Cook Reviewed-by: Maíra Canal Best Regards, - Maíra > --- > drivers/gpu/drm/v3d/v3d_drv.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h > index 7f664a4b2a75..106454f28956 100644 > --- a/drivers/gpu/drm/v3d/v3d_drv.h > +++ b/drivers/gpu/drm/v3d/v3d_drv.h > @@ -59,7 +59,7 @@ struct v3d_perfmon { > * values can't be reset, but you can fake a reset by > * destroying the perfmon and creating a new one. > */ > - u64 values[]; > + u64 values[] __counted_by(ncounters); > }; > > struct v3d_dev {