Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp3081584rdb; Fri, 22 Sep 2023 18:41:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGf6S2V9A//XxHharHaKxmNsJU0cf518nKA7WZ/MBTmoPvhDH0zNF64NKZDnoC9BE8ZRTXL X-Received: by 2002:a17:902:7049:b0:1c5:cd1c:46fa with SMTP id h9-20020a170902704900b001c5cd1c46famr1024270plt.36.1695433312390; Fri, 22 Sep 2023 18:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695433312; cv=none; d=google.com; s=arc-20160816; b=z3B4SsMKzG/QGoELje0McvRvuY2l/AMsN4H1IqBoa+uDHECdRYsMsivD2eMbVSzgKv dWyj6Kvqv7Y/Cyu6SsSQtwj2t9Vunrt5g9voWIFc8Yu+F5SkRrUFiwfAXK/pGupzU6sG JoEZ3l4RUOiluQSOubLrbXWkvUXVuRXG/HXlCqHrtTES86HWnuRUpW3lrQL6X9QLHEj6 rOgsfcTI/9De14+eVjAlobgHiR6UIxGjfCOdAXGryGDpeMyEioPHg75IoiAMuvWlkizL MHwTaUogBQ/4FZ3Dq+CvoA1FWqfopXBrBLURbVCCtJbiD2G5N76GoJ79huR45cOGGDnG xZ/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=26mug2OgFJgVqTLezDBhTB27nouTOVCr4w9qfN76dRA=; fh=qEpB3VTfVn7Pu2ebbwnS5+mZW9Hv5efgZKH7MCF13XM=; b=EQq6CVcqV+0gsTfVPcNhSVWMWLfKfy66LsuVMehl9vcUhkPwh+jkGt58TQqvAri6T/ 6QagCk5Gt6tkl7vragdERQDLw/JtUuU0g3lWHTvTSqK1vP1QzgVMpujNHvx90YQRmtL5 IC2PeFqzt20cb52KUfskRkbzT7+wXxMiRO7tx5Nr0Xv+6VumLtLFl9D+yv5NsSzPvOrD hF0mFfEZ0JDg1uFKQ2un/FHmOV+DJaFiiiNj1t/lmhQm/PrpT9Njp2+r8+LlrZPq4Zer e5FAayBJwCIyIhKonM9f0HHG0/0OlQE9jQlEWL6L65LCj3t/6bxOajP4DDMGoHngfoWq vqDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=gWUmwGML; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id lb14-20020a170902fa4e00b001c4743e4a60si4738603plb.197.2023.09.22.18.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 18:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=gWUmwGML; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id A8E4284A9771; Fri, 22 Sep 2023 18:41:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230337AbjIWBls (ORCPT + 99 others); Fri, 22 Sep 2023 21:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjIWBlq (ORCPT ); Fri, 22 Sep 2023 21:41:46 -0400 Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB3651A8; Fri, 22 Sep 2023 18:41:40 -0700 (PDT) Received: from eig-obgw-6010a.ext.cloudfilter.net ([10.0.30.248]) by cmsmtp with ESMTP id jq43qu56eEoVsjreOqFZBP; Sat, 23 Sep 2023 01:41:40 +0000 Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with ESMTPS id jreNqDMJSySCujreNqUCUr; Sat, 23 Sep 2023 01:41:39 +0000 X-Authority-Analysis: v=2.4 cv=ea8uwpIH c=1 sm=1 tr=0 ts=650e4253 a=1YbLdUo/zbTtOZ3uB5T3HA==:117 a=P7XfKmiOJ4/qXqHZrN7ymg==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=zNV7Rl7Rt7sA:10 a=wYkD_t78qR0A:10 a=NEAV23lmAAAA:8 a=-VAfIpHNAAAA:8 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=e5mUnYsNAAAA:8 a=cm27Pg_UAAAA:8 a=HvF037n1xESchLcPDVoA:9 a=QEXdDO2ut3YA:10 a=srlwD-8ojaedGGhPAyx8:22 a=AjGcO6oz07-iQ99wixmX:22 a=Vxmtnl_E_bksehYqCbjh:22 a=xmb-EsYY8bH0VWELuYED: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=26mug2OgFJgVqTLezDBhTB27nouTOVCr4w9qfN76dRA=; b=gWUmwGML3LS+6SgXzjEE2Nv0zY 6WvEyyE/D9r5aCj97Qk0hU44T53pcFDfJ0WyOiS/y/dodQv4zYLJWZVtBZg6aROkxEqiqHxWMAJ61 +bd/LUHoDPJN5875L0nhhFj064A/XItWKFZvpwztqirYg9Wo8HlyZHMRGa2FXndjO5z3QOeEehb5x 9pWKegwGcf6NwBGOyvfvUpoFR09ZCPES7oKwjP54v2sT2Oga4jwYCdhMiQe75/Xvu5af1uayGh/Zi LcKlz1Qa7HgfYM4nH9rvd6EoSM6xQwXtEMS+kzdzm26iBfpWyzv/7s9+4bmv2+xTf8q41SvM9G7GE L+885mkQ==; Received: from [94.239.20.48] (port=50846 helo=[192.168.1.98]) by gator4166.hostgator.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1qjkgW-000Qi0-2c; Fri, 22 Sep 2023 13:15:24 -0500 Message-ID: <75f4a4fa-a177-db4a-4653-f121a1e54141@embeddedor.com> Date: Fri, 22 Sep 2023 20:16:16 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by Content-Language: en-US To: Kees Cook , David Airlie Cc: Emma Anholt , Maxime Ripard , Daniel Vetter , dri-devel@lists.freedesktop.org, Evan Quan , Alex Deucher , =?UTF-8?Q?Christian_K=c3=b6nig?= , "Pan, Xinhui" , Xiaojian Du , Huang Rui , Kevin Wang , Hawking Zhang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Chris Wilson , John Harrison , Andi Shyti , Matthew Brost , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Bjorn Andersson , Ben Skeggs , Karol Herbst , Lyude Paul , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Zack Rusin , VMware Graphics Reviewers , Melissa Wen , Nathan Chancellor , Nick Desaulniers , Tom Rix , Le Ma , Lijo Lazar , Yifan Zhang , Prike Liang , Lang Yu , Tejas Upadhyay , Nirmoy Das , Andrzej Hajda , Neil Armstrong , Kuogee Hsieh , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, virtualization@lists.linux-foundation.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org References: <20230922173110.work.084-kees@kernel.org> <20230922173216.3823169-6-keescook@chromium.org> From: "Gustavo A. R. Silva" In-Reply-To: <20230922173216.3823169-6-keescook@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: 94.239.20.48 X-Source-L: No X-Exim-ID: 1qjkgW-000Qi0-2c X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.1.98]) [94.239.20.48]:50846 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 0 X-Org: HG=hgshared;ORG=hostgator; X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfB4cE4VeGiXbSX6tBxbAXRvt99ZbcAEghDwSPwVA+/ne/GfY8db3qMLOEgSYq0iE9V8Tw/WQC1btOWOlK9qOY8u5ZKvu+ya9RN58sRu+pxLVf3bjnelq Z56bp3sb3EhhqI2j4pHY2lp59OItj4+YbZpBwgRq5hHadNXmu7Rfk95KKAprSFTTkfbJhy7aK3iv/1rMzO37kadaaZ3xKetYojzN+MNCXIBZSyXaCX0tyMgJ pa+hxB1UeXisfNQ3SFQOq6pZw9vc6zjj7ApXmZjQ3uSNMlbJJsbTACFDRmOXau6GCYDLo6eEeiRc3pBoOODDkw== X-Spam-Status: No, score=1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 22 Sep 2023 18:41:48 -0700 (PDT) X-Spam-Level: * On 9/22/23 11: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 vc4_perfmon. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Emma Anholt > Cc: Maxime Ripard > Cc: David Airlie > Cc: Daniel Vetter > Cc: dri-devel@lists.freedesktop.org > Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo > --- > drivers/gpu/drm/vc4/vc4_drv.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h > index bf66499765fb..ab61e96e7e14 100644 > --- a/drivers/gpu/drm/vc4/vc4_drv.h > +++ b/drivers/gpu/drm/vc4/vc4_drv.h > @@ -76,7 +76,7 @@ struct vc4_perfmon { > * Note that counter values can't be reset, but you can fake a reset by > * destroying the perfmon and creating a new one. > */ > - u64 counters[]; > + u64 counters[] __counted_by(ncounters); > }; > > struct vc4_dev {