[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <14e3506369eeb677d73b68be487cb6f04c4b36d3.camel@vmware.com>
Date: Fri, 22 Sep 2023 21:50:38 +0000
From: Zack Rusin <zackr@...are.com>
To: "keescook@...omium.org" <keescook@...omium.org>, "airlied@...il.com"
<airlied@...il.com>
CC: "nathan@...nel.org" <nathan@...nel.org>, "emma@...olt.net"
<emma@...olt.net>, "quic_abhinavk@...cinc.com" <quic_abhinavk@...cinc.com>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>, "kherbst@...hat.com"
<kherbst@...hat.com>, "evan.quan@....com" <evan.quan@....com>,
"lijo.lazar@....com" <lijo.lazar@....com>, "marijn.suijten@...ainline.org"
<marijn.suijten@...ainline.org>, "Lang.Yu@....com" <Lang.Yu@....com>,
"mripard@...nel.org" <mripard@...nel.org>, "ray.huang@....com"
<ray.huang@....com>, "linux-hardening@...r.kernel.org"
<linux-hardening@...r.kernel.org>, "kraxel@...hat.com" <kraxel@...hat.com>,
"chris@...is-wilson.co.uk" <chris@...is-wilson.co.uk>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"joonas.lahtinen@...ux.intel.com" <joonas.lahtinen@...ux.intel.com>,
"nirmoy.das@...el.com" <nirmoy.das@...el.com>,
"amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
"Xinhui.Pan@....com" <Xinhui.Pan@....com>, "airlied@...hat.com"
<airlied@...hat.com>, "christian.koenig@....com" <christian.koenig@....com>,
"jani.nikula@...ux.intel.com" <jani.nikula@...ux.intel.com>,
"dmitry.baryshkov@...aro.org" <dmitry.baryshkov@...aro.org>,
"yifan1.zhang@....com" <yifan1.zhang@....com>, "le.ma@....com"
<le.ma@....com>, "intel-gfx@...ts.freedesktop.org"
<intel-gfx@...ts.freedesktop.org>, "andersson@...nel.org"
<andersson@...nel.org>, "rodrigo.vivi@...el.com" <rodrigo.vivi@...el.com>,
"quic_khsieh@...cinc.com" <quic_khsieh@...cinc.com>, "sean@...rly.run"
<sean@...rly.run>, "andi.shyti@...ux.intel.com" <andi.shyti@...ux.intel.com>,
"gurchetansingh@...omium.org" <gurchetansingh@...omium.org>,
"mwen@...lia.com" <mwen@...lia.com>, "bskeggs@...hat.com"
<bskeggs@...hat.com>, "trix@...hat.com" <trix@...hat.com>,
"matthew.brost@...el.com" <matthew.brost@...el.com>, "Prike.Liang@....com"
<Prike.Liang@....com>, "tejas.upadhyay@...el.com" <tejas.upadhyay@...el.com>,
"john.c.harrison@...el.com" <john.c.harrison@...el.com>, "lyude@...hat.com"
<lyude@...hat.com>, "ndesaulniers@...gle.com" <ndesaulniers@...gle.com>,
"alexander.deucher@....com" <alexander.deucher@....com>, "daniel@...ll.ch"
<daniel@...ll.ch>, Linux-graphics-maintainer
<Linux-graphics-maintainer@...are.com>, "olvaffe@...il.com"
<olvaffe@...il.com>, "andrzej.hajda@...el.com" <andrzej.hajda@...el.com>,
"Hawking.Zhang@....com" <Hawking.Zhang@....com>,
"freedreno@...ts.freedesktop.org" <freedreno@...ts.freedesktop.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"tvrtko.ursulin@...ux.intel.com" <tvrtko.ursulin@...ux.intel.com>,
"Xiaojian.Du@....com" <Xiaojian.Du@....com>, "robdclark@...il.com"
<robdclark@...il.com>, "kevin1.wang@....com" <kevin1.wang@....com>,
"linux-arm-msm@...r.kernel.org" <linux-arm-msm@...r.kernel.org>,
"neil.armstrong@...aro.org" <neil.armstrong@...aro.org>,
"llvm@...ts.linux.dev" <llvm@...ts.linux.dev>,
"nouveau@...ts.freedesktop.org" <nouveau@...ts.freedesktop.org>
Subject: Re: [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with
__counted_by
On Fri, 2023-09-22 at 10:32 -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 vmw_surface_dirty.
>
> [1]
> https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Zack Rusin <zackr@...are.com>
> Cc: VMware Graphics Reviewers <linux-graphics-maintainer@...are.com>
> Cc: David Airlie <airlied@...il.com>
> Cc: Daniel Vetter <daniel@...ll.ch>
> Cc: dri-devel@...ts.freedesktop.org
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> index 5db403ee8261..2d1d857f99ae 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> @@ -77,7 +77,7 @@ struct vmw_surface_offset {
> struct vmw_surface_dirty {
> struct vmw_surface_cache cache;
> u32 num_subres;
> - SVGA3dBox boxes[];
> + SVGA3dBox boxes[] __counted_by(num_subres);
> };
>
> static void vmw_user_surface_free(struct vmw_resource *res);
Thanks!
Reviewed-by: Zack Rusin <zackr@...are.com>
Powered by blists - more mailing lists