public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Zack Rusin <zackr@vmware.com>
To: "keescook@chromium.org" <keescook@chromium.org>,
	"airlied@gmail.com" <airlied@gmail.com>
Cc: "emma@anholt.net" <emma@anholt.net>,
	"trix@redhat.com" <trix@redhat.com>,
	"llvm@lists.linux.dev" <llvm@lists.linux.dev>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"chris@chris-wilson.co.uk" <chris@chris-wilson.co.uk>,
	"Prike.Liang@amd.com" <Prike.Liang@amd.com>,
	"ray.huang@amd.com" <ray.huang@amd.com>,
	"linux-hardening@vger.kernel.org"
	<linux-hardening@vger.kernel.org>,
	"andrzej.hajda@intel.com" <andrzej.hajda@intel.com>,
	"marijn.suijten@somainline.org" <marijn.suijten@somainline.org>,
	"evan.quan@amd.com" <evan.quan@amd.com>,
	"kherbst@redhat.com" <kherbst@redhat.com>,
	"neil.armstrong@linaro.org" <neil.armstrong@linaro.org>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"quic_khsieh@quicinc.com" <quic_khsieh@quicinc.com>,
	Linux-graphics-maintainer <Linux-graphics-maintainer@vmware.com>,
	"bskeggs@redhat.com" <bskeggs@redhat.com>,
	"nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>,
	"airlied@redhat.com" <airlied@redhat.com>,
	"olvaffe@gmail.com" <olvaffe@gmail.com>,
	"alexander.deucher@amd.com" <alexander.deucher@amd.com>,
	"lijo.lazar@amd.com" <lijo.lazar@amd.com>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"kevin1.wang@amd.com" <kevin1.wang@amd.com>,
	"quic_abhinavk@quicinc.com" <quic_abhinavk@quicinc.com>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"nathan@kernel.org" <nathan@kernel.org>,
	"le.ma@amd.com" <le.ma@amd.com>,
	"gurchetansingh@chromium.org" <gurchetansingh@chromium.org>,
	"rodrigo.vivi@intel.com" <rodrigo.vivi@intel.com>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>,
	"yifan1.zhang@amd.com" <yifan1.zhang@amd.com>,
	"kraxel@redhat.com" <kraxel@redhat.com>,
	"Xiaojian.Du@amd.com" <Xiaojian.Du@amd.com>,
	"freedreno@lists.freedesktop.org"
	<freedreno@lists.freedesktop.org>,
	"andersson@kernel.org" <andersson@kernel.org>,
	"Xinhui.Pan@amd.com" <Xinhui.Pan@amd.com>,
	"ndesaulniers@google.com" <ndesaulniers@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mwen@igalia.com" <mwen@igalia.com>,
	"daniel@ffwll.ch" <daniel@ffwll.ch>,
	"dmitry.baryshkov@linaro.org" <dmitry.baryshkov@linaro.org>,
	"Hawking.Zhang@amd.com" <Hawking.Zhang@amd.com>,
	"Lang.Yu@amd.com" <Lang.Yu@amd.com>,
	"christian.koenig@amd.com" <christian.koenig@amd.com>,
	"nirmoy.das@intel.com" <nirmoy.das@intel.com>
Subject: Re: [Intel-gfx] [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
Date: Fri, 22 Sep 2023 21:50:38 +0000	[thread overview]
Message-ID: <14e3506369eeb677d73b68be487cb6f04c4b36d3.camel@vmware.com> (raw)
In-Reply-To: <20230922173216.3823169-8-keescook@chromium.org>

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@vmware.com>
> Cc: VMware Graphics Reviewers <linux-graphics-maintainer@vmware.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.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@vmware.com>

  reply	other threads:[~2023-09-22 21:50 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 17:32 [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by Kees Cook
2023-09-22 17:32 ` [Intel-gfx] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table " Kees Cook
2023-09-22 17:41   ` Alex Deucher
2023-09-25  6:30     ` Christian König
2023-09-25 14:07       ` Alex Deucher
2023-09-25 14:14         ` Alex Deucher
2023-09-25 17:52       ` Kees Cook
2023-09-25 17:56         ` Alex Deucher
2023-09-23  2:13   ` Gustavo A. R. Silva
2023-09-22 17:32 ` [Intel-gfx] [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance " Kees Cook
2023-09-22 17:42   ` Alex Deucher
2023-09-23  2:14   ` Gustavo A. R. Silva
2023-09-22 17:32 ` [Intel-gfx] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series " Kees Cook
2023-09-23  2:14   ` Gustavo A. R. Silva
2023-09-25 10:08   ` Andrzej Hajda
2023-09-25 17:50     ` Kees Cook
2023-09-25 12:20   ` Andi Shyti
2023-09-22 17:32 ` [Intel-gfx] [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr " Kees Cook
2023-09-23  2:15   ` Gustavo A. R. Silva
2023-09-22 17:32 ` [Intel-gfx] [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom " Kees Cook
2023-09-22 19:00   ` Lyude Paul
2023-09-23  2:15   ` Gustavo A. R. Silva
2023-09-22 17:32 ` [Intel-gfx] [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon " Kees Cook
2023-09-23  2:16   ` Gustavo A. R. Silva
2023-09-22 17:32 ` [Intel-gfx] [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array " Kees Cook
2023-09-23  2:36   ` Gustavo A. R. Silva
2023-09-22 17:32 ` [Intel-gfx] [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty " Kees Cook
2023-09-22 21:50   ` Zack Rusin [this message]
2023-09-23  2:37   ` Gustavo A. R. Silva
2023-09-22 17:32 ` [Intel-gfx] [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon " Kees Cook
2023-09-28 15:16   ` Maira Canal
2023-09-23  3:16 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Annotate structs " Patchwork
2023-09-23  3:16 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-09-23  3:34 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2023-09-29 19:33 ` [Intel-gfx] [PATCH 0/9] " Kees Cook
2023-10-02  9:20   ` Christian König
2023-10-02 15:06     ` Alex Deucher
2023-10-02 16:53       ` Kees Cook
2023-10-02 18:01         ` Christian König
2023-10-02 18:08           ` Kees Cook
2023-10-02 18:11             ` Christian König
2023-10-02 18:22               ` Kees Cook
2023-10-05  9:42                 ` Christian König
2023-10-05 16:16                   ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14e3506369eeb677d73b68be487cb6f04c4b36d3.camel@vmware.com \
    --to=zackr@vmware.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Lang.Yu@amd.com \
    --cc=Linux-graphics-maintainer@vmware.com \
    --cc=Prike.Liang@amd.com \
    --cc=Xiaojian.Du@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andersson@kernel.org \
    --cc=andrzej.hajda@intel.com \
    --cc=bskeggs@redhat.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=evan.quan@amd.com \
    --cc=freedreno@lists.freedesktop.org \
    --cc=gurchetansingh@chromium.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=keescook@chromium.org \
    --cc=kevin1.wang@amd.com \
    --cc=kherbst@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=le.ma@amd.com \
    --cc=lijo.lazar@amd.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=marijn.suijten@somainline.org \
    --cc=mripard@kernel.org \
    --cc=mwen@igalia.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=neil.armstrong@linaro.org \
    --cc=nirmoy.das@intel.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=olvaffe@gmail.com \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_khsieh@quicinc.com \
    --cc=ray.huang@amd.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=trix@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=yifan1.zhang@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox