All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-22 17:32 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Kees Cook, Emma Anholt, Evan Quan, Alex Deucher,
	Christian König, Pan, Xinhui, Daniel Vetter, 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,
	Maxime Ripard, 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,
	amd-gfx, dri-devel, intel-gfx, linux-arm-msm, freedreno, nouveau,
	virtualization, llvm, linux-hardening

Hi,

This is a batch of patches touching drm for preparing 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 to structs that would
benefit from the annotation.

Since the element count member must be set before accessing the annotated
flexible array member, some patches also move the member's initialization
earlier. (These are noted in the individual patches.)

-Kees

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Kees Cook (9):
  drm/amd/pm: Annotate struct smu10_voltage_dependency_table with
    __counted_by
  drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
  drm/i915/selftests: Annotate struct perf_series with __counted_by
  drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
  drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
  drm/vc4: Annotate struct vc4_perfmon with __counted_by
  drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
  drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
  drm/v3d: Annotate struct v3d_perfmon with __counted_by

 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c        | 2 +-
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 drivers/gpu/drm/i915/selftests/i915_request.c        | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h    | 2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h        | 2 +-
 drivers/gpu/drm/v3d/v3d_drv.h                        | 2 +-
 drivers/gpu/drm/vc4/vc4_drv.h                        | 2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.h                 | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c              | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 243+ messages in thread

* [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-22 17:32 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Alex Deucher, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter,
	Dmitry Baryshkov, Nirmoy Das, Lang Yu, Christian König,
	John Harrison, Hawking Zhang

Hi,

This is a batch of patches touching drm for preparing 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 to structs that would
benefit from the annotation.

Since the element count member must be set before accessing the annotated
flexible array member, some patches also move the member's initialization
earlier. (These are noted in the individual patches.)

-Kees

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Kees Cook (9):
  drm/amd/pm: Annotate struct smu10_voltage_dependency_table with
    __counted_by
  drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
  drm/i915/selftests: Annotate struct perf_series with __counted_by
  drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
  drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
  drm/vc4: Annotate struct vc4_perfmon with __counted_by
  drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
  drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
  drm/v3d: Annotate struct v3d_perfmon with __counted_by

 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c        | 2 +-
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 drivers/gpu/drm/i915/selftests/i915_request.c        | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h    | 2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h        | 2 +-
 drivers/gpu/drm/v3d/v3d_drv.h                        | 2 +-
 drivers/gpu/drm/vc4/vc4_drv.h                        | 2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.h                 | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c              | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 243+ messages in thread

* [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-22 17:32 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Melissa Wen, Alex Deucher, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul,
	Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Dmitry Baryshkov,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

Hi,

This is a batch of patches touching drm for preparing 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 to structs that would
benefit from the annotation.

Since the element count member must be set before accessing the annotated
flexible array member, some patches also move the member's initialization
earlier. (These are noted in the individual patches.)

-Kees

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Kees Cook (9):
  drm/amd/pm: Annotate struct smu10_voltage_dependency_table with
    __counted_by
  drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
  drm/i915/selftests: Annotate struct perf_series with __counted_by
  drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
  drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
  drm/vc4: Annotate struct vc4_perfmon with __counted_by
  drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
  drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
  drm/v3d: Annotate struct v3d_perfmon with __counted_by

 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c        | 2 +-
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 drivers/gpu/drm/i915/selftests/i915_request.c        | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h    | 2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h        | 2 +-
 drivers/gpu/drm/v3d/v3d_drv.h                        | 2 +-
 drivers/gpu/drm/vc4/vc4_drv.h                        | 2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.h                 | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c              | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 243+ messages in thread

* [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-22 17:32 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Alex Deucher, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Dmitry Baryshkov, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

Hi,

This is a batch of patches touching drm for preparing 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 to structs that would
benefit from the annotation.

Since the element count member must be set before accessing the annotated
flexible array member, some patches also move the member's initialization
earlier. (These are noted in the individual patches.)

-Kees

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Kees Cook (9):
  drm/amd/pm: Annotate struct smu10_voltage_dependency_table with
    __counted_by
  drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
  drm/i915/selftests: Annotate struct perf_series with __counted_by
  drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
  drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
  drm/vc4: Annotate struct vc4_perfmon with __counted_by
  drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
  drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
  drm/v3d: Annotate struct v3d_perfmon with __counted_by

 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c        | 2 +-
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 drivers/gpu/drm/i915/selftests/i915_request.c        | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h    | 2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h        | 2 +-
 drivers/gpu/drm/v3d/v3d_drv.h                        | 2 +-
 drivers/gpu/drm/vc4/vc4_drv.h                        | 2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.h                 | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c              | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 243+ messages in thread

* [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-22 17:32 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Kees Cook, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Alex Deucher, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter,
	Dmitry Baryshkov, Nirmoy Das, Lang Yu, Christian König,
	John Harrison, Hawking Zhang

Hi,

This is a batch of patches touching drm for preparing 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 to structs that would
benefit from the annotation.

Since the element count member must be set before accessing the annotated
flexible array member, some patches also move the member's initialization
earlier. (These are noted in the individual patches.)

-Kees

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Kees Cook (9):
  drm/amd/pm: Annotate struct smu10_voltage_dependency_table with
    __counted_by
  drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
  drm/i915/selftests: Annotate struct perf_series with __counted_by
  drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
  drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
  drm/vc4: Annotate struct vc4_perfmon with __counted_by
  drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
  drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
  drm/v3d: Annotate struct v3d_perfmon with __counted_by

 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c        | 2 +-
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 drivers/gpu/drm/i915/selftests/i915_request.c        | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h    | 2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h        | 2 +-
 drivers/gpu/drm/v3d/v3d_drv.h                        | 2 +-
 drivers/gpu/drm/vc4/vc4_drv.h                        | 2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.h                 | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c              | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-22 17:32 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Alex Deucher, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter,
	Dmitry Baryshkov, Nirmoy Das, Lang Yu, Christian König,
	John Harrison, Hawking Zhang

Hi,

This is a batch of patches touching drm for preparing 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 to structs that would
benefit from the annotation.

Since the element count member must be set before accessing the annotated
flexible array member, some patches also move the member's initialization
earlier. (These are noted in the individual patches.)

-Kees

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Kees Cook (9):
  drm/amd/pm: Annotate struct smu10_voltage_dependency_table with
    __counted_by
  drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
  drm/i915/selftests: Annotate struct perf_series with __counted_by
  drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
  drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
  drm/vc4: Annotate struct vc4_perfmon with __counted_by
  drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
  drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
  drm/v3d: Annotate struct v3d_perfmon with __counted_by

 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c        | 2 +-
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 drivers/gpu/drm/i915/selftests/i915_request.c        | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h    | 2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h        | 2 +-
 drivers/gpu/drm/v3d/v3d_drv.h                        | 2 +-
 drivers/gpu/drm/vc4/vc4_drv.h                        | 2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.h                 | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c              | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 243+ messages in thread

* [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:32   ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Kees Cook, Evan Quan, Alex Deucher, Christian König, Pan,
	Xinhui, Daniel Vetter, Xiaojian Du, Huang Rui, Kevin Wang,
	amd-gfx, dri-devel, Emma Anholt, 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,
	Maxime Ripard, 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,
	intel-gfx, linux-arm-msm, freedreno, nouveau, virtualization,
	llvm, linux-hardening

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 smu10_voltage_dependency_table.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Evan Quan <evan.quan@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Xiaojian Du <Xiaojian.Du@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Kevin Wang <kevin1.wang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
index 808e0ecbe1f0..42adc2a3dcbc 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
@@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
 
 struct smu10_voltage_dependency_table {
 	uint32_t count;
-	struct smu10_clock_voltage_dependency_record entries[];
+	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
 };
 
 struct smu10_clock_voltage_information {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Nouveau] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 smu10_voltage_dependency_table.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Evan Quan <evan.quan@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Xiaojian Du <Xiaojian.Du@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Kevin Wang <kevin1.wang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
index 808e0ecbe1f0..42adc2a3dcbc 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
@@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
 
 struct smu10_voltage_dependency_table {
 	uint32_t count;
-	struct smu10_clock_voltage_dependency_record entries[];
+	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
 };
 
 struct smu10_clock_voltage_information {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Melissa Wen, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul,
	Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 smu10_voltage_dependency_table.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Evan Quan <evan.quan@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Xiaojian Du <Xiaojian.Du@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Kevin Wang <kevin1.wang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
index 808e0ecbe1f0..42adc2a3dcbc 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
@@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
 
 struct smu10_voltage_dependency_table {
 	uint32_t count;
-	struct smu10_clock_voltage_dependency_record entries[];
+	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
 };
 
 struct smu10_clock_voltage_information {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Intel-gfx] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

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 smu10_voltage_dependency_table.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Evan Quan <evan.quan@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Xiaojian Du <Xiaojian.Du@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Kevin Wang <kevin1.wang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
index 808e0ecbe1f0..42adc2a3dcbc 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
@@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
 
 struct smu10_voltage_dependency_table {
 	uint32_t count;
-	struct smu10_clock_voltage_dependency_record entries[];
+	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
 };
 
 struct smu10_clock_voltage_information {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Kees Cook, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 smu10_voltage_dependency_table.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Evan Quan <evan.quan@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Xiaojian Du <Xiaojian.Du@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Kevin Wang <kevin1.wang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
index 808e0ecbe1f0..42adc2a3dcbc 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
@@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
 
 struct smu10_voltage_dependency_table {
 	uint32_t count;
-	struct smu10_clock_voltage_dependency_record entries[];
+	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
 };
 
 struct smu10_clock_voltage_information {
-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 smu10_voltage_dependency_table.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Evan Quan <evan.quan@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Xiaojian Du <Xiaojian.Du@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Kevin Wang <kevin1.wang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
index 808e0ecbe1f0..42adc2a3dcbc 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
@@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
 
 struct smu10_voltage_dependency_table {
 	uint32_t count;
-	struct smu10_clock_voltage_dependency_record entries[];
+	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
 };
 
 struct smu10_clock_voltage_information {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:32   ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Kees Cook, Alex Deucher, Christian König, Pan, Xinhui,
	Daniel Vetter, Hawking Zhang, amd-gfx, dri-devel, Emma Anholt,
	Evan Quan, Xiaojian Du, Huang Rui, Kevin Wang, 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,
	Maxime Ripard, 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,
	intel-gfx, linux-arm-msm, freedreno, nouveau, virtualization,
	llvm, linux-hardening

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 ip_hw_instance.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index d1bc7b212520..be4c97a3d7bf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -662,7 +662,7 @@ struct ip_hw_instance {
 	u8  harvest;
 
 	int num_base_addresses;
-	u32 base_addr[];
+	u32 base_addr[] __counted_by(num_base_addresses);
 };
 
 struct ip_hw_id {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Nouveau] [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 ip_hw_instance.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index d1bc7b212520..be4c97a3d7bf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -662,7 +662,7 @@ struct ip_hw_instance {
 	u8  harvest;
 
 	int num_base_addresses;
-	u32 base_addr[];
+	u32 base_addr[] __counted_by(num_base_addresses);
 };
 
 struct ip_hw_id {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Intel-gfx] [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

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 ip_hw_instance.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index d1bc7b212520..be4c97a3d7bf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -662,7 +662,7 @@ struct ip_hw_instance {
 	u8  harvest;
 
 	int num_base_addresses;
-	u32 base_addr[];
+	u32 base_addr[] __counted_by(num_base_addresses);
 };
 
 struct ip_hw_id {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Melissa Wen, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul,
	Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 ip_hw_instance.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index d1bc7b212520..be4c97a3d7bf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -662,7 +662,7 @@ struct ip_hw_instance {
 	u8  harvest;
 
 	int num_base_addresses;
-	u32 base_addr[];
+	u32 base_addr[] __counted_by(num_base_addresses);
 };
 
 struct ip_hw_id {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Kees Cook, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 ip_hw_instance.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index d1bc7b212520..be4c97a3d7bf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -662,7 +662,7 @@ struct ip_hw_instance {
 	u8  harvest;
 
 	int num_base_addresses;
-	u32 base_addr[];
+	u32 base_addr[] __counted_by(num_base_addresses);
 };
 
 struct ip_hw_id {
-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 ip_hw_instance.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index d1bc7b212520..be4c97a3d7bf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -662,7 +662,7 @@ struct ip_hw_instance {
 	u8  harvest;
 
 	int num_base_addresses;
-	u32 base_addr[];
+	u32 base_addr[] __counted_by(num_base_addresses);
 };
 
 struct ip_hw_id {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Nouveau] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:32   ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 perf_series.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: John Harrison <john.c.harrison@Intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index a9b79888c193..acae30a04a94 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -1924,7 +1924,7 @@ struct perf_stats {
 struct perf_series {
 	struct drm_i915_private *i915;
 	unsigned int nengines;
-	struct intel_context *ce[];
+	struct intel_context *ce[] __counted_by(nengines);
 };
 
 static int cmp_u32(const void *A, const void *B)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Melissa Wen, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul,
	Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 perf_series.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: John Harrison <john.c.harrison@Intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index a9b79888c193..acae30a04a94 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -1924,7 +1924,7 @@ struct perf_stats {
 struct perf_series {
 	struct drm_i915_private *i915;
 	unsigned int nengines;
-	struct intel_context *ce[];
+	struct intel_context *ce[] __counted_by(nengines);
 };
 
 static int cmp_u32(const void *A, const void *B)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Intel-gfx] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

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 perf_series.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: John Harrison <john.c.harrison@Intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index a9b79888c193..acae30a04a94 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -1924,7 +1924,7 @@ struct perf_stats {
 struct perf_series {
 	struct drm_i915_private *i915;
 	unsigned int nengines;
-	struct intel_context *ce[];
+	struct intel_context *ce[] __counted_by(nengines);
 };
 
 static int cmp_u32(const void *A, const void *B)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Kees Cook, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, Daniel Vetter, Chris Wilson, John Harrison,
	Andi Shyti, Matthew Brost, intel-gfx, dri-devel, Emma Anholt,
	Evan Quan, Alex Deucher, Christian König, Pan, Xinhui,
	Xiaojian Du, Huang Rui, Kevin Wang, Hawking Zhang, Rob Clark,
	Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
	Bjorn Andersson, Ben Skeggs, Karol Herbst, Lyude Paul,
	Maxime Ripard, 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,
	amd-gfx, linux-arm-msm, freedreno, nouveau, virtualization, llvm,
	linux-hardening

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 perf_series.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: John Harrison <john.c.harrison@Intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index a9b79888c193..acae30a04a94 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -1924,7 +1924,7 @@ struct perf_stats {
 struct perf_series {
 	struct drm_i915_private *i915;
 	unsigned int nengines;
-	struct intel_context *ce[];
+	struct intel_context *ce[] __counted_by(nengines);
 };
 
 static int cmp_u32(const void *A, const void *B)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Kees Cook, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 perf_series.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: John Harrison <john.c.harrison@Intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index a9b79888c193..acae30a04a94 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -1924,7 +1924,7 @@ struct perf_stats {
 struct perf_series {
 	struct drm_i915_private *i915;
 	unsigned int nengines;
-	struct intel_context *ce[];
+	struct intel_context *ce[] __counted_by(nengines);
 };
 
 static int cmp_u32(const void *A, const void *B)
-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 perf_series.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: John Harrison <john.c.harrison@Intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index a9b79888c193..acae30a04a94 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -1924,7 +1924,7 @@ struct perf_stats {
 struct perf_series {
 	struct drm_i915_private *i915;
 	unsigned int nengines;
-	struct intel_context *ce[];
+	struct intel_context *ce[] __counted_by(nengines);
 };
 
 static int cmp_u32(const void *A, const void *B)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:32   ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Kees Cook, Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
	Marijn Suijten, Daniel Vetter, Bjorn Andersson, linux-arm-msm,
	dri-devel, freedreno, Emma Anholt, Evan Quan, Alex Deucher,
	Christian König, 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, Ben Skeggs, Karol Herbst, Lyude Paul,
	Maxime Ripard, 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,
	amd-gfx, intel-gfx, nouveau, virtualization, llvm,
	linux-hardening

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 dpu_hw_intr.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Rob Clark <robdclark@gmail.com>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sean Paul <sean@poorly.run>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
index dab761e54863..50cf9523d367 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
@@ -61,7 +61,7 @@ struct dpu_hw_intr {
 		void (*cb)(void *arg, int irq_idx);
 		void *arg;
 		atomic_t count;
-	} irq_tbl[];
+	} irq_tbl[] __counted_by(total_irqs);
 };
 
 /**
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Melissa Wen, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul,
	Tvrtko Ursulin, Xiaojian Du, Le Ma, Lang Yu, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Alex Deucher,
	Nirmoy Das, freedreno, Christian König, John Harrison,
	Hawking Zhang

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 dpu_hw_intr.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Rob Clark <robdclark@gmail.com>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sean Paul <sean@poorly.run>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
index dab761e54863..50cf9523d367 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
@@ -61,7 +61,7 @@ struct dpu_hw_intr {
 		void (*cb)(void *arg, int irq_idx);
 		void *arg;
 		atomic_t count;
-	} irq_tbl[];
+	} irq_tbl[] __counted_by(total_irqs);
 };
 
 /**
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Intel-gfx] [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, Lang Yu, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, freedreno,
	Christian König, Hawking Zhang

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 dpu_hw_intr.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Rob Clark <robdclark@gmail.com>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sean Paul <sean@poorly.run>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
index dab761e54863..50cf9523d367 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
@@ -61,7 +61,7 @@ struct dpu_hw_intr {
 		void (*cb)(void *arg, int irq_idx);
 		void *arg;
 		atomic_t count;
-	} irq_tbl[];
+	} irq_tbl[] __counted_by(total_irqs);
 };
 
 /**
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Nouveau] [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	Lang Yu, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, freedreno, Christian König, John Harrison,
	Hawking Zhang

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 dpu_hw_intr.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Rob Clark <robdclark@gmail.com>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sean Paul <sean@poorly.run>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
index dab761e54863..50cf9523d367 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
@@ -61,7 +61,7 @@ struct dpu_hw_intr {
 		void (*cb)(void *arg, int irq_idx);
 		void *arg;
 		atomic_t count;
-	} irq_tbl[];
+	} irq_tbl[] __counted_by(total_irqs);
 };
 
 /**
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Kees Cook, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	Lang Yu, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, freedreno, Christian König, John Harrison,
	Hawking Zhang

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 dpu_hw_intr.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Rob Clark <robdclark@gmail.com>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sean Paul <sean@poorly.run>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
index dab761e54863..50cf9523d367 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
@@ -61,7 +61,7 @@ struct dpu_hw_intr {
 		void (*cb)(void *arg, int irq_idx);
 		void *arg;
 		atomic_t count;
-	} irq_tbl[];
+	} irq_tbl[] __counted_by(total_irqs);
 };
 
 /**
-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	Lang Yu, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, freedreno, Christian König, John Harrison,
	Hawking Zhang

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 dpu_hw_intr.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Rob Clark <robdclark@gmail.com>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sean Paul <sean@poorly.run>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
index dab761e54863..50cf9523d367 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
@@ -61,7 +61,7 @@ struct dpu_hw_intr {
 		void (*cb)(void *arg, int irq_idx);
 		void *arg;
 		atomic_t count;
-	} irq_tbl[];
+	} irq_tbl[] __counted_by(total_irqs);
 };
 
 /**
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Intel-gfx] [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:32   ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Karol Herbst, nouveau, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Emma Anholt, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, Nathan Chancellor, VMware Graphics Reviewers,
	Ben Skeggs, Tom Rix, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

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 nvkm_perfdom.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
index 6ae25d3e7f45..c011227f7052 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
@@ -82,7 +82,7 @@ struct nvkm_perfdom {
 	u8  mode;
 	u32 clk;
 	u16 signal_nr;
-	struct nvkm_perfsig signal[];
+	struct nvkm_perfsig signal[] __counted_by(signal_nr);
 };
 
 struct nvkm_funcdom {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Kees Cook, Ben Skeggs, Karol Herbst, Lyude Paul, Daniel Vetter,
	dri-devel, nouveau, Emma Anholt, Evan Quan, Alex Deucher,
	Christian König, 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,
	Maxime Ripard, 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,
	amd-gfx, intel-gfx, linux-arm-msm, freedreno, virtualization,
	llvm, linux-hardening

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 nvkm_perfdom.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
index 6ae25d3e7f45..c011227f7052 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
@@ -82,7 +82,7 @@ struct nvkm_perfdom {
 	u8  mode;
 	u32 clk;
 	u16 signal_nr;
-	struct nvkm_perfsig signal[];
+	struct nvkm_perfsig signal[] __counted_by(signal_nr);
 };
 
 struct nvkm_funcdom {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Nouveau] [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, nouveau, Joonas Lahtinen, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Emma Anholt,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 nvkm_perfdom.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
index 6ae25d3e7f45..c011227f7052 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
@@ -82,7 +82,7 @@ struct nvkm_perfdom {
 	u8  mode;
 	u32 clk;
 	u16 signal_nr;
-	struct nvkm_perfsig signal[];
+	struct nvkm_perfsig signal[] __counted_by(signal_nr);
 };
 
 struct nvkm_funcdom {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Karol Herbst, nouveau, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Emma Anholt,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Melissa Wen, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul,
	Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 nvkm_perfdom.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
index 6ae25d3e7f45..c011227f7052 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
@@ -82,7 +82,7 @@ struct nvkm_perfdom {
 	u8  mode;
 	u32 clk;
 	u16 signal_nr;
-	struct nvkm_perfsig signal[];
+	struct nvkm_perfsig signal[] __counted_by(signal_nr);
 };
 
 struct nvkm_funcdom {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Karol Herbst, nouveau, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Emma Anholt, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Kees Cook, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 nvkm_perfdom.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
index 6ae25d3e7f45..c011227f7052 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
@@ -82,7 +82,7 @@ struct nvkm_perfdom {
 	u8  mode;
 	u32 clk;
 	u16 signal_nr;
-	struct nvkm_perfsig signal[];
+	struct nvkm_perfsig signal[] __counted_by(signal_nr);
 };
 
 struct nvkm_funcdom {
-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Karol Herbst, nouveau, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Emma Anholt,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 nvkm_perfdom.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
index 6ae25d3e7f45..c011227f7052 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
@@ -82,7 +82,7 @@ struct nvkm_perfdom {
 	u8  mode;
 	u32 clk;
 	u16 signal_nr;
-	struct nvkm_perfsig signal[];
+	struct nvkm_perfsig signal[] __counted_by(signal_nr);
 };
 
 struct nvkm_funcdom {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Nouveau] [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:32   ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 <emma@anholt.net>
Cc: Maxime Ripard <mripard@kernel.org>
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/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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Melissa Wen, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul,
	Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 <emma@anholt.net>
Cc: Maxime Ripard <mripard@kernel.org>
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/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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Kees Cook, Emma Anholt, Maxime Ripard, Daniel Vetter, dri-devel,
	Evan Quan, Alex Deucher, Christian König, 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,
	amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	virtualization, llvm, linux-hardening

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 <emma@anholt.net>
Cc: Maxime Ripard <mripard@kernel.org>
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/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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Intel-gfx] [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

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 <emma@anholt.net>
Cc: Maxime Ripard <mripard@kernel.org>
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/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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Kees Cook, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 <emma@anholt.net>
Cc: Maxime Ripard <mripard@kernel.org>
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/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 {
-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 <emma@anholt.net>
Cc: Maxime Ripard <mripard@kernel.org>
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/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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:32   ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Melissa Wen, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul,
	Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 virtio_gpu_object_array.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: David Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Chia-I Wu <olvaffe@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 8513b671f871..96365a772f77 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
 	struct ww_acquire_ctx ticket;
 	struct list_head next;
 	u32 nents, total;
-	struct drm_gem_object *objs[];
+	struct drm_gem_object *objs[] __counted_by(total);
 };
 
 struct virtio_gpu_vbuffer;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Kees Cook, David Airlie, Gerd Hoffmann, Gurchetan Singh,
	Chia-I Wu, Daniel Vetter, dri-devel, virtualization, Emma Anholt,
	Evan Quan, Alex Deucher, Christian König, 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,
	Maxime Ripard, 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, amd-gfx, intel-gfx, linux-arm-msm, freedreno,
	nouveau, llvm, linux-hardening

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 virtio_gpu_object_array.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: David Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Chia-I Wu <olvaffe@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 8513b671f871..96365a772f77 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
 	struct ww_acquire_ctx ticket;
 	struct list_head next;
 	u32 nents, total;
-	struct drm_gem_object *objs[];
+	struct drm_gem_object *objs[] __counted_by(total);
 };
 
 struct virtio_gpu_vbuffer;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Nouveau] [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 virtio_gpu_object_array.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: David Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Chia-I Wu <olvaffe@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 8513b671f871..96365a772f77 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
 	struct ww_acquire_ctx ticket;
 	struct list_head next;
 	u32 nents, total;
-	struct drm_gem_object *objs[];
+	struct drm_gem_object *objs[] __counted_by(total);
 };
 
 struct virtio_gpu_vbuffer;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Intel-gfx] [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

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 virtio_gpu_object_array.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: David Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Chia-I Wu <olvaffe@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 8513b671f871..96365a772f77 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
 	struct ww_acquire_ctx ticket;
 	struct list_head next;
 	u32 nents, total;
-	struct drm_gem_object *objs[];
+	struct drm_gem_object *objs[] __counted_by(total);
 };
 
 struct virtio_gpu_vbuffer;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Kees Cook, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 virtio_gpu_object_array.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: David Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Chia-I Wu <olvaffe@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 8513b671f871..96365a772f77 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
 	struct ww_acquire_ctx ticket;
 	struct list_head next;
 	u32 nents, total;
-	struct drm_gem_object *objs[];
+	struct drm_gem_object *objs[] __counted_by(total);
 };
 
 struct virtio_gpu_vbuffer;
-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 virtio_gpu_object_array.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: David Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Chia-I Wu <olvaffe@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 8513b671f871..96365a772f77 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
 	struct ww_acquire_ctx ticket;
 	struct list_head next;
 	u32 nents, total;
-	struct drm_gem_object *objs[];
+	struct drm_gem_object *objs[] __counted_by(total);
 };
 
 struct virtio_gpu_vbuffer;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Intel-gfx] [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:32   ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Kees Cook, Zack Rusin, VMware Graphics Reviewers, Daniel Vetter,
	dri-devel, Emma Anholt, Evan Quan, Alex Deucher,
	Christian König, 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, Maxime Ripard,
	David Airlie, Gerd Hoffmann, Gurchetan Singh, Chia-I Wu,
	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, amd-gfx, intel-gfx, linux-arm-msm, freedreno,
	nouveau, virtualization, llvm, linux-hardening

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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Nouveau] [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Melissa Wen, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul,
	Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Kees Cook, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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);
-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:32   ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Kees Cook, Emma Anholt, Melissa Wen, Daniel Vetter, dri-devel,
	Evan Quan, Alex Deucher, Christian König, 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,
	Maxime Ripard, David Airlie, Gerd Hoffmann, Gurchetan Singh,
	Chia-I Wu, Zack Rusin, VMware Graphics Reviewers,
	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,
	amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	virtualization, llvm, linux-hardening

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 <emma@anholt.net>
Cc: Melissa Wen <mwen@igalia.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/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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Nouveau] [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 <emma@anholt.net>
Cc: Melissa Wen <mwen@igalia.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/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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Kees Cook, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 <emma@anholt.net>
Cc: Melissa Wen <mwen@igalia.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/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 {
-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Melissa Wen, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul,
	Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 <emma@anholt.net>
Cc: Melissa Wen <mwen@igalia.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/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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [Intel-gfx] [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

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 <emma@anholt.net>
Cc: Melissa Wen <mwen@igalia.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/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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
@ 2023-09-22 17:32   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-22 17:32 UTC (permalink / raw)
  To: David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

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 <emma@anholt.net>
Cc: Melissa Wen <mwen@igalia.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/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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
  2023-09-22 17:32   ` [Nouveau] " Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:41     ` Alex Deucher
  -1 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:41 UTC (permalink / raw)
  To: Kees Cook
  Cc: David Airlie, Tejas Upadhyay, Emma Anholt, Tom Rix, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>
>  struct smu10_voltage_dependency_table {
>         uint32_t count;
> -       struct smu10_clock_voltage_dependency_record entries[];
> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>  };
>
>  struct smu10_clock_voltage_information {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-22 17:41     ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:41 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Matthew Brost, Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>
>  struct smu10_voltage_dependency_table {
>         uint32_t count;
> -       struct smu10_clock_voltage_dependency_record entries[];
> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>  };
>
>  struct smu10_clock_voltage_information {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-22 17:41     ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:41 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>
>  struct smu10_voltage_dependency_table {
>         uint32_t count;
> -       struct smu10_clock_voltage_dependency_record entries[];
> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>  };
>
>  struct smu10_clock_voltage_information {
> --
> 2.34.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-22 17:41     ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:41 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>
>  struct smu10_voltage_dependency_table {
>         uint32_t count;
> -       struct smu10_clock_voltage_dependency_record entries[];
> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>  };
>
>  struct smu10_clock_voltage_information {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-22 17:41     ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:41 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, nouveau, David Airlie, Alex Deucher, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Rodrigo Vivi, virtualization, Neil Armstrong, Xiaojian Du,
	Lang Yu, Bjorn Andersson, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Dmitry Baryshkov, Nirmoy Das,
	freedreno, Christian König, linux-hardening

On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>
>  struct smu10_voltage_dependency_table {
>         uint32_t count;
> -       struct smu10_clock_voltage_dependency_record entries[];
> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>  };
>
>  struct smu10_clock_voltage_information {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-22 17:41     ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:41 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>
>  struct smu10_voltage_dependency_table {
>         uint32_t count;
> -       struct smu10_clock_voltage_dependency_record entries[];
> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>  };
>
>  struct smu10_clock_voltage_information {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
  2023-09-22 17:32   ` [Nouveau] " Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 17:42     ` Alex Deucher
  -1 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:42 UTC (permalink / raw)
  To: Kees Cook
  Cc: David Airlie, Tejas Upadhyay, Emma Anholt, Tom Rix, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Fri, Sep 22, 2023 at 1:33 PM Kees Cook <keescook@chromium.org> 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 ip_hw_instance.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>         u8  harvest;
>
>         int num_base_addresses;
> -       u32 base_addr[];
> +       u32 base_addr[] __counted_by(num_base_addresses);
>  };
>
>  struct ip_hw_id {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-22 17:42     ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:42 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Matthew Brost, Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Fri, Sep 22, 2023 at 1:33 PM Kees Cook <keescook@chromium.org> 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 ip_hw_instance.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>         u8  harvest;
>
>         int num_base_addresses;
> -       u32 base_addr[];
> +       u32 base_addr[] __counted_by(num_base_addresses);
>  };
>
>  struct ip_hw_id {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-22 17:42     ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:42 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Fri, Sep 22, 2023 at 1:33 PM Kees Cook <keescook@chromium.org> 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 ip_hw_instance.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>         u8  harvest;
>
>         int num_base_addresses;
> -       u32 base_addr[];
> +       u32 base_addr[] __counted_by(num_base_addresses);
>  };
>
>  struct ip_hw_id {
> --
> 2.34.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-22 17:42     ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:42 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Fri, Sep 22, 2023 at 1:33 PM Kees Cook <keescook@chromium.org> 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 ip_hw_instance.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>         u8  harvest;
>
>         int num_base_addresses;
> -       u32 base_addr[];
> +       u32 base_addr[] __counted_by(num_base_addresses);
>  };
>
>  struct ip_hw_id {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-22 17:42     ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:42 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, nouveau, David Airlie, Alex Deucher, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Rodrigo Vivi, virtualization, Neil Armstrong, Xiaojian Du,
	Lang Yu, Bjorn Andersson, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Dmitry Baryshkov, Nirmoy Das,
	freedreno, Christian König, linux-hardening

On Fri, Sep 22, 2023 at 1:33 PM Kees Cook <keescook@chromium.org> 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 ip_hw_instance.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>         u8  harvest;
>
>         int num_base_addresses;
> -       u32 base_addr[];
> +       u32 base_addr[] __counted_by(num_base_addresses);
>  };
>
>  struct ip_hw_id {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-22 17:42     ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-22 17:42 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Fri, Sep 22, 2023 at 1:33 PM Kees Cook <keescook@chromium.org> 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 ip_hw_instance.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>         u8  harvest;
>
>         int num_base_addresses;
> -       u32 base_addr[];
> +       u32 base_addr[] __counted_by(num_base_addresses);
>  };
>
>  struct ip_hw_id {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
  2023-09-22 17:32   ` Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-09-22 19:00     ` Lyude Paul
  -1 siblings, 0 replies; 243+ messages in thread
From: Lyude Paul @ 2023-09-22 19:00 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Ben Skeggs, Karol Herbst, Daniel Vetter, dri-devel, nouveau,
	Emma Anholt, Evan Quan, Alex Deucher, Christian König, 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, Maxime Ripard, 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, amd-gfx, intel-gfx,
	linux-arm-msm, freedreno, virtualization, llvm, linux-hardening

Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks!

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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>  	u8  mode;
>  	u32 clk;
>  	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>  };
>  
>  struct nvkm_funcdom {

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-22 19:00     ` Lyude Paul
  0 siblings, 0 replies; 243+ messages in thread
From: Lyude Paul @ 2023-09-22 19:00 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, nouveau, Joonas Lahtinen, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Emma Anholt,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang

Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks!

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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>  	u8  mode;
>  	u32 clk;
>  	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>  };
>  
>  struct nvkm_funcdom {

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-22 19:00     ` Lyude Paul
  0 siblings, 0 replies; 243+ messages in thread
From: Lyude Paul @ 2023-09-22 19:00 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Karol Herbst, nouveau, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Emma Anholt, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang

Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks!

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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>  	u8  mode;
>  	u32 clk;
>  	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>  };
>  
>  struct nvkm_funcdom {

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-22 19:00     ` Lyude Paul
  0 siblings, 0 replies; 243+ messages in thread
From: Lyude Paul @ 2023-09-22 19:00 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Karol Herbst, nouveau, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Emma Anholt,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks!

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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>  	u8  mode;
>  	u32 clk;
>  	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>  };
>  
>  struct nvkm_funcdom {

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-22 19:00     ` Lyude Paul
  0 siblings, 0 replies; 243+ messages in thread
From: Lyude Paul @ 2023-09-22 19:00 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Karol Herbst, nouveau, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Emma Anholt, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, Nathan Chancellor, VMware Graphics Reviewers,
	Ben Skeggs, Tom Rix, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks!

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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>  	u8  mode;
>  	u32 clk;
>  	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>  };
>  
>  struct nvkm_funcdom {

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-22 19:00     ` Lyude Paul
  0 siblings, 0 replies; 243+ messages in thread
From: Lyude Paul @ 2023-09-22 19:00 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Karol Herbst, nouveau, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Emma Anholt,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang

Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks!

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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>  	u8  mode;
>  	u32 clk;
>  	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>  };
>  
>  struct nvkm_funcdom {

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
  2023-09-22 17:32   ` Kees Cook
                       ` (2 preceding siblings ...)
  (?)
@ 2023-09-22 21:50     ` Zack Rusin
  -1 siblings, 0 replies; 243+ messages in thread
From: Zack Rusin @ 2023-09-22 21:50 UTC (permalink / raw)
  To: keescook, airlied
  Cc: tejas.upadhyay, emma, trix, llvm, dri-devel, chris, Prike.Liang,
	ray.huang, linux-hardening, andrzej.hajda, marijn.suijten,
	matthew.brost, evan.quan, kherbst, neil.armstrong, amd-gfx,
	quic_khsieh, Linux-graphics-maintainer, bskeggs, andi.shyti,
	nouveau, airlied, alexander.deucher, lijo.lazar, tvrtko.ursulin,
	linux-arm-msm, intel-gfx, kevin1.wang, quic_abhinavk, mripard,
	nathan, le.ma, gurchetansingh, rodrigo.vivi, virtualization,
	sean, yifan1.zhang, kraxel, Xiaojian.Du, freedreno, andersson,
	Xinhui.Pan, ndesaulniers, linux-kernel, mwen, dmitry.baryshkov,
	Hawking.Zhang, Lang.Yu, christian.koenig, john.c.harrison,
	nirmoy.das

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>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-22 21:50     ` Zack Rusin
  0 siblings, 0 replies; 243+ messages in thread
From: Zack Rusin @ 2023-09-22 21:50 UTC (permalink / raw)
  To: keescook, airlied
  Cc: nathan, emma, quic_abhinavk, virtualization, kherbst, evan.quan,
	lijo.lazar, marijn.suijten, Lang.Yu, mripard, ray.huang,
	linux-hardening, kraxel, chris, linux-kernel, joonas.lahtinen,
	nirmoy.das, amd-gfx, Xinhui.Pan, airlied, christian.koenig,
	jani.nikula, dmitry.baryshkov, yifan1.zhang, le.ma, intel-gfx,
	andersson, rodrigo.vivi, quic_khsieh, sean, andi.shyti,
	gurchetansingh, mwen, bskeggs, trix, matthew.brost, Prike.Liang,
	tejas.upadhyay, john.c.harrison, lyude, ndesaulniers,
	alexander.deucher, daniel, Linux-graphics-maintainer, olvaffe,
	andrzej.hajda, Hawking.Zhang, freedreno, dri-devel,
	tvrtko.ursulin, Xiaojian.Du, robdclark, kevin1.wang,
	linux-arm-msm, neil.armstrong, llvm, nouveau

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>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-22 21:50     ` Zack Rusin
  0 siblings, 0 replies; 243+ messages in thread
From: Zack Rusin @ 2023-09-22 21:50 UTC (permalink / raw)
  To: keescook, airlied
  Cc: emma, trix, llvm, dri-devel, chris, Prike.Liang, ray.huang,
	linux-hardening, andrzej.hajda, marijn.suijten, evan.quan,
	kherbst, neil.armstrong, amd-gfx, quic_khsieh,
	Linux-graphics-maintainer, bskeggs, nouveau, airlied, olvaffe,
	alexander.deucher, lijo.lazar, linux-arm-msm, intel-gfx,
	kevin1.wang, quic_abhinavk, mripard, nathan, le.ma,
	gurchetansingh, rodrigo.vivi, virtualization, yifan1.zhang,
	kraxel, Xiaojian.Du, freedreno, andersson, Xinhui.Pan,
	ndesaulniers, linux-kernel, mwen, daniel, dmitry.baryshkov,
	Hawking.Zhang, Lang.Yu, christian.koenig, nirmoy.das

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>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-22 21:50     ` Zack Rusin
  0 siblings, 0 replies; 243+ messages in thread
From: Zack Rusin @ 2023-09-22 21:50 UTC (permalink / raw)
  To: keescook, airlied
  Cc: tejas.upadhyay, emma, trix, joonas.lahtinen, llvm, dri-devel,
	chris, Prike.Liang, ray.huang, linux-hardening, andrzej.hajda,
	marijn.suijten, matthew.brost, evan.quan, kherbst,
	neil.armstrong, amd-gfx, quic_khsieh, Linux-graphics-maintainer,
	bskeggs, andi.shyti, nouveau, airlied, olvaffe,
	alexander.deucher, lijo.lazar, tvrtko.ursulin, linux-arm-msm,
	intel-gfx, kevin1.wang, quic_abhinavk, mripard, nathan, le.ma,
	gurchetansingh, jani.nikula, rodrigo.vivi, virtualization, sean,
	yifan1.zhang, kraxel, Xiaojian.Du, freedreno, andersson,
	Xinhui.Pan, ndesaulniers, linux-kernel, robdclark, mwen, daniel,
	dmitry.baryshkov, Hawking.Zhang, Lang.Yu, christian.koenig,
	john.c.harrison, nirmoy.das

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>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-22 21:50     ` Zack Rusin
  0 siblings, 0 replies; 243+ messages in thread
From: Zack Rusin @ 2023-09-22 21:50 UTC (permalink / raw)
  To: keescook, airlied
  Cc: tejas.upadhyay, emma, trix, joonas.lahtinen, llvm, dri-devel,
	chris, Prike.Liang, ray.huang, linux-hardening, andrzej.hajda,
	marijn.suijten, matthew.brost, evan.quan, neil.armstrong,
	amd-gfx, quic_khsieh, Linux-graphics-maintainer, bskeggs,
	andi.shyti, nouveau, airlied, olvaffe, alexander.deucher,
	lijo.lazar, tvrtko.ursulin, linux-arm-msm, intel-gfx,
	kevin1.wang, quic_abhinavk, mripard, nathan, le.ma,
	gurchetansingh, jani.nikula, rodrigo.vivi, virtualization, sean,
	yifan1.zhang, kraxel, Xiaojian.Du, freedreno, andersson,
	Xinhui.Pan, ndesaulniers, linux-kernel, robdclark, mwen, daniel,
	dmitry.baryshkov, Hawking.Zhang, Lang.Yu, christian.koenig,
	john.c.harrison, nirmoy.das

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>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
  2023-09-22 17:32   ` [Nouveau] " Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-09-23  2:13     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:13 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Evan Quan, Alex Deucher, Christian König, Pan, Xinhui,
	Daniel Vetter, Xiaojian Du, Huang Rui, Kevin Wang, amd-gfx,
	dri-devel, Emma Anholt, 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,
	Maxime Ripard, 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,
	intel-gfx, linux-arm-msm, freedreno, nouveau, virtualization,
	llvm, linux-hardening



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 smu10_voltage_dependency_table.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>   
>   struct smu10_voltage_dependency_table {
>   	uint32_t count;
> -	struct smu10_clock_voltage_dependency_record entries[];
> +	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>   };
>   
>   struct smu10_clock_voltage_information {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-23  2:13     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:13 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 smu10_voltage_dependency_table.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>   
>   struct smu10_voltage_dependency_table {
>   	uint32_t count;
> -	struct smu10_clock_voltage_dependency_record entries[];
> +	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>   };
>   
>   struct smu10_clock_voltage_information {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-23  2:13     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:13 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang



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 smu10_voltage_dependency_table.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>   
>   struct smu10_voltage_dependency_table {
>   	uint32_t count;
> -	struct smu10_clock_voltage_dependency_record entries[];
> +	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>   };
>   
>   struct smu10_clock_voltage_information {
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-23  2:13     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:13 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang



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 smu10_voltage_dependency_table.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>   
>   struct smu10_voltage_dependency_table {
>   	uint32_t count;
> -	struct smu10_clock_voltage_dependency_record entries[];
> +	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>   };
>   
>   struct smu10_clock_voltage_information {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-23  2:13     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:13 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang



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 smu10_voltage_dependency_table.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>   
>   struct smu10_voltage_dependency_table {
>   	uint32_t count;
> -	struct smu10_clock_voltage_dependency_record entries[];
> +	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>   };
>   
>   struct smu10_clock_voltage_information {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-23  2:13     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:13 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 smu10_voltage_dependency_table.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Evan Quan <evan.quan@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Kevin Wang <kevin1.wang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> index 808e0ecbe1f0..42adc2a3dcbc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>   
>   struct smu10_voltage_dependency_table {
>   	uint32_t count;
> -	struct smu10_clock_voltage_dependency_record entries[];
> +	struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>   };
>   
>   struct smu10_clock_voltage_information {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
  2023-09-22 17:32   ` [Nouveau] " Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang



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 ip_hw_instance.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>   	u8  harvest;
>   
>   	int num_base_addresses;
> -	u32 base_addr[];
> +	u32 base_addr[] __counted_by(num_base_addresses);
>   };
>   
>   struct ip_hw_id {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 ip_hw_instance.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>   	u8  harvest;
>   
>   	int num_base_addresses;
> -	u32 base_addr[];
> +	u32 base_addr[] __counted_by(num_base_addresses);
>   };
>   
>   struct ip_hw_id {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang



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 ip_hw_instance.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>   	u8  harvest;
>   
>   	int num_base_addresses;
> -	u32 base_addr[];
> +	u32 base_addr[] __counted_by(num_base_addresses);
>   };
>   
>   struct ip_hw_id {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Alex Deucher, Christian König, Pan, Xinhui, Daniel Vetter,
	Hawking Zhang, amd-gfx, dri-devel, Emma Anholt, Evan Quan,
	Xiaojian Du, Huang Rui, Kevin Wang, 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, Maxime Ripard,
	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,
	intel-gfx, linux-arm-msm, freedreno, nouveau, virtualization,
	llvm, linux-hardening



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 ip_hw_instance.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>   	u8  harvest;
>   
>   	int num_base_addresses;
> -	u32 base_addr[];
> +	u32 base_addr[] __counted_by(num_base_addresses);
>   };
>   
>   struct ip_hw_id {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang



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 ip_hw_instance.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>   	u8  harvest;
>   
>   	int num_base_addresses;
> -	u32 base_addr[];
> +	u32 base_addr[] __counted_by(num_base_addresses);
>   };
>   
>   struct ip_hw_id {
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 ip_hw_instance.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index d1bc7b212520..be4c97a3d7bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -662,7 +662,7 @@ struct ip_hw_instance {
>   	u8  harvest;
>   
>   	int num_base_addresses;
> -	u32 base_addr[];
> +	u32 base_addr[] __counted_by(num_base_addresses);
>   };
>   
>   struct ip_hw_id {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
  2023-09-22 17:32   ` Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	Daniel Vetter, Chris Wilson, John Harrison, Andi Shyti,
	Matthew Brost, intel-gfx, dri-devel, Emma Anholt, Evan Quan,
	Alex Deucher, Christian König, Pan, Xinhui, Xiaojian Du,
	Huang Rui, Kevin Wang, Hawking Zhang, Rob Clark, Abhinav Kumar,
	Dmitry Baryshkov, Sean Paul, Marijn Suijten, Bjorn Andersson,
	Ben Skeggs, Karol Herbst, Lyude Paul, Maxime Ripard,
	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,
	amd-gfx, linux-arm-msm, freedreno, nouveau, virtualization, llvm,
	linux-hardening



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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang



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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang



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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang



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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-23  2:14     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:14 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
  2023-09-22 17:32   ` Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
	Marijn Suijten, Daniel Vetter, Bjorn Andersson, linux-arm-msm,
	dri-devel, freedreno, Emma Anholt, Evan Quan, Alex Deucher,
	Christian König, 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, Ben Skeggs, Karol Herbst, Lyude Paul,
	Maxime Ripard, 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,
	amd-gfx, intel-gfx, nouveau, virtualization, llvm,
	linux-hardening



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 dpu_hw_intr.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Marijn Suijten <marijn.suijten@somainline.org>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: freedreno@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> index dab761e54863..50cf9523d367 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> @@ -61,7 +61,7 @@ struct dpu_hw_intr {
>   		void (*cb)(void *arg, int irq_idx);
>   		void *arg;
>   		atomic_t count;
> -	} irq_tbl[];
> +	} irq_tbl[] __counted_by(total_irqs);
>   };
>   
>   /**

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, Lang Yu,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	freedreno, Christian König, John Harrison, Hawking Zhang



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 dpu_hw_intr.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Marijn Suijten <marijn.suijten@somainline.org>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: freedreno@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> index dab761e54863..50cf9523d367 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> @@ -61,7 +61,7 @@ struct dpu_hw_intr {
>   		void (*cb)(void *arg, int irq_idx);
>   		void *arg;
>   		atomic_t count;
> -	} irq_tbl[];
> +	} irq_tbl[] __counted_by(total_irqs);
>   };
>   
>   /**

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	Lang Yu, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, freedreno, Christian König, John Harrison,
	Hawking Zhang



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 dpu_hw_intr.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Marijn Suijten <marijn.suijten@somainline.org>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: freedreno@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> index dab761e54863..50cf9523d367 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> @@ -61,7 +61,7 @@ struct dpu_hw_intr {
>   		void (*cb)(void *arg, int irq_idx);
>   		void *arg;
>   		atomic_t count;
> -	} irq_tbl[];
> +	} irq_tbl[] __counted_by(total_irqs);
>   };
>   
>   /**
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, Lang Yu, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, freedreno,
	Christian König, John Harrison, Hawking Zhang



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 dpu_hw_intr.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Marijn Suijten <marijn.suijten@somainline.org>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: freedreno@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> index dab761e54863..50cf9523d367 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> @@ -61,7 +61,7 @@ struct dpu_hw_intr {
>   		void (*cb)(void *arg, int irq_idx);
>   		void *arg;
>   		atomic_t count;
> -	} irq_tbl[];
> +	} irq_tbl[] __counted_by(total_irqs);
>   };
>   
>   /**

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, Lang Yu, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, freedreno,
	Christian König, Hawking Zhang



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 dpu_hw_intr.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Marijn Suijten <marijn.suijten@somainline.org>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: freedreno@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> index dab761e54863..50cf9523d367 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> @@ -61,7 +61,7 @@ struct dpu_hw_intr {
>   		void (*cb)(void *arg, int irq_idx);
>   		void *arg;
>   		atomic_t count;
> -	} irq_tbl[];
> +	} irq_tbl[] __counted_by(total_irqs);
>   };
>   
>   /**

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, Lang Yu,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	freedreno, Christian König, John Harrison, Hawking Zhang



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 dpu_hw_intr.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Marijn Suijten <marijn.suijten@somainline.org>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: freedreno@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> index dab761e54863..50cf9523d367 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
> @@ -61,7 +61,7 @@ struct dpu_hw_intr {
>   		void (*cb)(void *arg, int irq_idx);
>   		void *arg;
>   		atomic_t count;
> -	} irq_tbl[];
> +	} irq_tbl[] __counted_by(total_irqs);
>   };
>   
>   /**

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
  2023-09-22 17:32   ` Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Ben Skeggs, Karol Herbst, Lyude Paul, Daniel Vetter, dri-devel,
	nouveau, Emma Anholt, Evan Quan, Alex Deucher,
	Christian König, 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,
	Maxime Ripard, 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,
	amd-gfx, intel-gfx, linux-arm-msm, freedreno, virtualization,
	llvm, linux-hardening



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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>   	u8  mode;
>   	u32 clk;
>   	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>   };
>   
>   struct nvkm_funcdom {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, nouveau, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>   	u8  mode;
>   	u32 clk;
>   	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>   };
>   
>   struct nvkm_funcdom {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, nouveau, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang



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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>   	u8  mode;
>   	u32 clk;
>   	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>   };
>   
>   struct nvkm_funcdom {
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Emma Anholt, nouveau, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	Tom Rix, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang



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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>   	u8  mode;
>   	u32 clk;
>   	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>   };
>   
>   struct nvkm_funcdom {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, nouveau, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang



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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>   	u8  mode;
>   	u32 clk;
>   	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>   };
>   
>   struct nvkm_funcdom {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
@ 2023-09-23  2:15     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:15 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, nouveau, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, Tom Rix,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 nvkm_perfdom.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> index 6ae25d3e7f45..c011227f7052 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
> @@ -82,7 +82,7 @@ struct nvkm_perfdom {
>   	u8  mode;
>   	u32 clk;
>   	u16 signal_nr;
> -	struct nvkm_perfsig signal[];
> +	struct nvkm_perfsig signal[] __counted_by(signal_nr);
>   };
>   
>   struct nvkm_funcdom {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
  2023-09-22 17:32   ` Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-09-23  2:16     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:16 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Emma Anholt, Maxime Ripard, Daniel Vetter, dri-devel, Evan Quan,
	Alex Deucher, Christian König, 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,
	amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	virtualization, llvm, linux-hardening



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 <emma@anholt.net>
> Cc: Maxime Ripard <mripard@kernel.org>
> 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

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 {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
@ 2023-09-23  2:16     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:16 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 <emma@anholt.net>
> Cc: Maxime Ripard <mripard@kernel.org>
> 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

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 {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
@ 2023-09-23  2:16     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:16 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang



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 <emma@anholt.net>
> Cc: Maxime Ripard <mripard@kernel.org>
> 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

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 {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
@ 2023-09-23  2:16     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:16 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang



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 <emma@anholt.net>
> Cc: Maxime Ripard <mripard@kernel.org>
> 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

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 {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
@ 2023-09-23  2:16     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:16 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang



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 <emma@anholt.net>
> Cc: Maxime Ripard <mripard@kernel.org>
> 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

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 {
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
@ 2023-09-23  2:16     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:16 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 <emma@anholt.net>
> Cc: Maxime Ripard <mripard@kernel.org>
> 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

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 {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
  2023-09-22 17:32   ` Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-09-23  2:36     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:36 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: David Airlie, Gerd Hoffmann, Gurchetan Singh, Chia-I Wu,
	Daniel Vetter, dri-devel, virtualization, Emma Anholt, Evan Quan,
	Alex Deucher, Christian König, 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,
	Maxime Ripard, 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, amd-gfx, intel-gfx, linux-arm-msm, freedreno,
	nouveau, llvm, linux-hardening



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 virtio_gpu_object_array.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: David Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Gurchetan Singh <gurchetansingh@chromium.org>
> Cc: Chia-I Wu <olvaffe@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: virtualization@lists.linux-foundation.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
> index 8513b671f871..96365a772f77 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.h
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
> @@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
>   	struct ww_acquire_ctx ticket;
>   	struct list_head next;
>   	u32 nents, total;
> -	struct drm_gem_object *objs[];
> +	struct drm_gem_object *objs[] __counted_by(total);
>   };
>   
>   struct virtio_gpu_vbuffer;

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
@ 2023-09-23  2:36     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:36 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 virtio_gpu_object_array.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: David Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Gurchetan Singh <gurchetansingh@chromium.org>
> Cc: Chia-I Wu <olvaffe@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: virtualization@lists.linux-foundation.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
> index 8513b671f871..96365a772f77 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.h
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
> @@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
>   	struct ww_acquire_ctx ticket;
>   	struct list_head next;
>   	u32 nents, total;
> -	struct drm_gem_object *objs[];
> +	struct drm_gem_object *objs[] __counted_by(total);
>   };
>   
>   struct virtio_gpu_vbuffer;

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
@ 2023-09-23  2:36     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:36 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang



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 virtio_gpu_object_array.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: David Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Gurchetan Singh <gurchetansingh@chromium.org>
> Cc: Chia-I Wu <olvaffe@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: virtualization@lists.linux-foundation.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
> index 8513b671f871..96365a772f77 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.h
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
> @@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
>   	struct ww_acquire_ctx ticket;
>   	struct list_head next;
>   	u32 nents, total;
> -	struct drm_gem_object *objs[];
> +	struct drm_gem_object *objs[] __counted_by(total);
>   };
>   
>   struct virtio_gpu_vbuffer;
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
@ 2023-09-23  2:36     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:36 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang



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 virtio_gpu_object_array.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: David Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Gurchetan Singh <gurchetansingh@chromium.org>
> Cc: Chia-I Wu <olvaffe@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: virtualization@lists.linux-foundation.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
> index 8513b671f871..96365a772f77 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.h
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
> @@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
>   	struct ww_acquire_ctx ticket;
>   	struct list_head next;
>   	u32 nents, total;
> -	struct drm_gem_object *objs[];
> +	struct drm_gem_object *objs[] __counted_by(total);
>   };
>   
>   struct virtio_gpu_vbuffer;

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
@ 2023-09-23  2:36     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:36 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang



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 virtio_gpu_object_array.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: David Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Gurchetan Singh <gurchetansingh@chromium.org>
> Cc: Chia-I Wu <olvaffe@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: virtualization@lists.linux-foundation.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
> index 8513b671f871..96365a772f77 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.h
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
> @@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
>   	struct ww_acquire_ctx ticket;
>   	struct list_head next;
>   	u32 nents, total;
> -	struct drm_gem_object *objs[];
> +	struct drm_gem_object *objs[] __counted_by(total);
>   };
>   
>   struct virtio_gpu_vbuffer;

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
@ 2023-09-23  2:36     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:36 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 virtio_gpu_object_array.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: David Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Gurchetan Singh <gurchetansingh@chromium.org>
> Cc: Chia-I Wu <olvaffe@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: virtualization@lists.linux-foundation.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

> ---
>   drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
> index 8513b671f871..96365a772f77 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.h
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
> @@ -119,7 +119,7 @@ struct virtio_gpu_object_array {
>   	struct ww_acquire_ctx ticket;
>   	struct list_head next;
>   	u32 nents, total;
> -	struct drm_gem_object *objs[];
> +	struct drm_gem_object *objs[] __counted_by(total);
>   };
>   
>   struct virtio_gpu_vbuffer;

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
  2023-09-22 17:32   ` Kees Cook
                       ` (2 preceding siblings ...)
  (?)
@ 2023-09-23  2:37     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:37 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Zack Rusin, VMware Graphics Reviewers, Daniel Vetter, dri-devel,
	Emma Anholt, Evan Quan, Alex Deucher, Christian König, 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, Maxime Ripard, David Airlie, Gerd Hoffmann,
	Gurchetan Singh, Chia-I Wu, 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, amd-gfx, intel-gfx,
	linux-arm-msm, freedreno, nouveau, virtualization, llvm,
	linux-hardening



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 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   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);

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-23  2:37     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:37 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   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);

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-23  2:37     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:37 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang



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 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   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);
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-23  2:37     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:37 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang



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 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   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);

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
@ 2023-09-23  2:37     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 243+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-23  2:37 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



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 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>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo


> ---
>   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);

^ permalink raw reply	[flat|nested] 243+ messages in thread

* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Annotate structs with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                   ` (13 preceding siblings ...)
  (?)
@ 2023-09-23  3:16 ` Patchwork
  -1 siblings, 0 replies; 243+ messages in thread
From: Patchwork @ 2023-09-23  3:16 UTC (permalink / raw)
  To: Kees Cook; +Cc: intel-gfx

== Series Details ==

Series: drm: Annotate structs with __counted_by
URL   : https://patchwork.freedesktop.org/series/124132/
State : warning

== Summary ==

Error: dim checkpatch failed
9f6367f6bba6 drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
-:16: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#16: 
As found with Coccinelle[1], add __counted_by for struct smu10_voltage_dependency_table.

total: 0 errors, 1 warnings, 0 checks, 8 lines checked
9ec02f5f04c1 drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
-:18: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#18: 
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

total: 0 errors, 1 warnings, 0 checks, 8 lines checked
d07140c4994e drm/i915/selftests: Annotate struct perf_series with __counted_by
-:15: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#15: 
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

total: 0 errors, 1 warnings, 0 checks, 8 lines checked
664da6fca719 drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
-:14: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#14: 
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

total: 0 errors, 1 warnings, 0 checks, 8 lines checked
d2b05410610a drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
-:15: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#15: 
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

total: 0 errors, 1 warnings, 0 checks, 8 lines checked
514d463e24c8 drm/vc4: Annotate struct vc4_perfmon with __counted_by
-:14: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#14: 
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

total: 0 errors, 1 warnings, 0 checks, 8 lines checked
a737e3fe4537 drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
-:13: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#13: 
As found with Coccinelle[1], add __counted_by for struct virtio_gpu_object_array.

total: 0 errors, 1 warnings, 0 checks, 8 lines checked
70be431674a5 drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
-:15: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#15: 
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

-:34: CHECK:CAMELCASE: Avoid CamelCase: <SVGA3dBox>
#34: FILE: drivers/gpu/drm/vmwgfx/vmwgfx_surface.c:80:
+	SVGA3dBox boxes[] __counted_by(num_subres);

total: 0 errors, 1 warnings, 1 checks, 8 lines checked
9d9b14d43eb2 drm/v3d: Annotate struct v3d_perfmon with __counted_by
-:14: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#14: 
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

total: 0 errors, 1 warnings, 0 checks, 8 lines checked



^ permalink raw reply	[flat|nested] 243+ messages in thread

* [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm: Annotate structs with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                   ` (14 preceding siblings ...)
  (?)
@ 2023-09-23  3:16 ` Patchwork
  -1 siblings, 0 replies; 243+ messages in thread
From: Patchwork @ 2023-09-23  3:16 UTC (permalink / raw)
  To: Kees Cook; +Cc: intel-gfx

== Series Details ==

Series: drm: Annotate structs with __counted_by
URL   : https://patchwork.freedesktop.org/series/124132/
State : warning

== Summary ==

Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
-
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return'
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:315:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:319:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:315:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
+drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:319:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return'
+./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced symbol 'mask'
+./include/asm-generic/bito



^ permalink raw reply	[flat|nested] 243+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm: Annotate structs with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                   ` (15 preceding siblings ...)
  (?)
@ 2023-09-23  3:34 ` Patchwork
  -1 siblings, 0 replies; 243+ messages in thread
From: Patchwork @ 2023-09-23  3:34 UTC (permalink / raw)
  To: Kees Cook; +Cc: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 5274 bytes --]

== Series Details ==

Series: drm: Annotate structs with __counted_by
URL   : https://patchwork.freedesktop.org/series/124132/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_13671 -> Patchwork_124132v1
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_124132v1 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_124132v1, please notify your bug team (lgci.bug.filing@intel.com) to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124132v1/index.html

Participating hosts (39 -> 38)
------------------------------

  Additional (1): fi-hsw-4770 
  Missing    (2): fi-kbl-soraka fi-snb-2520m 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_124132v1:

### IGT changes ###

#### Possible regressions ####

  * igt@gem_exec_fence@basic-await@vecs1:
    - bat-dg2-11:         [PASS][1] -> [FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13671/bat-dg2-11/igt@gem_exec_fence@basic-await@vecs1.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124132v1/bat-dg2-11/igt@gem_exec_fence@basic-await@vecs1.html

  
Known issues
------------

  Here are the changes found in Patchwork_124132v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_selftest@live@requests:
    - bat-mtlp-8:         [PASS][3] -> [ABORT][4] ([i915#9262])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13671/bat-mtlp-8/igt@i915_selftest@live@requests.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124132v1/bat-mtlp-8/igt@i915_selftest@live@requests.html

  * igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
    - fi-hsw-4770:        NOTRUN -> [SKIP][5] ([fdo#109271]) +13 other tests skip
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124132v1/fi-hsw-4770/igt@kms_addfb_basic@addfb25-y-tiled-small-legacy.html

  * igt@kms_hdmi_inject@inject-audio:
    - fi-kbl-guc:         [PASS][6] -> [FAIL][7] ([IGT#3])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13671/fi-kbl-guc/igt@kms_hdmi_inject@inject-audio.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124132v1/fi-kbl-guc/igt@kms_hdmi_inject@inject-audio.html

  * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-vga-1:
    - fi-hsw-4770:        NOTRUN -> [DMESG-WARN][8] ([i915#8841]) +6 other tests dmesg-warn
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124132v1/fi-hsw-4770/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-vga-1.html

  * igt@kms_psr@sprite_plane_onoff:
    - fi-hsw-4770:        NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#1072]) +3 other tests skip
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124132v1/fi-hsw-4770/igt@kms_psr@sprite_plane_onoff.html

  
#### Possible fixes ####

  * igt@gem_exec_suspend@basic-s0@lmem0:
    - bat-dg2-9:          [INCOMPLETE][10] ([i915#9275]) -> [PASS][11]
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13671/bat-dg2-9/igt@gem_exec_suspend@basic-s0@lmem0.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124132v1/bat-dg2-9/igt@gem_exec_suspend@basic-s0@lmem0.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [IGT#3]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/3
  [Intel XE#485]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/485
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#8841]: https://gitlab.freedesktop.org/drm/intel/issues/8841
  [i915#9262]: https://gitlab.freedesktop.org/drm/intel/issues/9262
  [i915#9275]: https://gitlab.freedesktop.org/drm/intel/issues/9275


Build changes
-------------

  * Linux: CI_DRM_13671 -> Patchwork_124132v1

  CI-20190529: 20190529
  CI_DRM_13671: e1973de2c4516e9130157e538014e79c8aa57b41 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_7498: 05d14fd260a3cf9dc00ed24733d5589eee32ec08 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_124132v1: e1973de2c4516e9130157e538014e79c8aa57b41 @ git://anongit.freedesktop.org/gfx-ci/linux


### Linux commits

7bd5a5d2765d drm/v3d: Annotate struct v3d_perfmon with __counted_by
a8d273897aa2 drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
d83f77480153 drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
530ec7bbb8d1 drm/vc4: Annotate struct vc4_perfmon with __counted_by
31415effa7db drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
81fc4118fa06 drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
725e5d29ae76 drm/i915/selftests: Annotate struct perf_series with __counted_by
cf7cceb525a0 drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
6c10174386e9 drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124132v1/index.html

[-- Attachment #2: Type: text/html, Size: 6111 bytes --]

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
  2023-09-22 17:41     ` [Nouveau] " Alex Deucher
                         ` (3 preceding siblings ...)
  (?)
@ 2023-09-25  6:30       ` Christian König
  -1 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-09-25  6:30 UTC (permalink / raw)
  To: Alex Deucher, Kees Cook
  Cc: David Airlie, Tejas Upadhyay, Emma Anholt, Tom Rix, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu, John Harrison,
	Hawking Zhang

Am 22.09.23 um 19:41 schrieb Alex Deucher:
> On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>>
>> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>>
>> Cc: Evan Quan <evan.quan@amd.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: "Christian König" <christian.koenig@amd.com>
>> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
>> Cc: David Airlie <airlied@gmail.com>
>> Cc: Daniel Vetter <daniel@ffwll.ch>
>> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
>> Cc: Huang Rui <ray.huang@amd.com>
>> Cc: Kevin Wang <kevin1.wang@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org
>> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Alex Deucher <alexander.deucher@amd.com>

Mhm, I'm not sure if this is a good idea. That is a structure filled in 
by the firmware, isn't it?

That would imply that we might need to byte swap count before it is 
checkable.

Regards,
Christian.

>
>> ---
>>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> index 808e0ecbe1f0..42adc2a3dcbc 100644
>> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>>
>>   struct smu10_voltage_dependency_table {
>>          uint32_t count;
>> -       struct smu10_clock_voltage_dependency_record entries[];
>> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>>   };
>>
>>   struct smu10_clock_voltage_information {
>> --
>> 2.34.1
>>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25  6:30       ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-09-25  6:30 UTC (permalink / raw)
  To: Alex Deucher, Kees Cook
  Cc: Pan, Xinhui, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Matthew Brost, Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

Am 22.09.23 um 19:41 schrieb Alex Deucher:
> On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>>
>> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>>
>> Cc: Evan Quan <evan.quan@amd.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: "Christian König" <christian.koenig@amd.com>
>> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
>> Cc: David Airlie <airlied@gmail.com>
>> Cc: Daniel Vetter <daniel@ffwll.ch>
>> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
>> Cc: Huang Rui <ray.huang@amd.com>
>> Cc: Kevin Wang <kevin1.wang@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org
>> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Alex Deucher <alexander.deucher@amd.com>

Mhm, I'm not sure if this is a good idea. That is a structure filled in 
by the firmware, isn't it?

That would imply that we might need to byte swap count before it is 
checkable.

Regards,
Christian.

>
>> ---
>>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> index 808e0ecbe1f0..42adc2a3dcbc 100644
>> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>>
>>   struct smu10_voltage_dependency_table {
>>          uint32_t count;
>> -       struct smu10_clock_voltage_dependency_record entries[];
>> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>>   };
>>
>>   struct smu10_clock_voltage_information {
>> --
>> 2.34.1
>>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25  6:30       ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König via Virtualization @ 2023-09-25  6:30 UTC (permalink / raw)
  To: Alex Deucher, Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

Am 22.09.23 um 19:41 schrieb Alex Deucher:
> On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>>
>> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>>
>> Cc: Evan Quan <evan.quan@amd.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: "Christian König" <christian.koenig@amd.com>
>> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
>> Cc: David Airlie <airlied@gmail.com>
>> Cc: Daniel Vetter <daniel@ffwll.ch>
>> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
>> Cc: Huang Rui <ray.huang@amd.com>
>> Cc: Kevin Wang <kevin1.wang@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org
>> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Alex Deucher <alexander.deucher@amd.com>

Mhm, I'm not sure if this is a good idea. That is a structure filled in 
by the firmware, isn't it?

That would imply that we might need to byte swap count before it is 
checkable.

Regards,
Christian.

>
>> ---
>>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> index 808e0ecbe1f0..42adc2a3dcbc 100644
>> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>>
>>   struct smu10_voltage_dependency_table {
>>          uint32_t count;
>> -       struct smu10_clock_voltage_dependency_record entries[];
>> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>>   };
>>
>>   struct smu10_clock_voltage_information {
>> --
>> 2.34.1
>>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25  6:30       ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-09-25  6:30 UTC (permalink / raw)
  To: Alex Deucher, Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

Am 22.09.23 um 19:41 schrieb Alex Deucher:
> On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>>
>> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>>
>> Cc: Evan Quan <evan.quan@amd.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: "Christian König" <christian.koenig@amd.com>
>> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
>> Cc: David Airlie <airlied@gmail.com>
>> Cc: Daniel Vetter <daniel@ffwll.ch>
>> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
>> Cc: Huang Rui <ray.huang@amd.com>
>> Cc: Kevin Wang <kevin1.wang@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org
>> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Alex Deucher <alexander.deucher@amd.com>

Mhm, I'm not sure if this is a good idea. That is a structure filled in 
by the firmware, isn't it?

That would imply that we might need to byte swap count before it is 
checkable.

Regards,
Christian.

>
>> ---
>>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> index 808e0ecbe1f0..42adc2a3dcbc 100644
>> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>>
>>   struct smu10_voltage_dependency_table {
>>          uint32_t count;
>> -       struct smu10_clock_voltage_dependency_record entries[];
>> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>>   };
>>
>>   struct smu10_clock_voltage_information {
>> --
>> 2.34.1
>>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25  6:30       ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-09-25  6:30 UTC (permalink / raw)
  To: Alex Deucher, Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, nouveau, David Airlie, Alex Deucher, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Rodrigo Vivi, virtualization, Neil Armstrong, Xiaojian Du,
	Lang Yu, Bjorn Andersson, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Dmitry Baryshkov, Nirmoy Das,
	freedreno, linux-hardening

Am 22.09.23 um 19:41 schrieb Alex Deucher:
> On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>>
>> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>>
>> Cc: Evan Quan <evan.quan@amd.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: "Christian König" <christian.koenig@amd.com>
>> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
>> Cc: David Airlie <airlied@gmail.com>
>> Cc: Daniel Vetter <daniel@ffwll.ch>
>> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
>> Cc: Huang Rui <ray.huang@amd.com>
>> Cc: Kevin Wang <kevin1.wang@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org
>> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Alex Deucher <alexander.deucher@amd.com>

Mhm, I'm not sure if this is a good idea. That is a structure filled in 
by the firmware, isn't it?

That would imply that we might need to byte swap count before it is 
checkable.

Regards,
Christian.

>
>> ---
>>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> index 808e0ecbe1f0..42adc2a3dcbc 100644
>> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>>
>>   struct smu10_voltage_dependency_table {
>>          uint32_t count;
>> -       struct smu10_clock_voltage_dependency_record entries[];
>> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>>   };
>>
>>   struct smu10_clock_voltage_information {
>> --
>> 2.34.1
>>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25  6:30       ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-09-25  6:30 UTC (permalink / raw)
  To: Alex Deucher, Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

Am 22.09.23 um 19:41 schrieb Alex Deucher:
> On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
>>
>> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>>
>> Cc: Evan Quan <evan.quan@amd.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: "Christian König" <christian.koenig@amd.com>
>> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
>> Cc: David Airlie <airlied@gmail.com>
>> Cc: Daniel Vetter <daniel@ffwll.ch>
>> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
>> Cc: Huang Rui <ray.huang@amd.com>
>> Cc: Kevin Wang <kevin1.wang@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org
>> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Alex Deucher <alexander.deucher@amd.com>

Mhm, I'm not sure if this is a good idea. That is a structure filled in 
by the firmware, isn't it?

That would imply that we might need to byte swap count before it is 
checkable.

Regards,
Christian.

>
>> ---
>>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> index 808e0ecbe1f0..42adc2a3dcbc 100644
>> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
>> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
>>
>>   struct smu10_voltage_dependency_table {
>>          uint32_t count;
>> -       struct smu10_clock_voltage_dependency_record entries[];
>> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
>>   };
>>
>>   struct smu10_clock_voltage_information {
>> --
>> 2.34.1
>>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
  2023-09-22 17:32   ` Kees Cook
                       ` (2 preceding siblings ...)
  (?)
@ 2023-09-25 10:08     ` Andrzej Hajda
  -1 siblings, 0 replies; 243+ messages in thread
From: Andrzej Hajda @ 2023-09-25 10:08 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	Daniel Vetter, Chris Wilson, John Harrison, Andi Shyti,
	Matthew Brost, intel-gfx, dri-devel, Emma Anholt, Evan Quan,
	Alex Deucher, Christian König, Pan, Xinhui, Xiaojian Du,
	Huang Rui, Kevin Wang, Hawking Zhang, Rob Clark, Abhinav Kumar,
	Dmitry Baryshkov, Sean Paul, Marijn Suijten, Bjorn Andersson,
	Ben Skeggs, Karol Herbst, Lyude Paul, Maxime Ripard,
	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,
	Neil Armstrong, Kuogee Hsieh, linux-kernel, amd-gfx,
	linux-arm-msm, freedreno, nouveau, virtualization, llvm,
	linux-hardening



On 22.09.2023 19: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 perf_series.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

I am surprised this is the only finding in i915, I would expected more. 
Anyway:

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 10:08     ` Andrzej Hajda
  0 siblings, 0 replies; 243+ messages in thread
From: Andrzej Hajda @ 2023-09-25 10:08 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Marijn Suijten, Matthew Brost, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, Nathan Chancellor, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	Chia-I Wu, linux-hardening, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang



On 22.09.2023 19: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 perf_series.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

I am surprised this is the only finding in i915, I would expected more. 
Anyway:

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 10:08     ` Andrzej Hajda
  0 siblings, 0 replies; 243+ messages in thread
From: Andrzej Hajda @ 2023-09-25 10:08 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang



On 22.09.2023 19: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 perf_series.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

I am surprised this is the only finding in i915, I would expected more. 
Anyway:

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 10:08     ` Andrzej Hajda
  0 siblings, 0 replies; 243+ messages in thread
From: Andrzej Hajda @ 2023-09-25 10:08 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Marijn Suijten, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, nouveau, David Airlie,
	virtualization, Chia-I Wu, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang



On 22.09.2023 19: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 perf_series.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

I am surprised this is the only finding in i915, I would expected more. 
Anyway:

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 10:08     ` Andrzej Hajda
  0 siblings, 0 replies; 243+ messages in thread
From: Andrzej Hajda @ 2023-09-25 10:08 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang



On 22.09.2023 19: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 perf_series.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

I am surprised this is the only finding in i915, I would expected more. 
Anyway:

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

> ---
>   drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index a9b79888c193..acae30a04a94 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1924,7 +1924,7 @@ struct perf_stats {
>   struct perf_series {
>   	struct drm_i915_private *i915;
>   	unsigned int nengines;
> -	struct intel_context *ce[];
> +	struct intel_context *ce[] __counted_by(nengines);
>   };
>   
>   static int cmp_u32(const void *A, const void *B)


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
  2023-09-22 17:32   ` Kees Cook
                       ` (2 preceding siblings ...)
  (?)
@ 2023-09-25 12:20     ` Andi Shyti
  -1 siblings, 0 replies; 243+ messages in thread
From: Andi Shyti @ 2023-09-25 12:20 UTC (permalink / raw)
  To: Kees Cook
  Cc: David Airlie, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, Daniel Vetter, Chris Wilson, John Harrison,
	Andi Shyti, Matthew Brost, intel-gfx, dri-devel, Emma Anholt,
	Evan Quan, Alex Deucher, Christian König, Pan, Xinhui,
	Xiaojian Du, Huang Rui, Kevin Wang, Hawking Zhang, Rob Clark,
	Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
	Bjorn Andersson, Ben Skeggs, Karol Herbst, Lyude Paul,
	Maxime Ripard, 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,
	amd-gfx, linux-arm-msm, freedreno, nouveau, virtualization, llvm,
	linux-hardening

Hi Kees,

On Fri, Sep 22, 2023 at 10:32:08AM -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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Thanks,
Andi

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 12:20     ` Andi Shyti
  0 siblings, 0 replies; 243+ messages in thread
From: Andi Shyti @ 2023-09-25 12:20 UTC (permalink / raw)
  To: Kees Cook
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang

Hi Kees,

On Fri, Sep 22, 2023 at 10:32:08AM -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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Thanks,
Andi

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 12:20     ` Andi Shyti
  0 siblings, 0 replies; 243+ messages in thread
From: Andi Shyti @ 2023-09-25 12:20 UTC (permalink / raw)
  To: Kees Cook
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

Hi Kees,

On Fri, Sep 22, 2023 at 10:32:08AM -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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Thanks,
Andi

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 12:20     ` Andi Shyti
  0 siblings, 0 replies; 243+ messages in thread
From: Andi Shyti @ 2023-09-25 12:20 UTC (permalink / raw)
  To: Kees Cook
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

Hi Kees,

On Fri, Sep 22, 2023 at 10:32:08AM -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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Thanks,
Andi

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 12:20     ` Andi Shyti
  0 siblings, 0 replies; 243+ messages in thread
From: Andi Shyti @ 2023-09-25 12:20 UTC (permalink / raw)
  To: Kees Cook
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	David Airlie, Karol Herbst, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, Nathan Chancellor, VMware Graphics Reviewers,
	Ben Skeggs, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

Hi Kees,

On Fri, Sep 22, 2023 at 10:32:08AM -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 perf_series.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: John Harrison <john.c.harrison@Intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Thanks,
Andi

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
  2023-09-25  6:30       ` [Nouveau] " Christian König
                           ` (3 preceding siblings ...)
  (?)
@ 2023-09-25 14:07         ` Alex Deucher
  -1 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:07 UTC (permalink / raw)
  To: Christian König
  Cc: Kees Cook, David Airlie, Tejas Upadhyay, Emma Anholt, Tom Rix,
	llvm, dri-devel, Chris Wilson, Prike Liang, Huang Rui,
	Gerd Hoffmann, Andrzej Hajda, Marijn Suijten, Matthew Brost,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu, John Harrison,
	Hawking Zhang

On Mon, Sep 25, 2023 at 2:30 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> >>
> >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> >>
> >> Cc: Evan Quan <evan.quan@amd.com>
> >> Cc: Alex Deucher <alexander.deucher@amd.com>
> >> Cc: "Christian König" <christian.koenig@amd.com>
> >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> >> Cc: David Airlie <airlied@gmail.com>
> >> Cc: Daniel Vetter <daniel@ffwll.ch>
> >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> >> Cc: Huang Rui <ray.huang@amd.com>
> >> Cc: Kevin Wang <kevin1.wang@amd.com>
> >> Cc: amd-gfx@lists.freedesktop.org
> >> Cc: dri-devel@lists.freedesktop.org
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
>
> Mhm, I'm not sure if this is a good idea. That is a structure filled in
> by the firmware, isn't it?
>
> That would imply that we might need to byte swap count before it is
> checkable.

True. Good point.  Same for the other amdgpu patch.

Alex

>
> Regards,
> Christian.
>
> >
> >> ---
> >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> >>
> >>   struct smu10_voltage_dependency_table {
> >>          uint32_t count;
> >> -       struct smu10_clock_voltage_dependency_record entries[];
> >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> >>   };
> >>
> >>   struct smu10_clock_voltage_information {
> >> --
> >> 2.34.1
> >>
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 14:07         ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:07 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Evan Quan, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 2:30 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> >>
> >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> >>
> >> Cc: Evan Quan <evan.quan@amd.com>
> >> Cc: Alex Deucher <alexander.deucher@amd.com>
> >> Cc: "Christian König" <christian.koenig@amd.com>
> >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> >> Cc: David Airlie <airlied@gmail.com>
> >> Cc: Daniel Vetter <daniel@ffwll.ch>
> >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> >> Cc: Huang Rui <ray.huang@amd.com>
> >> Cc: Kevin Wang <kevin1.wang@amd.com>
> >> Cc: amd-gfx@lists.freedesktop.org
> >> Cc: dri-devel@lists.freedesktop.org
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
>
> Mhm, I'm not sure if this is a good idea. That is a structure filled in
> by the firmware, isn't it?
>
> That would imply that we might need to byte swap count before it is
> checkable.

True. Good point.  Same for the other amdgpu patch.

Alex

>
> Regards,
> Christian.
>
> >
> >> ---
> >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> >>
> >>   struct smu10_voltage_dependency_table {
> >>          uint32_t count;
> >> -       struct smu10_clock_voltage_dependency_record entries[];
> >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> >>   };
> >>
> >>   struct smu10_clock_voltage_information {
> >> --
> >> 2.34.1
> >>
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 14:07         ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:07 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Andrzej Hajda, Marijn Suijten,
	David Airlie, Matthew Brost, Evan Quan, Karol Herbst, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, Andi Shyti,
	nouveau, David Airlie, Alex Deucher, Lijo Lazar, Kees Cook,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 2:30 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> >>
> >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> >>
> >> Cc: Evan Quan <evan.quan@amd.com>
> >> Cc: Alex Deucher <alexander.deucher@amd.com>
> >> Cc: "Christian König" <christian.koenig@amd.com>
> >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> >> Cc: David Airlie <airlied@gmail.com>
> >> Cc: Daniel Vetter <daniel@ffwll.ch>
> >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> >> Cc: Huang Rui <ray.huang@amd.com>
> >> Cc: Kevin Wang <kevin1.wang@amd.com>
> >> Cc: amd-gfx@lists.freedesktop.org
> >> Cc: dri-devel@lists.freedesktop.org
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
>
> Mhm, I'm not sure if this is a good idea. That is a structure filled in
> by the firmware, isn't it?
>
> That would imply that we might need to byte swap count before it is
> checkable.

True. Good point.  Same for the other amdgpu patch.

Alex

>
> Regards,
> Christian.
>
> >
> >> ---
> >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> >>
> >>   struct smu10_voltage_dependency_table {
> >>          uint32_t count;
> >> -       struct smu10_clock_voltage_dependency_record entries[];
> >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> >>   };
> >>
> >>   struct smu10_clock_voltage_information {
> >> --
> >> 2.34.1
> >>
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 14:07         ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:07 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Evan Quan, Karol Herbst, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, Andi Shyti,
	nouveau, David Airlie, Alex Deucher, Lijo Lazar, Kees Cook,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 2:30 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> >>
> >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> >>
> >> Cc: Evan Quan <evan.quan@amd.com>
> >> Cc: Alex Deucher <alexander.deucher@amd.com>
> >> Cc: "Christian König" <christian.koenig@amd.com>
> >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> >> Cc: David Airlie <airlied@gmail.com>
> >> Cc: Daniel Vetter <daniel@ffwll.ch>
> >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> >> Cc: Huang Rui <ray.huang@amd.com>
> >> Cc: Kevin Wang <kevin1.wang@amd.com>
> >> Cc: amd-gfx@lists.freedesktop.org
> >> Cc: dri-devel@lists.freedesktop.org
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
>
> Mhm, I'm not sure if this is a good idea. That is a structure filled in
> by the firmware, isn't it?
>
> That would imply that we might need to byte swap count before it is
> checkable.

True. Good point.  Same for the other amdgpu patch.

Alex

>
> Regards,
> Christian.
>
> >
> >> ---
> >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> >>
> >>   struct smu10_voltage_dependency_table {
> >>          uint32_t count;
> >> -       struct smu10_clock_voltage_dependency_record entries[];
> >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> >>   };
> >>
> >>   struct smu10_clock_voltage_information {
> >> --
> >> 2.34.1
> >>
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 14:07         ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:07 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, David Airlie, Evan Quan, Karol Herbst, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Rodrigo Vivi, virtualization, Neil Armstrong, Xiaojian Du,
	Lang Yu, Bjorn Andersson, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Dmitry Baryshkov, Nirmoy Das,
	freedreno, linux-hardening

On Mon, Sep 25, 2023 at 2:30 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> >>
> >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> >>
> >> Cc: Evan Quan <evan.quan@amd.com>
> >> Cc: Alex Deucher <alexander.deucher@amd.com>
> >> Cc: "Christian König" <christian.koenig@amd.com>
> >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> >> Cc: David Airlie <airlied@gmail.com>
> >> Cc: Daniel Vetter <daniel@ffwll.ch>
> >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> >> Cc: Huang Rui <ray.huang@amd.com>
> >> Cc: Kevin Wang <kevin1.wang@amd.com>
> >> Cc: amd-gfx@lists.freedesktop.org
> >> Cc: dri-devel@lists.freedesktop.org
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
>
> Mhm, I'm not sure if this is a good idea. That is a structure filled in
> by the firmware, isn't it?
>
> That would imply that we might need to byte swap count before it is
> checkable.

True. Good point.  Same for the other amdgpu patch.

Alex

>
> Regards,
> Christian.
>
> >
> >> ---
> >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> >>
> >>   struct smu10_voltage_dependency_table {
> >>          uint32_t count;
> >> -       struct smu10_clock_voltage_dependency_record entries[];
> >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> >>   };
> >>
> >>   struct smu10_clock_voltage_information {
> >> --
> >> 2.34.1
> >>
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 14:07         ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:07 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Evan Quan,
	Karol Herbst, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin,
	Nathan Chancellor, Le Ma, Gurchetan Singh, Rodrigo Vivi,
	virtualization, Sean Paul, Neil Armstrong, Xiaojian Du, Lang Yu,
	Bjorn Andersson, Tejas Upadhyay, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Dmitry Baryshkov, Nirmoy Das,
	freedreno, John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 2:30 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> >>
> >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> >>
> >> Cc: Evan Quan <evan.quan@amd.com>
> >> Cc: Alex Deucher <alexander.deucher@amd.com>
> >> Cc: "Christian König" <christian.koenig@amd.com>
> >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> >> Cc: David Airlie <airlied@gmail.com>
> >> Cc: Daniel Vetter <daniel@ffwll.ch>
> >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> >> Cc: Huang Rui <ray.huang@amd.com>
> >> Cc: Kevin Wang <kevin1.wang@amd.com>
> >> Cc: amd-gfx@lists.freedesktop.org
> >> Cc: dri-devel@lists.freedesktop.org
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
>
> Mhm, I'm not sure if this is a good idea. That is a structure filled in
> by the firmware, isn't it?
>
> That would imply that we might need to byte swap count before it is
> checkable.

True. Good point.  Same for the other amdgpu patch.

Alex

>
> Regards,
> Christian.
>
> >
> >> ---
> >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> >>
> >>   struct smu10_voltage_dependency_table {
> >>          uint32_t count;
> >> -       struct smu10_clock_voltage_dependency_record entries[];
> >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> >>   };
> >>
> >>   struct smu10_clock_voltage_information {
> >> --
> >> 2.34.1
> >>
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
  2023-09-25 14:07         ` [Nouveau] " Alex Deucher
                             ` (3 preceding siblings ...)
  (?)
@ 2023-09-25 14:14           ` Alex Deucher
  -1 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:14 UTC (permalink / raw)
  To: Christian König
  Cc: Kees Cook, David Airlie, Tejas Upadhyay, Emma Anholt, Tom Rix,
	llvm, dri-devel, Chris Wilson, Prike Liang, Huang Rui,
	Gerd Hoffmann, Andrzej Hajda, Marijn Suijten, Matthew Brost,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu, John Harrison,
	Hawking Zhang

On Mon, Sep 25, 2023 at 10:07 AM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Mon, Sep 25, 2023 at 2:30 AM Christian König
> <christian.koenig@amd.com> wrote:
> >
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > >>
> > >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > >>
> > >> Cc: Evan Quan <evan.quan@amd.com>
> > >> Cc: Alex Deucher <alexander.deucher@amd.com>
> > >> Cc: "Christian König" <christian.koenig@amd.com>
> > >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > >> Cc: David Airlie <airlied@gmail.com>
> > >> Cc: Daniel Vetter <daniel@ffwll.ch>
> > >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > >> Cc: Huang Rui <ray.huang@amd.com>
> > >> Cc: Kevin Wang <kevin1.wang@amd.com>
> > >> Cc: amd-gfx@lists.freedesktop.org
> > >> Cc: dri-devel@lists.freedesktop.org
> > >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in
> > by the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> True. Good point.  Same for the other amdgpu patch.

Actually the other patch is fine.  That's just a local structure.

Alex

>
> Alex
>
> >
> > Regards,
> > Christian.
> >
> > >
> > >> ---
> > >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> > >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> > >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> > >>
> > >>   struct smu10_voltage_dependency_table {
> > >>          uint32_t count;
> > >> -       struct smu10_clock_voltage_dependency_record entries[];
> > >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> > >>   };
> > >>
> > >>   struct smu10_clock_voltage_information {
> > >> --
> > >> 2.34.1
> > >>
> >

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 14:14           ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:14 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Evan Quan, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 10:07 AM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Mon, Sep 25, 2023 at 2:30 AM Christian König
> <christian.koenig@amd.com> wrote:
> >
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > >>
> > >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > >>
> > >> Cc: Evan Quan <evan.quan@amd.com>
> > >> Cc: Alex Deucher <alexander.deucher@amd.com>
> > >> Cc: "Christian König" <christian.koenig@amd.com>
> > >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > >> Cc: David Airlie <airlied@gmail.com>
> > >> Cc: Daniel Vetter <daniel@ffwll.ch>
> > >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > >> Cc: Huang Rui <ray.huang@amd.com>
> > >> Cc: Kevin Wang <kevin1.wang@amd.com>
> > >> Cc: amd-gfx@lists.freedesktop.org
> > >> Cc: dri-devel@lists.freedesktop.org
> > >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in
> > by the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> True. Good point.  Same for the other amdgpu patch.

Actually the other patch is fine.  That's just a local structure.

Alex

>
> Alex
>
> >
> > Regards,
> > Christian.
> >
> > >
> > >> ---
> > >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> > >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> > >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> > >>
> > >>   struct smu10_voltage_dependency_table {
> > >>          uint32_t count;
> > >> -       struct smu10_clock_voltage_dependency_record entries[];
> > >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> > >>   };
> > >>
> > >>   struct smu10_clock_voltage_information {
> > >> --
> > >> 2.34.1
> > >>
> >

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 14:14           ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:14 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Andrzej Hajda, Marijn Suijten,
	David Airlie, Matthew Brost, Evan Quan, Karol Herbst, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, Andi Shyti,
	nouveau, David Airlie, Alex Deucher, Lijo Lazar, Kees Cook,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 10:07 AM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Mon, Sep 25, 2023 at 2:30 AM Christian König
> <christian.koenig@amd.com> wrote:
> >
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > >>
> > >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > >>
> > >> Cc: Evan Quan <evan.quan@amd.com>
> > >> Cc: Alex Deucher <alexander.deucher@amd.com>
> > >> Cc: "Christian König" <christian.koenig@amd.com>
> > >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > >> Cc: David Airlie <airlied@gmail.com>
> > >> Cc: Daniel Vetter <daniel@ffwll.ch>
> > >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > >> Cc: Huang Rui <ray.huang@amd.com>
> > >> Cc: Kevin Wang <kevin1.wang@amd.com>
> > >> Cc: amd-gfx@lists.freedesktop.org
> > >> Cc: dri-devel@lists.freedesktop.org
> > >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in
> > by the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> True. Good point.  Same for the other amdgpu patch.

Actually the other patch is fine.  That's just a local structure.

Alex

>
> Alex
>
> >
> > Regards,
> > Christian.
> >
> > >
> > >> ---
> > >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> > >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> > >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> > >>
> > >>   struct smu10_voltage_dependency_table {
> > >>          uint32_t count;
> > >> -       struct smu10_clock_voltage_dependency_record entries[];
> > >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> > >>   };
> > >>
> > >>   struct smu10_clock_voltage_information {
> > >> --
> > >> 2.34.1
> > >>
> >
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 14:14           ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:14 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Evan Quan, Karol Herbst, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, Andi Shyti,
	nouveau, David Airlie, Alex Deucher, Lijo Lazar, Kees Cook,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 10:07 AM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Mon, Sep 25, 2023 at 2:30 AM Christian König
> <christian.koenig@amd.com> wrote:
> >
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > >>
> > >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > >>
> > >> Cc: Evan Quan <evan.quan@amd.com>
> > >> Cc: Alex Deucher <alexander.deucher@amd.com>
> > >> Cc: "Christian König" <christian.koenig@amd.com>
> > >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > >> Cc: David Airlie <airlied@gmail.com>
> > >> Cc: Daniel Vetter <daniel@ffwll.ch>
> > >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > >> Cc: Huang Rui <ray.huang@amd.com>
> > >> Cc: Kevin Wang <kevin1.wang@amd.com>
> > >> Cc: amd-gfx@lists.freedesktop.org
> > >> Cc: dri-devel@lists.freedesktop.org
> > >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in
> > by the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> True. Good point.  Same for the other amdgpu patch.

Actually the other patch is fine.  That's just a local structure.

Alex

>
> Alex
>
> >
> > Regards,
> > Christian.
> >
> > >
> > >> ---
> > >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> > >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> > >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> > >>
> > >>   struct smu10_voltage_dependency_table {
> > >>          uint32_t count;
> > >> -       struct smu10_clock_voltage_dependency_record entries[];
> > >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> > >>   };
> > >>
> > >>   struct smu10_clock_voltage_information {
> > >> --
> > >> 2.34.1
> > >>
> >

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 14:14           ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:14 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, David Airlie, Evan Quan, Karol Herbst, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Kees Cook, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Rodrigo Vivi, virtualization, Neil Armstrong, Xiaojian Du,
	Lang Yu, Bjorn Andersson, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Dmitry Baryshkov, Nirmoy Das,
	freedreno, linux-hardening

On Mon, Sep 25, 2023 at 10:07 AM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Mon, Sep 25, 2023 at 2:30 AM Christian König
> <christian.koenig@amd.com> wrote:
> >
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > >>
> > >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > >>
> > >> Cc: Evan Quan <evan.quan@amd.com>
> > >> Cc: Alex Deucher <alexander.deucher@amd.com>
> > >> Cc: "Christian König" <christian.koenig@amd.com>
> > >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > >> Cc: David Airlie <airlied@gmail.com>
> > >> Cc: Daniel Vetter <daniel@ffwll.ch>
> > >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > >> Cc: Huang Rui <ray.huang@amd.com>
> > >> Cc: Kevin Wang <kevin1.wang@amd.com>
> > >> Cc: amd-gfx@lists.freedesktop.org
> > >> Cc: dri-devel@lists.freedesktop.org
> > >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in
> > by the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> True. Good point.  Same for the other amdgpu patch.

Actually the other patch is fine.  That's just a local structure.

Alex

>
> Alex
>
> >
> > Regards,
> > Christian.
> >
> > >
> > >> ---
> > >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> > >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> > >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> > >>
> > >>   struct smu10_voltage_dependency_table {
> > >>          uint32_t count;
> > >> -       struct smu10_clock_voltage_dependency_record entries[];
> > >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> > >>   };
> > >>
> > >>   struct smu10_clock_voltage_information {
> > >> --
> > >> 2.34.1
> > >>
> >

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 14:14           ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 14:14 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Evan Quan,
	Karol Herbst, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Kees Cook, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin,
	Nathan Chancellor, Le Ma, Gurchetan Singh, Rodrigo Vivi,
	virtualization, Sean Paul, Neil Armstrong, Xiaojian Du, Lang Yu,
	Bjorn Andersson, Tejas Upadhyay, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Dmitry Baryshkov, Nirmoy Das,
	freedreno, John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 10:07 AM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Mon, Sep 25, 2023 at 2:30 AM Christian König
> <christian.koenig@amd.com> wrote:
> >
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > >>
> > >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > >>
> > >> Cc: Evan Quan <evan.quan@amd.com>
> > >> Cc: Alex Deucher <alexander.deucher@amd.com>
> > >> Cc: "Christian König" <christian.koenig@amd.com>
> > >> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > >> Cc: David Airlie <airlied@gmail.com>
> > >> Cc: Daniel Vetter <daniel@ffwll.ch>
> > >> Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > >> Cc: Huang Rui <ray.huang@amd.com>
> > >> Cc: Kevin Wang <kevin1.wang@amd.com>
> > >> Cc: amd-gfx@lists.freedesktop.org
> > >> Cc: dri-devel@lists.freedesktop.org
> > >> Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in
> > by the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> True. Good point.  Same for the other amdgpu patch.

Actually the other patch is fine.  That's just a local structure.

Alex

>
> Alex
>
> >
> > Regards,
> > Christian.
> >
> > >
> > >> ---
> > >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> > >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> > >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> > >>
> > >>   struct smu10_voltage_dependency_table {
> > >>          uint32_t count;
> > >> -       struct smu10_clock_voltage_dependency_record entries[];
> > >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> > >>   };
> > >>
> > >>   struct smu10_clock_voltage_information {
> > >> --
> > >> 2.34.1
> > >>
> >

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
  2023-09-25 10:08     ` [Nouveau] " Andrzej Hajda
                         ` (3 preceding siblings ...)
  (?)
@ 2023-09-25 17:50       ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:50 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: David Airlie, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, Daniel Vetter, Chris Wilson, John Harrison,
	Andi Shyti, Matthew Brost, intel-gfx, dri-devel, Emma Anholt,
	Evan Quan, Alex Deucher, Christian König, Pan, Xinhui,
	Xiaojian Du, Huang Rui, Kevin Wang, Hawking Zhang, Rob Clark,
	Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
	Bjorn Andersson, Ben Skeggs, Karol Herbst, Lyude Paul,
	Maxime Ripard, 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,
	Neil Armstrong, Kuogee Hsieh, linux-kernel, amd-gfx,
	linux-arm-msm, freedreno, nouveau, virtualization, llvm,
	linux-hardening

On Mon, Sep 25, 2023 at 12:08:36PM +0200, Andrzej Hajda wrote:
> 
> 
> On 22.09.2023 19: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 perf_series.
> > 
> > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > 
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> > Cc: David Airlie <airlied@gmail.com>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: John Harrison <john.c.harrison@Intel.com>
> > Cc: Andi Shyti <andi.shyti@linux.intel.com>
> > Cc: Matthew Brost <matthew.brost@intel.com>
> > Cc: intel-gfx@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> I am surprised this is the only finding in i915, I would expected more.

I'm sure there are more, but it's likely my Coccinelle pattern didn't
catch it. There are many many flexible arrays in drm. :)

$ grep -nRH '\[\];$' drivers/gpu/drm include/uapi/drm | grep -v :extern | wc -l
122

If anyone has some patterns I can add to the Coccinelle script, I can
take another pass at it.

> Anyway:
> 
> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Thank you!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 17:50       ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:50 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Marijn Suijten, Matthew Brost, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, Nathan Chancellor, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	Chia-I Wu, linux-hardening, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

On Mon, Sep 25, 2023 at 12:08:36PM +0200, Andrzej Hajda wrote:
> 
> 
> On 22.09.2023 19: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 perf_series.
> > 
> > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > 
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> > Cc: David Airlie <airlied@gmail.com>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: John Harrison <john.c.harrison@Intel.com>
> > Cc: Andi Shyti <andi.shyti@linux.intel.com>
> > Cc: Matthew Brost <matthew.brost@intel.com>
> > Cc: intel-gfx@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> I am surprised this is the only finding in i915, I would expected more.

I'm sure there are more, but it's likely my Coccinelle pattern didn't
catch it. There are many many flexible arrays in drm. :)

$ grep -nRH '\[\];$' drivers/gpu/drm include/uapi/drm | grep -v :extern | wc -l
122

If anyone has some patterns I can add to the Coccinelle script, I can
take another pass at it.

> Anyway:
> 
> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Thank you!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 17:50       ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:50 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Marijn Suijten,
	David Airlie, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

On Mon, Sep 25, 2023 at 12:08:36PM +0200, Andrzej Hajda wrote:
> 
> 
> On 22.09.2023 19: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 perf_series.
> > 
> > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > 
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> > Cc: David Airlie <airlied@gmail.com>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: John Harrison <john.c.harrison@Intel.com>
> > Cc: Andi Shyti <andi.shyti@linux.intel.com>
> > Cc: Matthew Brost <matthew.brost@intel.com>
> > Cc: intel-gfx@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> I am surprised this is the only finding in i915, I would expected more.

I'm sure there are more, but it's likely my Coccinelle pattern didn't
catch it. There are many many flexible arrays in drm. :)

$ grep -nRH '\[\];$' drivers/gpu/drm include/uapi/drm | grep -v :extern | wc -l
122

If anyone has some patterns I can add to the Coccinelle script, I can
take another pass at it.

> Anyway:
> 
> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Thank you!

-Kees

-- 
Kees Cook
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 17:50       ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:50 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Mon, Sep 25, 2023 at 12:08:36PM +0200, Andrzej Hajda wrote:
> 
> 
> On 22.09.2023 19: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 perf_series.
> > 
> > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > 
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> > Cc: David Airlie <airlied@gmail.com>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: John Harrison <john.c.harrison@Intel.com>
> > Cc: Andi Shyti <andi.shyti@linux.intel.com>
> > Cc: Matthew Brost <matthew.brost@intel.com>
> > Cc: intel-gfx@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> I am surprised this is the only finding in i915, I would expected more.

I'm sure there are more, but it's likely my Coccinelle pattern didn't
catch it. There are many many flexible arrays in drm. :)

$ grep -nRH '\[\];$' drivers/gpu/drm include/uapi/drm | grep -v :extern | wc -l
122

If anyone has some patterns I can add to the Coccinelle script, I can
take another pass at it.

> Anyway:
> 
> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Thank you!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 17:50       ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:50 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Marijn Suijten, David Airlie,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

On Mon, Sep 25, 2023 at 12:08:36PM +0200, Andrzej Hajda wrote:
> 
> 
> On 22.09.2023 19: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 perf_series.
> > 
> > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > 
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> > Cc: David Airlie <airlied@gmail.com>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: John Harrison <john.c.harrison@Intel.com>
> > Cc: Andi Shyti <andi.shyti@linux.intel.com>
> > Cc: Matthew Brost <matthew.brost@intel.com>
> > Cc: intel-gfx@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> I am surprised this is the only finding in i915, I would expected more.

I'm sure there are more, but it's likely my Coccinelle pattern didn't
catch it. There are many many flexible arrays in drm. :)

$ grep -nRH '\[\];$' drivers/gpu/drm include/uapi/drm | grep -v :extern | wc -l
122

If anyone has some patterns I can add to the Coccinelle script, I can
take another pass at it.

> Anyway:
> 
> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Thank you!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
@ 2023-09-25 17:50       ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:50 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Marijn Suijten, David Airlie, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Christian König, John Harrison, Hawking Zhang

On Mon, Sep 25, 2023 at 12:08:36PM +0200, Andrzej Hajda wrote:
> 
> 
> On 22.09.2023 19: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 perf_series.
> > 
> > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > 
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> > Cc: David Airlie <airlied@gmail.com>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: John Harrison <john.c.harrison@Intel.com>
> > Cc: Andi Shyti <andi.shyti@linux.intel.com>
> > Cc: Matthew Brost <matthew.brost@intel.com>
> > Cc: intel-gfx@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> I am surprised this is the only finding in i915, I would expected more.

I'm sure there are more, but it's likely my Coccinelle pattern didn't
catch it. There are many many flexible arrays in drm. :)

$ grep -nRH '\[\];$' drivers/gpu/drm include/uapi/drm | grep -v :extern | wc -l
122

If anyone has some patterns I can add to the Coccinelle script, I can
take another pass at it.

> Anyway:
> 
> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Thank you!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
  2023-09-25  6:30       ` [Nouveau] " Christian König
                           ` (3 preceding siblings ...)
  (?)
@ 2023-09-25 17:52         ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:52 UTC (permalink / raw)
  To: Christian König
  Cc: Alex Deucher, David Airlie, Tejas Upadhyay, Emma Anholt, Tom Rix,
	llvm, dri-devel, Chris Wilson, Prike Liang, Huang Rui,
	Gerd Hoffmann, Andrzej Hajda, Marijn Suijten, Matthew Brost,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu, John Harrison,
	Hawking Zhang

On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > 
> > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > 
> > > Cc: Evan Quan <evan.quan@amd.com>
> > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > Cc: "Christian König" <christian.koenig@amd.com>
> > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > Cc: David Airlie <airlied@gmail.com>
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > Cc: Huang Rui <ray.huang@amd.com>
> > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > Cc: amd-gfx@lists.freedesktop.org
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> 
> Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> the firmware, isn't it?
> 
> That would imply that we might need to byte swap count before it is
> checkable.

The script found this instance because of this:

static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
                        struct smu10_voltage_dependency_table **pptable,
                        uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
{
        uint32_t i;
        struct smu10_voltage_dependency_table *ptable;

        ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
        if (NULL == ptable)
                return -ENOMEM;

        ptable->count = num_entry;

So the implication is that it's native byte order... but you tell me! I
certainly don't want this annotation if it's going to break stuff. :)

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 17:52         ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:52 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Matthew Brost, Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Dmitry Baryshkov, Gurchetan Singh, Rodrigo Vivi, virtualization,
	Sean Paul, Neil Armstrong, Xiaojian Du, Le Ma, Lang Yu,
	Bjorn Andersson, Tejas Upadhyay, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Alex Deucher, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > 
> > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > 
> > > Cc: Evan Quan <evan.quan@amd.com>
> > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > Cc: "Christian König" <christian.koenig@amd.com>
> > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > Cc: David Airlie <airlied@gmail.com>
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > Cc: Huang Rui <ray.huang@amd.com>
> > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > Cc: amd-gfx@lists.freedesktop.org
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> 
> Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> the firmware, isn't it?
> 
> That would imply that we might need to byte swap count before it is
> checkable.

The script found this instance because of this:

static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
                        struct smu10_voltage_dependency_table **pptable,
                        uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
{
        uint32_t i;
        struct smu10_voltage_dependency_table *ptable;

        ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
        if (NULL == ptable)
                return -ENOMEM;

        ptable->count = num_entry;

So the implication is that it's native byte order... but you tell me! I
certainly don't want this annotation if it's going to break stuff. :)

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 17:52         ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:52 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Dmitry Baryshkov, Gurchetan Singh, Rodrigo Vivi, virtualization,
	Sean Paul, Neil Armstrong, Xiaojian Du, Le Ma, Lang Yu,
	Bjorn Andersson, Tejas Upadhyay, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Alex Deucher, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > 
> > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > 
> > > Cc: Evan Quan <evan.quan@amd.com>
> > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > Cc: "Christian König" <christian.koenig@amd.com>
> > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > Cc: David Airlie <airlied@gmail.com>
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > Cc: Huang Rui <ray.huang@amd.com>
> > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > Cc: amd-gfx@lists.freedesktop.org
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> 
> Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> the firmware, isn't it?
> 
> That would imply that we might need to byte swap count before it is
> checkable.

The script found this instance because of this:

static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
                        struct smu10_voltage_dependency_table **pptable,
                        uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
{
        uint32_t i;
        struct smu10_voltage_dependency_table *ptable;

        ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
        if (NULL == ptable)
                return -ENOMEM;

        ptable->count = num_entry;

So the implication is that it's native byte order... but you tell me! I
certainly don't want this annotation if it's going to break stuff. :)

-- 
Kees Cook
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 17:52         ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:52 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Dmitry Baryshkov, Gurchetan Singh, Rodrigo Vivi, virtualization,
	Sean Paul, Neil Armstrong, Xiaojian Du, Le Ma, Lang Yu,
	Bjorn Andersson, Tejas Upadhyay, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Nirmoy Das, freedreno, John Harrison,
	linux-hardening

On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > 
> > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > 
> > > Cc: Evan Quan <evan.quan@amd.com>
> > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > Cc: "Christian König" <christian.koenig@amd.com>
> > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > Cc: David Airlie <airlied@gmail.com>
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > Cc: Huang Rui <ray.huang@amd.com>
> > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > Cc: amd-gfx@lists.freedesktop.org
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> 
> Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> the firmware, isn't it?
> 
> That would imply that we might need to byte swap count before it is
> checkable.

The script found this instance because of this:

static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
                        struct smu10_voltage_dependency_table **pptable,
                        uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
{
        uint32_t i;
        struct smu10_voltage_dependency_table *ptable;

        ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
        if (NULL == ptable)
                return -ENOMEM;

        ptable->count = num_entry;

So the implication is that it's native byte order... but you tell me! I
certainly don't want this annotation if it's going to break stuff. :)

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 17:52         ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:52 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, nouveau, David Airlie, Alex Deucher, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Neil Armstrong,
	Xiaojian Du, Le Ma, Lang Yu, Bjorn Andersson, Nick Desaulniers,
	linux-kernel, Hawking Zhang, Melissa Wen, Alex Deucher,
	Nirmoy Das, freedreno, linux-hardening

On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > 
> > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > 
> > > Cc: Evan Quan <evan.quan@amd.com>
> > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > Cc: "Christian König" <christian.koenig@amd.com>
> > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > Cc: David Airlie <airlied@gmail.com>
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > Cc: Huang Rui <ray.huang@amd.com>
> > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > Cc: amd-gfx@lists.freedesktop.org
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> 
> Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> the firmware, isn't it?
> 
> That would imply that we might need to byte swap count before it is
> checkable.

The script found this instance because of this:

static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
                        struct smu10_voltage_dependency_table **pptable,
                        uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
{
        uint32_t i;
        struct smu10_voltage_dependency_table *ptable;

        ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
        if (NULL == ptable)
                return -ENOMEM;

        ptable->count = num_entry;

So the implication is that it's native byte order... but you tell me! I
certainly don't want this annotation if it's going to break stuff. :)

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 17:52         ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-25 17:52 UTC (permalink / raw)
  To: Christian König
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Dmitry Baryshkov, Gurchetan Singh, Rodrigo Vivi, virtualization,
	Sean Paul, Neil Armstrong, Xiaojian Du, Le Ma, Lang Yu,
	Bjorn Andersson, Tejas Upadhyay, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Alex Deucher, Nirmoy Das, freedreno,
	John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > 
> > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > 
> > > Cc: Evan Quan <evan.quan@amd.com>
> > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > Cc: "Christian König" <christian.koenig@amd.com>
> > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > Cc: David Airlie <airlied@gmail.com>
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > Cc: Huang Rui <ray.huang@amd.com>
> > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > Cc: amd-gfx@lists.freedesktop.org
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> 
> Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> the firmware, isn't it?
> 
> That would imply that we might need to byte swap count before it is
> checkable.

The script found this instance because of this:

static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
                        struct smu10_voltage_dependency_table **pptable,
                        uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
{
        uint32_t i;
        struct smu10_voltage_dependency_table *ptable;

        ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
        if (NULL == ptable)
                return -ENOMEM;

        ptable->count = num_entry;

So the implication is that it's native byte order... but you tell me! I
certainly don't want this annotation if it's going to break stuff. :)

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
  2023-09-25 17:52         ` [Nouveau] " Kees Cook
                             ` (3 preceding siblings ...)
  (?)
@ 2023-09-25 17:56           ` Alex Deucher
  -1 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 17:56 UTC (permalink / raw)
  To: Kees Cook
  Cc: Christian König, David Airlie, Tejas Upadhyay, Emma Anholt,
	Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang, Huang Rui,
	Gerd Hoffmann, Andrzej Hajda, Marijn Suijten, Matthew Brost,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu, John Harrison,
	Hawking Zhang

On Mon, Sep 25, 2023 at 1:52 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > >
> > > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > >
> > > > Cc: Evan Quan <evan.quan@amd.com>
> > > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > > Cc: "Christian König" <christian.koenig@amd.com>
> > > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > > Cc: David Airlie <airlied@gmail.com>
> > > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > > Cc: Huang Rui <ray.huang@amd.com>
> > > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > > Cc: amd-gfx@lists.freedesktop.org
> > > > Cc: dri-devel@lists.freedesktop.org
> > > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> > the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> The script found this instance because of this:
>
> static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
>                         struct smu10_voltage_dependency_table **pptable,
>                         uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
> {
>         uint32_t i;
>         struct smu10_voltage_dependency_table *ptable;
>
>         ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
>         if (NULL == ptable)
>                 return -ENOMEM;
>
>         ptable->count = num_entry;
>
> So the implication is that it's native byte order... but you tell me! I
> certainly don't want this annotation if it's going to break stuff. :)

In this case, the code is for an integrated GPU in an x86 CPU so the
firmware and driver endianness match.  You wouldn't find a stand alone
dGPU that uses this structure.  In this case it's ok.  False alarm.

Alex

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 17:56           ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 17:56 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Matthew Brost, Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 1:52 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > >
> > > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > >
> > > > Cc: Evan Quan <evan.quan@amd.com>
> > > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > > Cc: "Christian König" <christian.koenig@amd.com>
> > > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > > Cc: David Airlie <airlied@gmail.com>
> > > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > > Cc: Huang Rui <ray.huang@amd.com>
> > > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > > Cc: amd-gfx@lists.freedesktop.org
> > > > Cc: dri-devel@lists.freedesktop.org
> > > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> > the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> The script found this instance because of this:
>
> static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
>                         struct smu10_voltage_dependency_table **pptable,
>                         uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
> {
>         uint32_t i;
>         struct smu10_voltage_dependency_table *ptable;
>
>         ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
>         if (NULL == ptable)
>                 return -ENOMEM;
>
>         ptable->count = num_entry;
>
> So the implication is that it's native byte order... but you tell me! I
> certainly don't want this annotation if it's going to break stuff. :)

In this case, the code is for an integrated GPU in an x86 CPU so the
firmware and driver endianness match.  You wouldn't find a stand alone
dGPU that uses this structure.  In this case it's ok.  False alarm.

Alex

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 17:56           ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 17:56 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 1:52 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > >
> > > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > >
> > > > Cc: Evan Quan <evan.quan@amd.com>
> > > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > > Cc: "Christian König" <christian.koenig@amd.com>
> > > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > > Cc: David Airlie <airlied@gmail.com>
> > > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > > Cc: Huang Rui <ray.huang@amd.com>
> > > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > > Cc: amd-gfx@lists.freedesktop.org
> > > > Cc: dri-devel@lists.freedesktop.org
> > > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> > the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> The script found this instance because of this:
>
> static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
>                         struct smu10_voltage_dependency_table **pptable,
>                         uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
> {
>         uint32_t i;
>         struct smu10_voltage_dependency_table *ptable;
>
>         ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
>         if (NULL == ptable)
>                 return -ENOMEM;
>
>         ptable->count = num_entry;
>
> So the implication is that it's native byte order... but you tell me! I
> certainly don't want this annotation if it's going to break stuff. :)

In this case, the code is for an integrated GPU in an x86 CPU so the
firmware and driver endianness match.  You wouldn't find a stand alone
dGPU that uses this structure.  In this case it's ok.  False alarm.

Alex
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 17:56           ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 17:56 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 1:52 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > >
> > > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > >
> > > > Cc: Evan Quan <evan.quan@amd.com>
> > > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > > Cc: "Christian König" <christian.koenig@amd.com>
> > > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > > Cc: David Airlie <airlied@gmail.com>
> > > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > > Cc: Huang Rui <ray.huang@amd.com>
> > > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > > Cc: amd-gfx@lists.freedesktop.org
> > > > Cc: dri-devel@lists.freedesktop.org
> > > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> > the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> The script found this instance because of this:
>
> static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
>                         struct smu10_voltage_dependency_table **pptable,
>                         uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
> {
>         uint32_t i;
>         struct smu10_voltage_dependency_table *ptable;
>
>         ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
>         if (NULL == ptable)
>                 return -ENOMEM;
>
>         ptable->count = num_entry;
>
> So the implication is that it's native byte order... but you tell me! I
> certainly don't want this annotation if it's going to break stuff. :)

In this case, the code is for an integrated GPU in an x86 CPU so the
firmware and driver endianness match.  You wouldn't find a stand alone
dGPU that uses this structure.  In this case it's ok.  False alarm.

Alex

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 17:56           ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 17:56 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, nouveau, David Airlie, Alex Deucher, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Rodrigo Vivi, virtualization, Neil Armstrong, Xiaojian Du,
	Lang Yu, Bjorn Andersson, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Dmitry Baryshkov, Nirmoy Das,
	freedreno, Christian König, linux-hardening

On Mon, Sep 25, 2023 at 1:52 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > >
> > > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > >
> > > > Cc: Evan Quan <evan.quan@amd.com>
> > > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > > Cc: "Christian König" <christian.koenig@amd.com>
> > > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > > Cc: David Airlie <airlied@gmail.com>
> > > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > > Cc: Huang Rui <ray.huang@amd.com>
> > > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > > Cc: amd-gfx@lists.freedesktop.org
> > > > Cc: dri-devel@lists.freedesktop.org
> > > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> > the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> The script found this instance because of this:
>
> static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
>                         struct smu10_voltage_dependency_table **pptable,
>                         uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
> {
>         uint32_t i;
>         struct smu10_voltage_dependency_table *ptable;
>
>         ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
>         if (NULL == ptable)
>                 return -ENOMEM;
>
>         ptable->count = num_entry;
>
> So the implication is that it's native byte order... but you tell me! I
> certainly don't want this annotation if it's going to break stuff. :)

In this case, the code is for an integrated GPU in an x86 CPU so the
firmware and driver endianness match.  You wouldn't find a stand alone
dGPU that uses this structure.  In this case it's ok.  False alarm.

Alex

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
@ 2023-09-25 17:56           ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-09-25 17:56 UTC (permalink / raw)
  To: Kees Cook
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

On Mon, Sep 25, 2023 at 1:52 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Mon, Sep 25, 2023 at 08:30:30AM +0200, Christian König wrote:
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@chromium.org> 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 smu10_voltage_dependency_table.
> > > >
> > > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > > >
> > > > Cc: Evan Quan <evan.quan@amd.com>
> > > > Cc: Alex Deucher <alexander.deucher@amd.com>
> > > > Cc: "Christian König" <christian.koenig@amd.com>
> > > > Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
> > > > Cc: David Airlie <airlied@gmail.com>
> > > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > > Cc: Xiaojian Du <Xiaojian.Du@amd.com>
> > > > Cc: Huang Rui <ray.huang@amd.com>
> > > > Cc: Kevin Wang <kevin1.wang@amd.com>
> > > > Cc: amd-gfx@lists.freedesktop.org
> > > > Cc: dri-devel@lists.freedesktop.org
> > > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in by
> > the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> The script found this instance because of this:
>
> static int smu10_get_clock_voltage_dependency_table(struct pp_hwmgr *hwmgr,
>                         struct smu10_voltage_dependency_table **pptable,
>                         uint32_t num_entry, const DpmClock_t *pclk_dependency_table)
> {
>         uint32_t i;
>         struct smu10_voltage_dependency_table *ptable;
>
>         ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL);
>         if (NULL == ptable)
>                 return -ENOMEM;
>
>         ptable->count = num_entry;
>
> So the implication is that it's native byte order... but you tell me! I
> certainly don't want this annotation if it's going to break stuff. :)

In this case, the code is for an integrated GPU in an x86 CPU so the
firmware and driver endianness match.  You wouldn't find a stand alone
dGPU that uses this structure.  In this case it's ok.  False alarm.

Alex

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
  2023-09-22 17:32   ` [Nouveau] " Kees Cook
  (?)
  (?)
@ 2023-09-28 15:16     ` Maira Canal
  -1 siblings, 0 replies; 243+ messages in thread
From: Maira Canal @ 2023-09-28 15:16 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, Alex Deucher,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

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 <emma@anholt.net>
> Cc: Melissa Wen <mwen@igalia.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>

Reviewed-by: Maíra Canal <mcanal@igalia.com>

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 {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
@ 2023-09-28 15:16     ` Maira Canal
  0 siblings, 0 replies; 243+ messages in thread
From: Maira Canal @ 2023-09-28 15:16 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Evan Quan, Emma Anholt, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Rodrigo Vivi, virtualization, Neil Armstrong, Xiaojian Du,
	Lang Yu, Bjorn Andersson, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Dmitry Baryshkov, Nirmoy Das,
	freedreno, Christian König, linux-hardening

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 <emma@anholt.net>
> Cc: Melissa Wen <mwen@igalia.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>

Reviewed-by: Maíra Canal <mcanal@igalia.com>

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 {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
@ 2023-09-28 15:16     ` Maira Canal
  0 siblings, 0 replies; 243+ messages in thread
From: Maira Canal @ 2023-09-28 15:16 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

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 <emma@anholt.net>
> Cc: Melissa Wen <mwen@igalia.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>

Reviewed-by: Maíra Canal <mcanal@igalia.com>

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 {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
@ 2023-09-28 15:16     ` Maira Canal
  0 siblings, 0 replies; 243+ messages in thread
From: Maira Canal @ 2023-09-28 15:16 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Pan, Xinhui, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Matthew Brost, Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Alex Deucher, Lijo Lazar, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Maxime Ripard, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, Dmitry Baryshkov, Nirmoy Das, freedreno,
	Christian König, John Harrison, linux-hardening

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 <emma@anholt.net>
> Cc: Melissa Wen <mwen@igalia.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>

Reviewed-by: Maíra Canal <mcanal@igalia.com>

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 {

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
  2023-09-22 17:32 ` [Nouveau] " Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2023-09-29 19:33   ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-29 19:33 UTC (permalink / raw)
  To: David Airlie, Kees Cook
  Cc: Emma Anholt, Evan Quan, Alex Deucher, Christian König, Pan,
	Xinhui, Daniel Vetter, 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, Maxime Ripard, 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, amd-gfx, dri-devel,
	intel-gfx, linux-arm-msm, freedreno, nouveau, virtualization,
	llvm, linux-hardening

On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> This is a batch of patches touching drm for preparing 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 to structs that would
> benefit from the annotation.
> 
> [...]

Since this got Acks, I figure I should carry it in my tree. Let me know
if this should go via drm instead.

Applied to for-next/hardening, thanks!

[1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
      https://git.kernel.org/kees/c/a6046ac659d6
[2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
      https://git.kernel.org/kees/c/4df33089b46f
[3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
      https://git.kernel.org/kees/c/ffd3f823bdf6
[4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
      https://git.kernel.org/kees/c/2de35a989b76
[5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
      https://git.kernel.org/kees/c/188aeb08bfaa
[6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
      https://git.kernel.org/kees/c/59a54dc896c3
[7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
      https://git.kernel.org/kees/c/5cd476de33af
[8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
      https://git.kernel.org/kees/c/b426f2e5356a
[9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
      https://git.kernel.org/kees/c/dc662fa1b0e4

Take care,

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-29 19:33   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-29 19:33 UTC (permalink / raw)
  To: David Airlie, Kees Cook
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Alex Deucher,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Dmitry Baryshkov,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> This is a batch of patches touching drm for preparing 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 to structs that would
> benefit from the annotation.
> 
> [...]

Since this got Acks, I figure I should carry it in my tree. Let me know
if this should go via drm instead.

Applied to for-next/hardening, thanks!

[1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
      https://git.kernel.org/kees/c/a6046ac659d6
[2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
      https://git.kernel.org/kees/c/4df33089b46f
[3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
      https://git.kernel.org/kees/c/ffd3f823bdf6
[4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
      https://git.kernel.org/kees/c/2de35a989b76
[5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
      https://git.kernel.org/kees/c/188aeb08bfaa
[6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
      https://git.kernel.org/kees/c/59a54dc896c3
[7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
      https://git.kernel.org/kees/c/5cd476de33af
[8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
      https://git.kernel.org/kees/c/b426f2e5356a
[9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
      https://git.kernel.org/kees/c/dc662fa1b0e4

Take care,

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-29 19:33   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-29 19:33 UTC (permalink / raw)
  To: David Airlie, Kees Cook
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Lyude Paul, Yifan Zhang, linux-arm-msm, intel-gfx,
	Kevin Wang, Abhinav Kumar, Jani Nikula, Melissa Wen,
	Alex Deucher, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Zack Rusin, Daniel Vetter,
	Dmitry Baryshkov, Nirmoy Das, Lang Yu, Christian König,
	John Harrison, Hawking Zhang

On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> This is a batch of patches touching drm for preparing 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 to structs that would
> benefit from the annotation.
> 
> [...]

Since this got Acks, I figure I should carry it in my tree. Let me know
if this should go via drm instead.

Applied to for-next/hardening, thanks!

[1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
      https://git.kernel.org/kees/c/a6046ac659d6
[2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
      https://git.kernel.org/kees/c/4df33089b46f
[3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
      https://git.kernel.org/kees/c/ffd3f823bdf6
[4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
      https://git.kernel.org/kees/c/2de35a989b76
[5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
      https://git.kernel.org/kees/c/188aeb08bfaa
[6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
      https://git.kernel.org/kees/c/59a54dc896c3
[7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
      https://git.kernel.org/kees/c/5cd476de33af
[8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
      https://git.kernel.org/kees/c/b426f2e5356a
[9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
      https://git.kernel.org/kees/c/dc662fa1b0e4

Take care,

-- 
Kees Cook

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-29 19:33   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-29 19:33 UTC (permalink / raw)
  To: David Airlie, Kees Cook
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, linux-hardening, Lijo Lazar,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Melissa Wen, Alex Deucher, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Tvrtko Ursulin, Xiaojian Du,
	Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Dmitry Baryshkov, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> This is a batch of patches touching drm for preparing 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 to structs that would
> benefit from the annotation.
> 
> [...]

Since this got Acks, I figure I should carry it in my tree. Let me know
if this should go via drm instead.

Applied to for-next/hardening, thanks!

[1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
      https://git.kernel.org/kees/c/a6046ac659d6
[2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
      https://git.kernel.org/kees/c/4df33089b46f
[3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
      https://git.kernel.org/kees/c/ffd3f823bdf6
[4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
      https://git.kernel.org/kees/c/2de35a989b76
[5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
      https://git.kernel.org/kees/c/188aeb08bfaa
[6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
      https://git.kernel.org/kees/c/59a54dc896c3
[7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
      https://git.kernel.org/kees/c/5cd476de33af
[8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
      https://git.kernel.org/kees/c/b426f2e5356a
[9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
      https://git.kernel.org/kees/c/dc662fa1b0e4

Take care,

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-29 19:33   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-29 19:33 UTC (permalink / raw)
  To: David Airlie, Kees Cook
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	Nathan Chancellor, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Lijo Lazar, Yifan Zhang, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Melissa Wen, Alex Deucher,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Zack Rusin, Daniel Vetter,
	Dmitry Baryshkov, Nirmoy Das, Lang Yu, Christian König,
	Hawking Zhang

On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> This is a batch of patches touching drm for preparing 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 to structs that would
> benefit from the annotation.
> 
> [...]

Since this got Acks, I figure I should carry it in my tree. Let me know
if this should go via drm instead.

Applied to for-next/hardening, thanks!

[1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
      https://git.kernel.org/kees/c/a6046ac659d6
[2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
      https://git.kernel.org/kees/c/4df33089b46f
[3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
      https://git.kernel.org/kees/c/ffd3f823bdf6
[4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
      https://git.kernel.org/kees/c/2de35a989b76
[5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
      https://git.kernel.org/kees/c/188aeb08bfaa
[6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
      https://git.kernel.org/kees/c/59a54dc896c3
[7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
      https://git.kernel.org/kees/c/5cd476de33af
[8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
      https://git.kernel.org/kees/c/b426f2e5356a
[9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
      https://git.kernel.org/kees/c/dc662fa1b0e4

Take care,

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-09-29 19:33   ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-09-29 19:33 UTC (permalink / raw)
  To: David Airlie, Kees Cook
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Alex Deucher,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Dmitry Baryshkov,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> This is a batch of patches touching drm for preparing 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 to structs that would
> benefit from the annotation.
> 
> [...]

Since this got Acks, I figure I should carry it in my tree. Let me know
if this should go via drm instead.

Applied to for-next/hardening, thanks!

[1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
      https://git.kernel.org/kees/c/a6046ac659d6
[2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
      https://git.kernel.org/kees/c/4df33089b46f
[3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
      https://git.kernel.org/kees/c/ffd3f823bdf6
[4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
      https://git.kernel.org/kees/c/2de35a989b76
[5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
      https://git.kernel.org/kees/c/188aeb08bfaa
[6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
      https://git.kernel.org/kees/c/59a54dc896c3
[7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
      https://git.kernel.org/kees/c/5cd476de33af
[8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
      https://git.kernel.org/kees/c/b426f2e5356a
[9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
      https://git.kernel.org/kees/c/dc662fa1b0e4

Take care,

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
  2023-09-29 19:33   ` [Nouveau] " Kees Cook
                       ` (3 preceding siblings ...)
  (?)
@ 2023-10-02  9:20     ` Christian König
  -1 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02  9:20 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, Nathan Chancellor,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Lijo Lazar, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Melissa Wen, Alex Deucher,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Tvrtko Ursulin, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Zack Rusin, Daniel Vetter, Dmitry Baryshkov,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

Am 29.09.23 um 21:33 schrieb Kees Cook:
> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>> This is a batch of patches touching drm for preparing 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 to structs that would
>> benefit from the annotation.
>>
>> [...]
> Since this got Acks, I figure I should carry it in my tree. Let me know
> if this should go via drm instead.
>
> Applied to for-next/hardening, thanks!
>
> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>        https://git.kernel.org/kees/c/a6046ac659d6

STOP! In a follow up discussion Alex and I figured out that this won't work.

The value in the structure is byte swapped based on some firmware 
endianness which not necessary matches the CPU endianness.

Please revert that one from going upstream if it's already on it's way.

And because of those reasons I strongly think that patches like this 
should go through the DRM tree :)

Regards,
Christian.

> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>        https://git.kernel.org/kees/c/4df33089b46f
> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>        https://git.kernel.org/kees/c/ffd3f823bdf6
> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>        https://git.kernel.org/kees/c/2de35a989b76
> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>        https://git.kernel.org/kees/c/188aeb08bfaa
> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>        https://git.kernel.org/kees/c/59a54dc896c3
> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>        https://git.kernel.org/kees/c/5cd476de33af
> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>        https://git.kernel.org/kees/c/b426f2e5356a
> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>        https://git.kernel.org/kees/c/dc662fa1b0e4
>
> Take care,
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02  9:20     ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02  9:20 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, Joonas Lahtinen, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Evan Quan, Emma Anholt, amd-gfx,
	Kuogee Hsieh, Lijo Lazar, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, Dmitry Baryshkov, Chia-I Wu,
	llvm, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	virtualization, Sean Paul, Neil Armstrong, Xiaojian Du, Lang Yu,
	Bjorn Andersson, Tejas Upadhyay, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Rob Clark, Melissa Wen, John Harrison,
	Daniel Vetter, Alex Deucher, Nirmoy Das, freedreno,
	Christian König, Zack Rusin, linux-hardening

Am 29.09.23 um 21:33 schrieb Kees Cook:
> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>> This is a batch of patches touching drm for preparing 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 to structs that would
>> benefit from the annotation.
>>
>> [...]
> Since this got Acks, I figure I should carry it in my tree. Let me know
> if this should go via drm instead.
>
> Applied to for-next/hardening, thanks!
>
> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>        https://git.kernel.org/kees/c/a6046ac659d6

STOP! In a follow up discussion Alex and I figured out that this won't work.

The value in the structure is byte swapped based on some firmware 
endianness which not necessary matches the CPU endianness.

Please revert that one from going upstream if it's already on it's way.

And because of those reasons I strongly think that patches like this 
should go through the DRM tree :)

Regards,
Christian.

> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>        https://git.kernel.org/kees/c/4df33089b46f
> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>        https://git.kernel.org/kees/c/ffd3f823bdf6
> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>        https://git.kernel.org/kees/c/2de35a989b76
> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>        https://git.kernel.org/kees/c/188aeb08bfaa
> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>        https://git.kernel.org/kees/c/59a54dc896c3
> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>        https://git.kernel.org/kees/c/5cd476de33af
> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>        https://git.kernel.org/kees/c/b426f2e5356a
> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>        https://git.kernel.org/kees/c/dc662fa1b0e4
>
> Take care,
>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02  9:20     ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02  9:20 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Pan, Xinhui, Tom Rix, Joonas Lahtinen, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Evan Quan, Emma Anholt, amd-gfx,
	Kuogee Hsieh, Lijo Lazar, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, Dmitry Baryshkov, Chia-I Wu,
	llvm, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	virtualization, Sean Paul, Neil Armstrong, Xiaojian Du, Lang Yu,
	Bjorn Andersson, Tejas Upadhyay, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Rob Clark, Melissa Wen, John Harrison,
	Daniel Vetter, Alex Deucher, Nirmoy Das, freedreno,
	Christian König, Zack Rusin, linux-hardening

Am 29.09.23 um 21:33 schrieb Kees Cook:
> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>> This is a batch of patches touching drm for preparing 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 to structs that would
>> benefit from the annotation.
>>
>> [...]
> Since this got Acks, I figure I should carry it in my tree. Let me know
> if this should go via drm instead.
>
> Applied to for-next/hardening, thanks!
>
> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>        https://git.kernel.org/kees/c/a6046ac659d6

STOP! In a follow up discussion Alex and I figured out that this won't work.

The value in the structure is byte swapped based on some firmware 
endianness which not necessary matches the CPU endianness.

Please revert that one from going upstream if it's already on it's way.

And because of those reasons I strongly think that patches like this 
should go through the DRM tree :)

Regards,
Christian.

> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>        https://git.kernel.org/kees/c/4df33089b46f
> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>        https://git.kernel.org/kees/c/ffd3f823bdf6
> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>        https://git.kernel.org/kees/c/2de35a989b76
> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>        https://git.kernel.org/kees/c/188aeb08bfaa
> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>        https://git.kernel.org/kees/c/59a54dc896c3
> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>        https://git.kernel.org/kees/c/5cd476de33af
> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>        https://git.kernel.org/kees/c/b426f2e5356a
> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>        https://git.kernel.org/kees/c/dc662fa1b0e4
>
> Take care,
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02  9:20     ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02  9:20 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Evan Quan, Emma Anholt, amd-gfx,
	Kuogee Hsieh, Lijo Lazar, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, Dmitry Baryshkov, llvm,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Tvrtko Ursulin, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Melissa Wen, John Harrison, Alex Deucher, Nirmoy Das, freedreno,
	Christian König, linux-hardening

Am 29.09.23 um 21:33 schrieb Kees Cook:
> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>> This is a batch of patches touching drm for preparing 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 to structs that would
>> benefit from the annotation.
>>
>> [...]
> Since this got Acks, I figure I should carry it in my tree. Let me know
> if this should go via drm instead.
>
> Applied to for-next/hardening, thanks!
>
> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>        https://git.kernel.org/kees/c/a6046ac659d6

STOP! In a follow up discussion Alex and I figured out that this won't work.

The value in the structure is byte swapped based on some firmware 
endianness which not necessary matches the CPU endianness.

Please revert that one from going upstream if it's already on it's way.

And because of those reasons I strongly think that patches like this 
should go through the DRM tree :)

Regards,
Christian.

> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>        https://git.kernel.org/kees/c/4df33089b46f
> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>        https://git.kernel.org/kees/c/ffd3f823bdf6
> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>        https://git.kernel.org/kees/c/2de35a989b76
> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>        https://git.kernel.org/kees/c/188aeb08bfaa
> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>        https://git.kernel.org/kees/c/59a54dc896c3
> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>        https://git.kernel.org/kees/c/5cd476de33af
> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>        https://git.kernel.org/kees/c/b426f2e5356a
> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>        https://git.kernel.org/kees/c/dc662fa1b0e4
>
> Take care,
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02  9:20     ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02  9:20 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	Lijo Lazar, VMware Graphics Reviewers, Ben Skeggs, nouveau,
	David Airlie, Dmitry Baryshkov, Chia-I Wu, llvm, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Nathan Chancellor, Le Ma, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, virtualization, Neil Armstrong, Xiaojian Du,
	Lang Yu, Bjorn Andersson, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Melissa Wen, Daniel Vetter, Alex Deucher,
	Nirmoy Das, freedreno, Christian König, Zack Rusin,
	linux-hardening

Am 29.09.23 um 21:33 schrieb Kees Cook:
> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>> This is a batch of patches touching drm for preparing 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 to structs that would
>> benefit from the annotation.
>>
>> [...]
> Since this got Acks, I figure I should carry it in my tree. Let me know
> if this should go via drm instead.
>
> Applied to for-next/hardening, thanks!
>
> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>        https://git.kernel.org/kees/c/a6046ac659d6

STOP! In a follow up discussion Alex and I figured out that this won't work.

The value in the structure is byte swapped based on some firmware 
endianness which not necessary matches the CPU endianness.

Please revert that one from going upstream if it's already on it's way.

And because of those reasons I strongly think that patches like this 
should go through the DRM tree :)

Regards,
Christian.

> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>        https://git.kernel.org/kees/c/4df33089b46f
> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>        https://git.kernel.org/kees/c/ffd3f823bdf6
> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>        https://git.kernel.org/kees/c/2de35a989b76
> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>        https://git.kernel.org/kees/c/188aeb08bfaa
> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>        https://git.kernel.org/kees/c/59a54dc896c3
> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>        https://git.kernel.org/kees/c/5cd476de33af
> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>        https://git.kernel.org/kees/c/b426f2e5356a
> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>        https://git.kernel.org/kees/c/dc662fa1b0e4
>
> Take care,
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02  9:20     ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02  9:20 UTC (permalink / raw)
  To: Kees Cook, David Airlie
  Cc: Pan, Xinhui, Karol Herbst, Tom Rix, Joonas Lahtinen, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Evan Quan,
	Emma Anholt, amd-gfx, Kuogee Hsieh, Lijo Lazar,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Dmitry Baryshkov, Chia-I Wu, llvm, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Tvrtko Ursulin, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Rob Clark, Melissa Wen, John Harrison, Daniel Vetter,
	Alex Deucher, Nirmoy Das, freedreno, Christian König,
	Zack Rusin, linux-hardening

Am 29.09.23 um 21:33 schrieb Kees Cook:
> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>> This is a batch of patches touching drm for preparing 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 to structs that would
>> benefit from the annotation.
>>
>> [...]
> Since this got Acks, I figure I should carry it in my tree. Let me know
> if this should go via drm instead.
>
> Applied to for-next/hardening, thanks!
>
> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>        https://git.kernel.org/kees/c/a6046ac659d6

STOP! In a follow up discussion Alex and I figured out that this won't work.

The value in the structure is byte swapped based on some firmware 
endianness which not necessary matches the CPU endianness.

Please revert that one from going upstream if it's already on it's way.

And because of those reasons I strongly think that patches like this 
should go through the DRM tree :)

Regards,
Christian.

> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>        https://git.kernel.org/kees/c/4df33089b46f
> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>        https://git.kernel.org/kees/c/ffd3f823bdf6
> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>        https://git.kernel.org/kees/c/2de35a989b76
> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>        https://git.kernel.org/kees/c/188aeb08bfaa
> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>        https://git.kernel.org/kees/c/59a54dc896c3
> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>        https://git.kernel.org/kees/c/5cd476de33af
> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>        https://git.kernel.org/kees/c/b426f2e5356a
> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>        https://git.kernel.org/kees/c/dc662fa1b0e4
>
> Take care,
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
  2023-10-02  9:20     ` Christian König
                         ` (3 preceding siblings ...)
  (?)
@ 2023-10-02 15:06       ` Alex Deucher
  -1 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-10-02 15:06 UTC (permalink / raw)
  To: Christian König
  Cc: Kees Cook, David Airlie, Pan, Xinhui, Karol Herbst, Tom Rix,
	Joonas Lahtinen, dri-devel, Chris Wilson, Prike Liang, Huang Rui,
	Gerd Hoffmann, Andrzej Hajda, Marijn Suijten, Matthew Brost,
	Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh, Lijo Lazar,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Dmitry Baryshkov, Chia-I Wu, llvm, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Tvrtko Ursulin, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Rob Clark, Melissa Wen, John Harrison, Daniel Vetter,
	Alex Deucher, Nirmoy Das, freedreno, Christian König,
	Zack Rusin, linux-hardening

On Mon, Oct 2, 2023 at 5:20 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 29.09.23 um 21:33 schrieb Kees Cook:
> > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> >> This is a batch of patches touching drm for preparing 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 to structs that would
> >> benefit from the annotation.
> >>
> >> [...]
> > Since this got Acks, I figure I should carry it in my tree. Let me know
> > if this should go via drm instead.
> >
> > Applied to for-next/hardening, thanks!
> >
> > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> >        https://git.kernel.org/kees/c/a6046ac659d6
>
> STOP! In a follow up discussion Alex and I figured out that this won't work.
>
> The value in the structure is byte swapped based on some firmware
> endianness which not necessary matches the CPU endianness.

SMU10 is APU only so the endianess of the SMU firmware and the CPU
will always match.

Alex

>
> Please revert that one from going upstream if it's already on it's way.
>
> And because of those reasons I strongly think that patches like this
> should go through the DRM tree :)
>
> Regards,
> Christian.
>
> > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> >        https://git.kernel.org/kees/c/4df33089b46f
> > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> >        https://git.kernel.org/kees/c/2de35a989b76
> > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> >        https://git.kernel.org/kees/c/188aeb08bfaa
> > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/59a54dc896c3
> > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> >        https://git.kernel.org/kees/c/5cd476de33af
> > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> >        https://git.kernel.org/kees/c/b426f2e5356a
> > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/dc662fa1b0e4
> >
> > Take care,
> >
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 15:06       ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-10-02 15:06 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Tom Rix, Joonas Lahtinen, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Emma Anholt,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	Chia-I Wu, linux-hardening, Alex Deucher, Lijo Lazar, Kees Cook,
	Tvrtko Ursulin, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Yifan Zhang, Xiaojian Du, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Rob Clark,
	Melissa Wen, Zack Rusin, Daniel Vetter, Dmitry Baryshkov,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

On Mon, Oct 2, 2023 at 5:20 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 29.09.23 um 21:33 schrieb Kees Cook:
> > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> >> This is a batch of patches touching drm for preparing 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 to structs that would
> >> benefit from the annotation.
> >>
> >> [...]
> > Since this got Acks, I figure I should carry it in my tree. Let me know
> > if this should go via drm instead.
> >
> > Applied to for-next/hardening, thanks!
> >
> > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> >        https://git.kernel.org/kees/c/a6046ac659d6
>
> STOP! In a follow up discussion Alex and I figured out that this won't work.
>
> The value in the structure is byte swapped based on some firmware
> endianness which not necessary matches the CPU endianness.

SMU10 is APU only so the endianess of the SMU firmware and the CPU
will always match.

Alex

>
> Please revert that one from going upstream if it's already on it's way.
>
> And because of those reasons I strongly think that patches like this
> should go through the DRM tree :)
>
> Regards,
> Christian.
>
> > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> >        https://git.kernel.org/kees/c/4df33089b46f
> > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> >        https://git.kernel.org/kees/c/2de35a989b76
> > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> >        https://git.kernel.org/kees/c/188aeb08bfaa
> > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/59a54dc896c3
> > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> >        https://git.kernel.org/kees/c/5cd476de33af
> > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> >        https://git.kernel.org/kees/c/b426f2e5356a
> > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/dc662fa1b0e4
> >
> > Take care,
> >
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 15:06       ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-10-02 15:06 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Karol Herbst, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Emma Anholt,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	Chia-I Wu, linux-hardening, Alex Deucher, Lijo Lazar, Kees Cook,
	Tvrtko Ursulin, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Yifan Zhang, Xiaojian Du, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Rob Clark,
	Melissa Wen, Zack Rusin, Daniel Vetter, Dmitry Baryshkov,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

On Mon, Oct 2, 2023 at 5:20 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 29.09.23 um 21:33 schrieb Kees Cook:
> > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> >> This is a batch of patches touching drm for preparing 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 to structs that would
> >> benefit from the annotation.
> >>
> >> [...]
> > Since this got Acks, I figure I should carry it in my tree. Let me know
> > if this should go via drm instead.
> >
> > Applied to for-next/hardening, thanks!
> >
> > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> >        https://git.kernel.org/kees/c/a6046ac659d6
>
> STOP! In a follow up discussion Alex and I figured out that this won't work.
>
> The value in the structure is byte swapped based on some firmware
> endianness which not necessary matches the CPU endianness.

SMU10 is APU only so the endianess of the SMU firmware and the CPU
will always match.

Alex

>
> Please revert that one from going upstream if it's already on it's way.
>
> And because of those reasons I strongly think that patches like this
> should go through the DRM tree :)
>
> Regards,
> Christian.
>
> > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> >        https://git.kernel.org/kees/c/4df33089b46f
> > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> >        https://git.kernel.org/kees/c/2de35a989b76
> > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> >        https://git.kernel.org/kees/c/188aeb08bfaa
> > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/59a54dc896c3
> > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> >        https://git.kernel.org/kees/c/5cd476de33af
> > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> >        https://git.kernel.org/kees/c/b426f2e5356a
> > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/dc662fa1b0e4
> >
> > Take care,
> >
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 15:06       ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-10-02 15:06 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Karol Herbst, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Emma Anholt,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Alex Deucher, Lijo Lazar, Kees Cook,
	Tvrtko Ursulin, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Melissa Wen, Dmitry Baryshkov,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

On Mon, Oct 2, 2023 at 5:20 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 29.09.23 um 21:33 schrieb Kees Cook:
> > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> >> This is a batch of patches touching drm for preparing 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 to structs that would
> >> benefit from the annotation.
> >>
> >> [...]
> > Since this got Acks, I figure I should carry it in my tree. Let me know
> > if this should go via drm instead.
> >
> > Applied to for-next/hardening, thanks!
> >
> > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> >        https://git.kernel.org/kees/c/a6046ac659d6
>
> STOP! In a follow up discussion Alex and I figured out that this won't work.
>
> The value in the structure is byte swapped based on some firmware
> endianness which not necessary matches the CPU endianness.

SMU10 is APU only so the endianess of the SMU firmware and the CPU
will always match.

Alex

>
> Please revert that one from going upstream if it's already on it's way.
>
> And because of those reasons I strongly think that patches like this
> should go through the DRM tree :)
>
> Regards,
> Christian.
>
> > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> >        https://git.kernel.org/kees/c/4df33089b46f
> > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> >        https://git.kernel.org/kees/c/2de35a989b76
> > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> >        https://git.kernel.org/kees/c/188aeb08bfaa
> > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/59a54dc896c3
> > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> >        https://git.kernel.org/kees/c/5cd476de33af
> > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> >        https://git.kernel.org/kees/c/b426f2e5356a
> > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/dc662fa1b0e4
> >
> > Take care,
> >
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 15:06       ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-10-02 15:06 UTC (permalink / raw)
  To: Christian König
  Cc: Karol Herbst, Tom Rix, llvm, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, David Airlie, Emma Anholt, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Kees Cook,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Nathan Chancellor, Le Ma, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Yifan Zhang, Xiaojian Du, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Melissa Wen, Zack Rusin, Daniel Vetter, Dmitry Baryshkov,
	Nirmoy Das, Lang Yu, Christian König, Hawking Zhang

On Mon, Oct 2, 2023 at 5:20 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 29.09.23 um 21:33 schrieb Kees Cook:
> > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> >> This is a batch of patches touching drm for preparing 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 to structs that would
> >> benefit from the annotation.
> >>
> >> [...]
> > Since this got Acks, I figure I should carry it in my tree. Let me know
> > if this should go via drm instead.
> >
> > Applied to for-next/hardening, thanks!
> >
> > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> >        https://git.kernel.org/kees/c/a6046ac659d6
>
> STOP! In a follow up discussion Alex and I figured out that this won't work.
>
> The value in the structure is byte swapped based on some firmware
> endianness which not necessary matches the CPU endianness.

SMU10 is APU only so the endianess of the SMU firmware and the CPU
will always match.

Alex

>
> Please revert that one from going upstream if it's already on it's way.
>
> And because of those reasons I strongly think that patches like this
> should go through the DRM tree :)
>
> Regards,
> Christian.
>
> > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> >        https://git.kernel.org/kees/c/4df33089b46f
> > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> >        https://git.kernel.org/kees/c/2de35a989b76
> > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> >        https://git.kernel.org/kees/c/188aeb08bfaa
> > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/59a54dc896c3
> > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> >        https://git.kernel.org/kees/c/5cd476de33af
> > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> >        https://git.kernel.org/kees/c/b426f2e5356a
> > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/dc662fa1b0e4
> >
> > Take care,
> >
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 15:06       ` Alex Deucher
  0 siblings, 0 replies; 243+ messages in thread
From: Alex Deucher @ 2023-10-02 15:06 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Karol Herbst, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Emma Anholt, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, Kees Cook, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Le Ma, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang, Xiaojian Du,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Melissa Wen, Zack Rusin, Daniel Vetter,
	Dmitry Baryshkov, Nirmoy Das, Lang Yu, Christian König,
	John Harrison, Hawking Zhang

On Mon, Oct 2, 2023 at 5:20 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 29.09.23 um 21:33 schrieb Kees Cook:
> > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> >> This is a batch of patches touching drm for preparing 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 to structs that would
> >> benefit from the annotation.
> >>
> >> [...]
> > Since this got Acks, I figure I should carry it in my tree. Let me know
> > if this should go via drm instead.
> >
> > Applied to for-next/hardening, thanks!
> >
> > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> >        https://git.kernel.org/kees/c/a6046ac659d6
>
> STOP! In a follow up discussion Alex and I figured out that this won't work.
>
> The value in the structure is byte swapped based on some firmware
> endianness which not necessary matches the CPU endianness.

SMU10 is APU only so the endianess of the SMU firmware and the CPU
will always match.

Alex

>
> Please revert that one from going upstream if it's already on it's way.
>
> And because of those reasons I strongly think that patches like this
> should go through the DRM tree :)
>
> Regards,
> Christian.
>
> > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> >        https://git.kernel.org/kees/c/4df33089b46f
> > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> >        https://git.kernel.org/kees/c/2de35a989b76
> > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> >        https://git.kernel.org/kees/c/188aeb08bfaa
> > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/59a54dc896c3
> > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> >        https://git.kernel.org/kees/c/5cd476de33af
> > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> >        https://git.kernel.org/kees/c/b426f2e5356a
> > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> >        https://git.kernel.org/kees/c/dc662fa1b0e4
> >
> > Take care,
> >
>

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
  2023-10-02 15:06       ` [Nouveau] " Alex Deucher
                           ` (3 preceding siblings ...)
  (?)
@ 2023-10-02 16:53         ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 16:53 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Christian König, David Airlie, Pan, Xinhui, Karol Herbst,
	Tom Rix, Joonas Lahtinen, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Matthew Brost, Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh,
	Lijo Lazar, VMware Graphics Reviewers, Ben Skeggs, Andi Shyti,
	nouveau, David Airlie, Dmitry Baryshkov, Chia-I Wu, llvm,
	Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Jani Nikula, Tvrtko Ursulin, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, virtualization,
	Sean Paul, Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Rob Clark, Melissa Wen, John Harrison, Daniel Vetter,
	Alex Deucher, Nirmoy Das, freedreno, Christian König,
	Zack Rusin, linux-hardening

On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> On Mon, Oct 2, 2023 at 5:20 AM Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
> >
> > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > >> This is a batch of patches touching drm for preparing 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 to structs that would
> > >> benefit from the annotation.
> > >>
> > >> [...]
> > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > if this should go via drm instead.
> > >
> > > Applied to for-next/hardening, thanks!
> > >
> > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > >        https://git.kernel.org/kees/c/a6046ac659d6
> >
> > STOP! In a follow up discussion Alex and I figured out that this won't work.

I'm so confused; from the discussion I saw that Alex said both instances
were false positives?

> >
> > The value in the structure is byte swapped based on some firmware
> > endianness which not necessary matches the CPU endianness.
> 
> SMU10 is APU only so the endianess of the SMU firmware and the CPU
> will always match.

Which I think is what is being said here?

> > Please revert that one from going upstream if it's already on it's way.
> >
> > And because of those reasons I strongly think that patches like this
> > should go through the DRM tree :)

Sure, that's fine -- please let me know. It was others Acked/etc. Who
should carry these patches?

Thanks!

-Kees


> >
> > Regards,
> > Christian.
> >
> > > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> > >        https://git.kernel.org/kees/c/4df33089b46f
> > > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> > >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> > >        https://git.kernel.org/kees/c/2de35a989b76
> > > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> > >        https://git.kernel.org/kees/c/188aeb08bfaa
> > > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/59a54dc896c3
> > > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> > >        https://git.kernel.org/kees/c/5cd476de33af
> > > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> > >        https://git.kernel.org/kees/c/b426f2e5356a
> > > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/dc662fa1b0e4
> > >
> > > Take care,
> > >
> >

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 16:53         ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 16:53 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, linux-arm-msm,
	Joonas Lahtinen, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Matthew Brost, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, Tvrtko Ursulin, Christian König,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Le Ma, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang, Xiaojian Du,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Melissa Wen, Zack Rusin, Daniel Vetter,
	Dmitry Baryshkov, Nirmoy Das, Lang Yu, Christian König,
	John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> On Mon, Oct 2, 2023 at 5:20 AM Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
> >
> > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > >> This is a batch of patches touching drm for preparing 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 to structs that would
> > >> benefit from the annotation.
> > >>
> > >> [...]
> > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > if this should go via drm instead.
> > >
> > > Applied to for-next/hardening, thanks!
> > >
> > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > >        https://git.kernel.org/kees/c/a6046ac659d6
> >
> > STOP! In a follow up discussion Alex and I figured out that this won't work.

I'm so confused; from the discussion I saw that Alex said both instances
were false positives?

> >
> > The value in the structure is byte swapped based on some firmware
> > endianness which not necessary matches the CPU endianness.
> 
> SMU10 is APU only so the endianess of the SMU firmware and the CPU
> will always match.

Which I think is what is being said here?

> > Please revert that one from going upstream if it's already on it's way.
> >
> > And because of those reasons I strongly think that patches like this
> > should go through the DRM tree :)

Sure, that's fine -- please let me know. It was others Acked/etc. Who
should carry these patches?

Thanks!

-Kees


> >
> > Regards,
> > Christian.
> >
> > > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> > >        https://git.kernel.org/kees/c/4df33089b46f
> > > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> > >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> > >        https://git.kernel.org/kees/c/2de35a989b76
> > > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> > >        https://git.kernel.org/kees/c/188aeb08bfaa
> > > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/59a54dc896c3
> > > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> > >        https://git.kernel.org/kees/c/5cd476de33af
> > > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> > >        https://git.kernel.org/kees/c/b426f2e5356a
> > > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/dc662fa1b0e4
> > >
> > > Take care,
> > >
> >

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 16:53         ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 16:53 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, linux-arm-msm,
	Joonas Lahtinen, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Andrzej Hajda, Marijn Suijten, David Airlie,
	Matthew Brost, Karol Herbst, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, Andi Shyti,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	Christian König, intel-gfx, Kevin Wang, Abhinav Kumar,
	Jani Nikula, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Dmitry Baryshkov, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> On Mon, Oct 2, 2023 at 5:20 AM Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
> >
> > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > >> This is a batch of patches touching drm for preparing 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 to structs that would
> > >> benefit from the annotation.
> > >>
> > >> [...]
> > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > if this should go via drm instead.
> > >
> > > Applied to for-next/hardening, thanks!
> > >
> > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > >        https://git.kernel.org/kees/c/a6046ac659d6
> >
> > STOP! In a follow up discussion Alex and I figured out that this won't work.

I'm so confused; from the discussion I saw that Alex said both instances
were false positives?

> >
> > The value in the structure is byte swapped based on some firmware
> > endianness which not necessary matches the CPU endianness.
> 
> SMU10 is APU only so the endianess of the SMU firmware and the CPU
> will always match.

Which I think is what is being said here?

> > Please revert that one from going upstream if it's already on it's way.
> >
> > And because of those reasons I strongly think that patches like this
> > should go through the DRM tree :)

Sure, that's fine -- please let me know. It was others Acked/etc. Who
should carry these patches?

Thanks!

-Kees


> >
> > Regards,
> > Christian.
> >
> > > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> > >        https://git.kernel.org/kees/c/4df33089b46f
> > > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> > >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> > >        https://git.kernel.org/kees/c/2de35a989b76
> > > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> > >        https://git.kernel.org/kees/c/188aeb08bfaa
> > > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/59a54dc896c3
> > > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> > >        https://git.kernel.org/kees/c/5cd476de33af
> > > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> > >        https://git.kernel.org/kees/c/b426f2e5356a
> > > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/dc662fa1b0e4
> > >
> > > Take care,
> > >
> >

-- 
Kees Cook
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 16:53         ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 16:53 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, linux-arm-msm, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	Christian König, intel-gfx, Kevin Wang, Abhinav Kumar,
	Nathan Chancellor, Le Ma, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang, Xiaojian Du,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Melissa Wen, Dmitry Baryshkov, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> On Mon, Oct 2, 2023 at 5:20 AM Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
> >
> > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > >> This is a batch of patches touching drm for preparing 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 to structs that would
> > >> benefit from the annotation.
> > >>
> > >> [...]
> > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > if this should go via drm instead.
> > >
> > > Applied to for-next/hardening, thanks!
> > >
> > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > >        https://git.kernel.org/kees/c/a6046ac659d6
> >
> > STOP! In a follow up discussion Alex and I figured out that this won't work.

I'm so confused; from the discussion I saw that Alex said both instances
were false positives?

> >
> > The value in the structure is byte swapped based on some firmware
> > endianness which not necessary matches the CPU endianness.
> 
> SMU10 is APU only so the endianess of the SMU firmware and the CPU
> will always match.

Which I think is what is being said here?

> > Please revert that one from going upstream if it's already on it's way.
> >
> > And because of those reasons I strongly think that patches like this
> > should go through the DRM tree :)

Sure, that's fine -- please let me know. It was others Acked/etc. Who
should carry these patches?

Thanks!

-Kees


> >
> > Regards,
> > Christian.
> >
> > > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> > >        https://git.kernel.org/kees/c/4df33089b46f
> > > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> > >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> > >        https://git.kernel.org/kees/c/2de35a989b76
> > > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> > >        https://git.kernel.org/kees/c/188aeb08bfaa
> > > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/59a54dc896c3
> > > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> > >        https://git.kernel.org/kees/c/5cd476de33af
> > > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> > >        https://git.kernel.org/kees/c/b426f2e5356a
> > > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/dc662fa1b0e4
> > >
> > > Take care,
> > >
> >

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 16:53         ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 16:53 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Emma Anholt, Tom Rix, linux-arm-msm, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Christian König,
	intel-gfx, Kevin Wang, Abhinav Kumar, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Yifan Zhang, Xiaojian Du, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Melissa Wen, Zack Rusin,
	Daniel Vetter, Dmitry Baryshkov, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> On Mon, Oct 2, 2023 at 5:20 AM Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
> >
> > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > >> This is a batch of patches touching drm for preparing 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 to structs that would
> > >> benefit from the annotation.
> > >>
> > >> [...]
> > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > if this should go via drm instead.
> > >
> > > Applied to for-next/hardening, thanks!
> > >
> > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > >        https://git.kernel.org/kees/c/a6046ac659d6
> >
> > STOP! In a follow up discussion Alex and I figured out that this won't work.

I'm so confused; from the discussion I saw that Alex said both instances
were false positives?

> >
> > The value in the structure is byte swapped based on some firmware
> > endianness which not necessary matches the CPU endianness.
> 
> SMU10 is APU only so the endianess of the SMU firmware and the CPU
> will always match.

Which I think is what is being said here?

> > Please revert that one from going upstream if it's already on it's way.
> >
> > And because of those reasons I strongly think that patches like this
> > should go through the DRM tree :)

Sure, that's fine -- please let me know. It was others Acked/etc. Who
should carry these patches?

Thanks!

-Kees


> >
> > Regards,
> > Christian.
> >
> > > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> > >        https://git.kernel.org/kees/c/4df33089b46f
> > > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> > >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> > >        https://git.kernel.org/kees/c/2de35a989b76
> > > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> > >        https://git.kernel.org/kees/c/188aeb08bfaa
> > > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/59a54dc896c3
> > > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> > >        https://git.kernel.org/kees/c/5cd476de33af
> > > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> > >        https://git.kernel.org/kees/c/b426f2e5356a
> > > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/dc662fa1b0e4
> > >
> > > Take care,
> > >
> >

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 16:53         ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 16:53 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, linux-arm-msm,
	Joonas Lahtinen, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	David Airlie, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	Christian König, intel-gfx, Kevin Wang, Abhinav Kumar,
	Jani Nikula, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Dmitry Baryshkov, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> On Mon, Oct 2, 2023 at 5:20 AM Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
> >
> > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > >> This is a batch of patches touching drm for preparing 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 to structs that would
> > >> benefit from the annotation.
> > >>
> > >> [...]
> > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > if this should go via drm instead.
> > >
> > > Applied to for-next/hardening, thanks!
> > >
> > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > >        https://git.kernel.org/kees/c/a6046ac659d6
> >
> > STOP! In a follow up discussion Alex and I figured out that this won't work.

I'm so confused; from the discussion I saw that Alex said both instances
were false positives?

> >
> > The value in the structure is byte swapped based on some firmware
> > endianness which not necessary matches the CPU endianness.
> 
> SMU10 is APU only so the endianess of the SMU firmware and the CPU
> will always match.

Which I think is what is being said here?

> > Please revert that one from going upstream if it's already on it's way.
> >
> > And because of those reasons I strongly think that patches like this
> > should go through the DRM tree :)

Sure, that's fine -- please let me know. It was others Acked/etc. Who
should carry these patches?

Thanks!

-Kees


> >
> > Regards,
> > Christian.
> >
> > > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
> > >        https://git.kernel.org/kees/c/4df33089b46f
> > > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
> > >        https://git.kernel.org/kees/c/ffd3f823bdf6
> > > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
> > >        https://git.kernel.org/kees/c/2de35a989b76
> > > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
> > >        https://git.kernel.org/kees/c/188aeb08bfaa
> > > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/59a54dc896c3
> > > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
> > >        https://git.kernel.org/kees/c/5cd476de33af
> > > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
> > >        https://git.kernel.org/kees/c/b426f2e5356a
> > > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
> > >        https://git.kernel.org/kees/c/dc662fa1b0e4
> > >
> > > Take care,
> > >
> >

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
  2023-10-02 16:53         ` [Nouveau] " Kees Cook
                             ` (3 preceding siblings ...)
  (?)
@ 2023-10-02 18:01           ` Christian König
  -1 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:01 UTC (permalink / raw)
  To: Kees Cook, Alex Deucher
  Cc: David Airlie, Pan, Xinhui, Karol Herbst, Tom Rix,
	Joonas Lahtinen, dri-devel, Chris Wilson, Prike Liang, Huang Rui,
	Gerd Hoffmann, Andrzej Hajda, Marijn Suijten, Matthew Brost,
	Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh, Lijo Lazar,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Dmitry Baryshkov, Chia-I Wu, llvm, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Tvrtko Ursulin, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Rob Clark, Melissa Wen, John Harrison, Daniel Vetter,
	Alex Deucher, Nirmoy Das, freedreno, Christian König,
	Zack Rusin, linux-hardening

Am 02.10.23 um 18:53 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>> benefit from the annotation.
>>>>>
>>>>> [...]
>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>> if this should go via drm instead.
>>>>
>>>> Applied to for-next/hardening, thanks!
>>>>
>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>         https://git.kernel.org/kees/c/a6046ac659d6
>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
> I'm so confused; from the discussion I saw that Alex said both instances
> were false positives?
>
>>> The value in the structure is byte swapped based on some firmware
>>> endianness which not necessary matches the CPU endianness.
>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>> will always match.
> Which I think is what is being said here?
>
>>> Please revert that one from going upstream if it's already on it's way.
>>>
>>> And because of those reasons I strongly think that patches like this
>>> should go through the DRM tree :)
> Sure, that's fine -- please let me know. It was others Acked/etc. Who
> should carry these patches?

Probably best if the relevant maintainer pick them up individually.

Some of those structures are filled in by firmware/hardware and only the 
maintainers can judge if that value actually matches what the compiler 
needs.

We have cases where individual bits are used as flags or when the size 
is byte swapped etc...

Even Alex and I didn't immediately say how and where that field is 
actually used and had to dig that up. That's where the confusion came from.

Regards,
Christian.

>
> Thanks!
>
> -Kees
>
>
>>> Regards,
>>> Christian.
>>>
>>>> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>>>>         https://git.kernel.org/kees/c/4df33089b46f
>>>> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>>>>         https://git.kernel.org/kees/c/ffd3f823bdf6
>>>> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>>>>         https://git.kernel.org/kees/c/2de35a989b76
>>>> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>>>>         https://git.kernel.org/kees/c/188aeb08bfaa
>>>> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/59a54dc896c3
>>>> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>>>>         https://git.kernel.org/kees/c/5cd476de33af
>>>> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>>>>         https://git.kernel.org/kees/c/b426f2e5356a
>>>> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/dc662fa1b0e4
>>>>
>>>> Take care,
>>>>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:01           ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:01 UTC (permalink / raw)
  To: Kees Cook, Alex Deucher
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Le Ma, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang, Xiaojian Du,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Melissa Wen, Zack Rusin, Daniel Vetter,
	Dmitry Baryshkov, Nirmoy Das, Lang Yu, Christian König,
	John Harrison, Hawking Zhang

Am 02.10.23 um 18:53 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>> benefit from the annotation.
>>>>>
>>>>> [...]
>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>> if this should go via drm instead.
>>>>
>>>> Applied to for-next/hardening, thanks!
>>>>
>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>         https://git.kernel.org/kees/c/a6046ac659d6
>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
> I'm so confused; from the discussion I saw that Alex said both instances
> were false positives?
>
>>> The value in the structure is byte swapped based on some firmware
>>> endianness which not necessary matches the CPU endianness.
>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>> will always match.
> Which I think is what is being said here?
>
>>> Please revert that one from going upstream if it's already on it's way.
>>>
>>> And because of those reasons I strongly think that patches like this
>>> should go through the DRM tree :)
> Sure, that's fine -- please let me know. It was others Acked/etc. Who
> should carry these patches?

Probably best if the relevant maintainer pick them up individually.

Some of those structures are filled in by firmware/hardware and only the 
maintainers can judge if that value actually matches what the compiler 
needs.

We have cases where individual bits are used as flags or when the size 
is byte swapped etc...

Even Alex and I didn't immediately say how and where that field is 
actually used and had to dig that up. That's where the confusion came from.

Regards,
Christian.

>
> Thanks!
>
> -Kees
>
>
>>> Regards,
>>> Christian.
>>>
>>>> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>>>>         https://git.kernel.org/kees/c/4df33089b46f
>>>> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>>>>         https://git.kernel.org/kees/c/ffd3f823bdf6
>>>> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>>>>         https://git.kernel.org/kees/c/2de35a989b76
>>>> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>>>>         https://git.kernel.org/kees/c/188aeb08bfaa
>>>> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/59a54dc896c3
>>>> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>>>>         https://git.kernel.org/kees/c/5cd476de33af
>>>> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>>>>         https://git.kernel.org/kees/c/b426f2e5356a
>>>> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/dc662fa1b0e4
>>>>
>>>> Take care,
>>>>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:01           ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:01 UTC (permalink / raw)
  To: Kees Cook, Alex Deucher
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	Chia-I Wu, linux-hardening, Alex Deucher, Lijo Lazar,
	Tvrtko Ursulin, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Nathan Chancellor, Le Ma,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Yifan Zhang, Xiaojian Du, freedreno, Bjorn Andersson,
	Pan, Xinhui, Nick Desaulniers, linux-kernel, Rob Clark,
	Melissa Wen, Zack Rusin, Daniel Vetter, Dmitry Baryshkov,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

Am 02.10.23 um 18:53 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>> benefit from the annotation.
>>>>>
>>>>> [...]
>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>> if this should go via drm instead.
>>>>
>>>> Applied to for-next/hardening, thanks!
>>>>
>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>         https://git.kernel.org/kees/c/a6046ac659d6
>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
> I'm so confused; from the discussion I saw that Alex said both instances
> were false positives?
>
>>> The value in the structure is byte swapped based on some firmware
>>> endianness which not necessary matches the CPU endianness.
>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>> will always match.
> Which I think is what is being said here?
>
>>> Please revert that one from going upstream if it's already on it's way.
>>>
>>> And because of those reasons I strongly think that patches like this
>>> should go through the DRM tree :)
> Sure, that's fine -- please let me know. It was others Acked/etc. Who
> should carry these patches?

Probably best if the relevant maintainer pick them up individually.

Some of those structures are filled in by firmware/hardware and only the 
maintainers can judge if that value actually matches what the compiler 
needs.

We have cases where individual bits are used as flags or when the size 
is byte swapped etc...

Even Alex and I didn't immediately say how and where that field is 
actually used and had to dig that up. That's where the confusion came from.

Regards,
Christian.

>
> Thanks!
>
> -Kees
>
>
>>> Regards,
>>> Christian.
>>>
>>>> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>>>>         https://git.kernel.org/kees/c/4df33089b46f
>>>> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>>>>         https://git.kernel.org/kees/c/ffd3f823bdf6
>>>> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>>>>         https://git.kernel.org/kees/c/2de35a989b76
>>>> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>>>>         https://git.kernel.org/kees/c/188aeb08bfaa
>>>> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/59a54dc896c3
>>>> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>>>>         https://git.kernel.org/kees/c/5cd476de33af
>>>> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>>>>         https://git.kernel.org/kees/c/b426f2e5356a
>>>> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/dc662fa1b0e4
>>>>
>>>> Take care,
>>>>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:01           ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:01 UTC (permalink / raw)
  To: Kees Cook, Alex Deucher
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Nathan Chancellor, Le Ma, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang, Xiaojian Du,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Melissa Wen, Dmitry Baryshkov, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

Am 02.10.23 um 18:53 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>> benefit from the annotation.
>>>>>
>>>>> [...]
>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>> if this should go via drm instead.
>>>>
>>>> Applied to for-next/hardening, thanks!
>>>>
>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>         https://git.kernel.org/kees/c/a6046ac659d6
>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
> I'm so confused; from the discussion I saw that Alex said both instances
> were false positives?
>
>>> The value in the structure is byte swapped based on some firmware
>>> endianness which not necessary matches the CPU endianness.
>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>> will always match.
> Which I think is what is being said here?
>
>>> Please revert that one from going upstream if it's already on it's way.
>>>
>>> And because of those reasons I strongly think that patches like this
>>> should go through the DRM tree :)
> Sure, that's fine -- please let me know. It was others Acked/etc. Who
> should carry these patches?

Probably best if the relevant maintainer pick them up individually.

Some of those structures are filled in by firmware/hardware and only the 
maintainers can judge if that value actually matches what the compiler 
needs.

We have cases where individual bits are used as flags or when the size 
is byte swapped etc...

Even Alex and I didn't immediately say how and where that field is 
actually used and had to dig that up. That's where the confusion came from.

Regards,
Christian.

>
> Thanks!
>
> -Kees
>
>
>>> Regards,
>>> Christian.
>>>
>>>> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>>>>         https://git.kernel.org/kees/c/4df33089b46f
>>>> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>>>>         https://git.kernel.org/kees/c/ffd3f823bdf6
>>>> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>>>>         https://git.kernel.org/kees/c/2de35a989b76
>>>> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>>>>         https://git.kernel.org/kees/c/188aeb08bfaa
>>>> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/59a54dc896c3
>>>> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>>>>         https://git.kernel.org/kees/c/5cd476de33af
>>>> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>>>>         https://git.kernel.org/kees/c/b426f2e5356a
>>>> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/dc662fa1b0e4
>>>>
>>>> Take care,
>>>>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:01           ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:01 UTC (permalink / raw)
  To: Kees Cook, Alex Deucher
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	David Airlie, Karol Herbst, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Yifan Zhang, Xiaojian Du,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Melissa Wen, Zack Rusin, Daniel Vetter,
	Dmitry Baryshkov, Nirmoy Das, Lang Yu, Christian König,
	Hawking Zhang

Am 02.10.23 um 18:53 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>> benefit from the annotation.
>>>>>
>>>>> [...]
>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>> if this should go via drm instead.
>>>>
>>>> Applied to for-next/hardening, thanks!
>>>>
>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>         https://git.kernel.org/kees/c/a6046ac659d6
>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
> I'm so confused; from the discussion I saw that Alex said both instances
> were false positives?
>
>>> The value in the structure is byte swapped based on some firmware
>>> endianness which not necessary matches the CPU endianness.
>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>> will always match.
> Which I think is what is being said here?
>
>>> Please revert that one from going upstream if it's already on it's way.
>>>
>>> And because of those reasons I strongly think that patches like this
>>> should go through the DRM tree :)
> Sure, that's fine -- please let me know. It was others Acked/etc. Who
> should carry these patches?

Probably best if the relevant maintainer pick them up individually.

Some of those structures are filled in by firmware/hardware and only the 
maintainers can judge if that value actually matches what the compiler 
needs.

We have cases where individual bits are used as flags or when the size 
is byte swapped etc...

Even Alex and I didn't immediately say how and where that field is 
actually used and had to dig that up. That's where the confusion came from.

Regards,
Christian.

>
> Thanks!
>
> -Kees
>
>
>>> Regards,
>>> Christian.
>>>
>>>> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>>>>         https://git.kernel.org/kees/c/4df33089b46f
>>>> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>>>>         https://git.kernel.org/kees/c/ffd3f823bdf6
>>>> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>>>>         https://git.kernel.org/kees/c/2de35a989b76
>>>> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>>>>         https://git.kernel.org/kees/c/188aeb08bfaa
>>>> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/59a54dc896c3
>>>> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>>>>         https://git.kernel.org/kees/c/5cd476de33af
>>>> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>>>>         https://git.kernel.org/kees/c/b426f2e5356a
>>>> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/dc662fa1b0e4
>>>>
>>>> Take care,
>>>>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:01           ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:01 UTC (permalink / raw)
  To: Kees Cook, Alex Deucher
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, Tvrtko Ursulin, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Le Ma, Gurchetan Singh, Maxime Ripard,
	Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang, Xiaojian Du,
	freedreno, Bjorn Andersson, Pan, Xinhui, Nick Desaulniers,
	linux-kernel, Rob Clark, Melissa Wen, Zack Rusin, Daniel Vetter,
	Dmitry Baryshkov, Nirmoy Das, Lang Yu, Christian König,
	John Harrison, Hawking Zhang

Am 02.10.23 um 18:53 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>> benefit from the annotation.
>>>>>
>>>>> [...]
>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>> if this should go via drm instead.
>>>>
>>>> Applied to for-next/hardening, thanks!
>>>>
>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>         https://git.kernel.org/kees/c/a6046ac659d6
>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
> I'm so confused; from the discussion I saw that Alex said both instances
> were false positives?
>
>>> The value in the structure is byte swapped based on some firmware
>>> endianness which not necessary matches the CPU endianness.
>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>> will always match.
> Which I think is what is being said here?
>
>>> Please revert that one from going upstream if it's already on it's way.
>>>
>>> And because of those reasons I strongly think that patches like this
>>> should go through the DRM tree :)
> Sure, that's fine -- please let me know. It was others Acked/etc. Who
> should carry these patches?

Probably best if the relevant maintainer pick them up individually.

Some of those structures are filled in by firmware/hardware and only the 
maintainers can judge if that value actually matches what the compiler 
needs.

We have cases where individual bits are used as flags or when the size 
is byte swapped etc...

Even Alex and I didn't immediately say how and where that field is 
actually used and had to dig that up. That's where the confusion came from.

Regards,
Christian.

>
> Thanks!
>
> -Kees
>
>
>>> Regards,
>>> Christian.
>>>
>>>> [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by
>>>>         https://git.kernel.org/kees/c/4df33089b46f
>>>> [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by
>>>>         https://git.kernel.org/kees/c/ffd3f823bdf6
>>>> [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by
>>>>         https://git.kernel.org/kees/c/2de35a989b76
>>>> [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by
>>>>         https://git.kernel.org/kees/c/188aeb08bfaa
>>>> [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/59a54dc896c3
>>>> [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by
>>>>         https://git.kernel.org/kees/c/5cd476de33af
>>>> [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by
>>>>         https://git.kernel.org/kees/c/b426f2e5356a
>>>> [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by
>>>>         https://git.kernel.org/kees/c/dc662fa1b0e4
>>>>
>>>> Take care,
>>>>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
  2023-10-02 18:01           ` [Nouveau] " Christian König
                               ` (3 preceding siblings ...)
  (?)
@ 2023-10-02 18:08             ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:08 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> Am 02.10.23 um 18:53 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > benefit from the annotation.
> > > > > > 
> > > > > > [...]
> > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > if this should go via drm instead.
> > > > > 
> > > > > Applied to for-next/hardening, thanks!
> > > > > 
> > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > >         https://git.kernel.org/kees/c/a6046ac659d6
> > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > I'm so confused; from the discussion I saw that Alex said both instances
> > were false positives?
> > 
> > > > The value in the structure is byte swapped based on some firmware
> > > > endianness which not necessary matches the CPU endianness.
> > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > will always match.
> > Which I think is what is being said here?
> > 
> > > > Please revert that one from going upstream if it's already on it's way.
> > > > 
> > > > And because of those reasons I strongly think that patches like this
> > > > should go through the DRM tree :)
> > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > should carry these patches?
> 
> Probably best if the relevant maintainer pick them up individually.
> 
> Some of those structures are filled in by firmware/hardware and only the
> maintainers can judge if that value actually matches what the compiler
> needs.
> 
> We have cases where individual bits are used as flags or when the size is
> byte swapped etc...
> 
> Even Alex and I didn't immediately say how and where that field is actually
> used and had to dig that up. That's where the confusion came from.

Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
hopefully those can get picked up for the DRM tree?

Thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:08             ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:08 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	Chia-I Wu, linux-hardening, Alex Deucher, Lijo Lazar,
	Tvrtko Ursulin, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Yifan Zhang, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Melissa Wen, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> Am 02.10.23 um 18:53 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > benefit from the annotation.
> > > > > > 
> > > > > > [...]
> > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > if this should go via drm instead.
> > > > > 
> > > > > Applied to for-next/hardening, thanks!
> > > > > 
> > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > >         https://git.kernel.org/kees/c/a6046ac659d6
> > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > I'm so confused; from the discussion I saw that Alex said both instances
> > were false positives?
> > 
> > > > The value in the structure is byte swapped based on some firmware
> > > > endianness which not necessary matches the CPU endianness.
> > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > will always match.
> > Which I think is what is being said here?
> > 
> > > > Please revert that one from going upstream if it's already on it's way.
> > > > 
> > > > And because of those reasons I strongly think that patches like this
> > > > should go through the DRM tree :)
> > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > should carry these patches?
> 
> Probably best if the relevant maintainer pick them up individually.
> 
> Some of those structures are filled in by firmware/hardware and only the
> maintainers can judge if that value actually matches what the compiler
> needs.
> 
> We have cases where individual bits are used as flags or when the size is
> byte swapped etc...
> 
> Even Alex and I didn't immediately say how and where that field is actually
> used and had to dig that up. That's where the confusion came from.

Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
hopefully those can get picked up for the DRM tree?

Thanks!

-Kees

-- 
Kees Cook
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:08             ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:08 UTC (permalink / raw)
  To: Christian König
  Cc: Alex Deucher, David Airlie, Pan, Xinhui, Karol Herbst, Tom Rix,
	Joonas Lahtinen, dri-devel, Chris Wilson, Prike Liang, Huang Rui,
	Gerd Hoffmann, Andrzej Hajda, Marijn Suijten, Matthew Brost,
	Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh, Lijo Lazar,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Dmitry Baryshkov, Chia-I Wu, llvm, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Tvrtko Ursulin, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Rob Clark, Melissa Wen, John Harrison, Daniel Vetter,
	Alex Deucher, Nirmoy Das, freedreno, Christian König,
	Zack Rusin, linux-hardening

On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> Am 02.10.23 um 18:53 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > benefit from the annotation.
> > > > > > 
> > > > > > [...]
> > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > if this should go via drm instead.
> > > > > 
> > > > > Applied to for-next/hardening, thanks!
> > > > > 
> > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > >         https://git.kernel.org/kees/c/a6046ac659d6
> > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > I'm so confused; from the discussion I saw that Alex said both instances
> > were false positives?
> > 
> > > > The value in the structure is byte swapped based on some firmware
> > > > endianness which not necessary matches the CPU endianness.
> > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > will always match.
> > Which I think is what is being said here?
> > 
> > > > Please revert that one from going upstream if it's already on it's way.
> > > > 
> > > > And because of those reasons I strongly think that patches like this
> > > > should go through the DRM tree :)
> > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > should carry these patches?
> 
> Probably best if the relevant maintainer pick them up individually.
> 
> Some of those structures are filled in by firmware/hardware and only the
> maintainers can judge if that value actually matches what the compiler
> needs.
> 
> We have cases where individual bits are used as flags or when the size is
> byte swapped etc...
> 
> Even Alex and I didn't immediately say how and where that field is actually
> used and had to dig that up. That's where the confusion came from.

Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
hopefully those can get picked up for the DRM tree?

Thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:08             ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:08 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Melissa Wen, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> Am 02.10.23 um 18:53 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > benefit from the annotation.
> > > > > > 
> > > > > > [...]
> > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > if this should go via drm instead.
> > > > > 
> > > > > Applied to for-next/hardening, thanks!
> > > > > 
> > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > >         https://git.kernel.org/kees/c/a6046ac659d6
> > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > I'm so confused; from the discussion I saw that Alex said both instances
> > were false positives?
> > 
> > > > The value in the structure is byte swapped based on some firmware
> > > > endianness which not necessary matches the CPU endianness.
> > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > will always match.
> > Which I think is what is being said here?
> > 
> > > > Please revert that one from going upstream if it's already on it's way.
> > > > 
> > > > And because of those reasons I strongly think that patches like this
> > > > should go through the DRM tree :)
> > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > should carry these patches?
> 
> Probably best if the relevant maintainer pick them up individually.
> 
> Some of those structures are filled in by firmware/hardware and only the
> maintainers can judge if that value actually matches what the compiler
> needs.
> 
> We have cases where individual bits are used as flags or when the size is
> byte swapped etc...
> 
> Even Alex and I didn't immediately say how and where that field is actually
> used and had to dig that up. That's where the confusion came from.

Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
hopefully those can get picked up for the DRM tree?

Thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:08             ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:08 UTC (permalink / raw)
  To: Christian König
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	David Airlie, Karol Herbst, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Yifan Zhang, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Melissa Wen, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> Am 02.10.23 um 18:53 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > benefit from the annotation.
> > > > > > 
> > > > > > [...]
> > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > if this should go via drm instead.
> > > > > 
> > > > > Applied to for-next/hardening, thanks!
> > > > > 
> > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > >         https://git.kernel.org/kees/c/a6046ac659d6
> > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > I'm so confused; from the discussion I saw that Alex said both instances
> > were false positives?
> > 
> > > > The value in the structure is byte swapped based on some firmware
> > > > endianness which not necessary matches the CPU endianness.
> > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > will always match.
> > Which I think is what is being said here?
> > 
> > > > Please revert that one from going upstream if it's already on it's way.
> > > > 
> > > > And because of those reasons I strongly think that patches like this
> > > > should go through the DRM tree :)
> > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > should carry these patches?
> 
> Probably best if the relevant maintainer pick them up individually.
> 
> Some of those structures are filled in by firmware/hardware and only the
> maintainers can judge if that value actually matches what the compiler
> needs.
> 
> We have cases where individual bits are used as flags or when the size is
> byte swapped etc...
> 
> Even Alex and I didn't immediately say how and where that field is actually
> used and had to dig that up. That's where the confusion came from.

Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
hopefully those can get picked up for the DRM tree?

Thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:08             ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:08 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, Tvrtko Ursulin, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> Am 02.10.23 um 18:53 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > benefit from the annotation.
> > > > > > 
> > > > > > [...]
> > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > if this should go via drm instead.
> > > > > 
> > > > > Applied to for-next/hardening, thanks!
> > > > > 
> > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > >         https://git.kernel.org/kees/c/a6046ac659d6
> > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > I'm so confused; from the discussion I saw that Alex said both instances
> > were false positives?
> > 
> > > > The value in the structure is byte swapped based on some firmware
> > > > endianness which not necessary matches the CPU endianness.
> > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > will always match.
> > Which I think is what is being said here?
> > 
> > > > Please revert that one from going upstream if it's already on it's way.
> > > > 
> > > > And because of those reasons I strongly think that patches like this
> > > > should go through the DRM tree :)
> > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > should carry these patches?
> 
> Probably best if the relevant maintainer pick them up individually.
> 
> Some of those structures are filled in by firmware/hardware and only the
> maintainers can judge if that value actually matches what the compiler
> needs.
> 
> We have cases where individual bits are used as flags or when the size is
> byte swapped etc...
> 
> Even Alex and I didn't immediately say how and where that field is actually
> used and had to dig that up. That's where the confusion came from.

Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
hopefully those can get picked up for the DRM tree?

Thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
  2023-10-02 18:08             ` Kees Cook
                                 ` (3 preceding siblings ...)
  (?)
@ 2023-10-02 18:11               ` Christian König
  -1 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:11 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Alex Deucher, David Airlie, Pan, Xinhui, Karol Herbst, Tom Rix,
	Joonas Lahtinen, dri-devel, Chris Wilson, Prike Liang, Huang Rui,
	Gerd Hoffmann, Andrzej Hajda, Marijn Suijten, Matthew Brost,
	Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh, Lijo Lazar,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Dmitry Baryshkov, Chia-I Wu, llvm, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Tvrtko Ursulin, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Rob Clark, Melissa Wen, John Harrison, Daniel Vetter,
	Alex Deucher, Nirmoy Das, freedreno, Zack Rusin, linux-hardening

Am 02.10.23 um 20:08 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>> benefit from the annotation.
>>>>>>>
>>>>>>> [...]
>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>> if this should go via drm instead.
>>>>>>
>>>>>> Applied to for-next/hardening, thanks!
>>>>>>
>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>          https://git.kernel.org/kees/c/a6046ac659d6
>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>> I'm so confused; from the discussion I saw that Alex said both instances
>>> were false positives?
>>>
>>>>> The value in the structure is byte swapped based on some firmware
>>>>> endianness which not necessary matches the CPU endianness.
>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>> will always match.
>>> Which I think is what is being said here?
>>>
>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>
>>>>> And because of those reasons I strongly think that patches like this
>>>>> should go through the DRM tree :)
>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>> should carry these patches?
>> Probably best if the relevant maintainer pick them up individually.
>>
>> Some of those structures are filled in by firmware/hardware and only the
>> maintainers can judge if that value actually matches what the compiler
>> needs.
>>
>> We have cases where individual bits are used as flags or when the size is
>> byte swapped etc...
>>
>> Even Alex and I didn't immediately say how and where that field is actually
>> used and had to dig that up. That's where the confusion came from.
> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> hopefully those can get picked up for the DRM tree?

I will pick those up to go through drm-misc-next.

Going to ping maintainers once more when I'm not sure if stuff is 
correct or not.

Christian.

>
> Thanks!
>
> -Kees
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:11               ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:11 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	John Harrison, Hawking Zhang

Am 02.10.23 um 20:08 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>> benefit from the annotation.
>>>>>>>
>>>>>>> [...]
>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>> if this should go via drm instead.
>>>>>>
>>>>>> Applied to for-next/hardening, thanks!
>>>>>>
>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>          https://git.kernel.org/kees/c/a6046ac659d6
>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>> I'm so confused; from the discussion I saw that Alex said both instances
>>> were false positives?
>>>
>>>>> The value in the structure is byte swapped based on some firmware
>>>>> endianness which not necessary matches the CPU endianness.
>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>> will always match.
>>> Which I think is what is being said here?
>>>
>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>
>>>>> And because of those reasons I strongly think that patches like this
>>>>> should go through the DRM tree :)
>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>> should carry these patches?
>> Probably best if the relevant maintainer pick them up individually.
>>
>> Some of those structures are filled in by firmware/hardware and only the
>> maintainers can judge if that value actually matches what the compiler
>> needs.
>>
>> We have cases where individual bits are used as flags or when the size is
>> byte swapped etc...
>>
>> Even Alex and I didn't immediately say how and where that field is actually
>> used and had to dig that up. That's where the confusion came from.
> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> hopefully those can get picked up for the DRM tree?

I will pick those up to go through drm-misc-next.

Going to ping maintainers once more when I'm not sure if stuff is 
correct or not.

Christian.

>
> Thanks!
>
> -Kees
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:11               ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König via Virtualization @ 2023-10-02 18:11 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	Chia-I Wu, linux-hardening, Alex Deucher, Lijo Lazar,
	Tvrtko Ursulin, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Yifan Zhang, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Melissa Wen, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, John Harrison, Hawking Zhang

Am 02.10.23 um 20:08 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>> benefit from the annotation.
>>>>>>>
>>>>>>> [...]
>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>> if this should go via drm instead.
>>>>>>
>>>>>> Applied to for-next/hardening, thanks!
>>>>>>
>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>          https://git.kernel.org/kees/c/a6046ac659d6
>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>> I'm so confused; from the discussion I saw that Alex said both instances
>>> were false positives?
>>>
>>>>> The value in the structure is byte swapped based on some firmware
>>>>> endianness which not necessary matches the CPU endianness.
>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>> will always match.
>>> Which I think is what is being said here?
>>>
>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>
>>>>> And because of those reasons I strongly think that patches like this
>>>>> should go through the DRM tree :)
>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>> should carry these patches?
>> Probably best if the relevant maintainer pick them up individually.
>>
>> Some of those structures are filled in by firmware/hardware and only the
>> maintainers can judge if that value actually matches what the compiler
>> needs.
>>
>> We have cases where individual bits are used as flags or when the size is
>> byte swapped etc...
>>
>> Even Alex and I didn't immediately say how and where that field is actually
>> used and had to dig that up. That's where the confusion came from.
> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> hopefully those can get picked up for the DRM tree?

I will pick those up to go through drm-misc-next.

Going to ping maintainers once more when I'm not sure if stuff is 
correct or not.

Christian.

>
> Thanks!
>
> -Kees
>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:11               ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:11 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Melissa Wen, Nirmoy Das, Lang Yu,
	John Harrison, Hawking Zhang

Am 02.10.23 um 20:08 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>> benefit from the annotation.
>>>>>>>
>>>>>>> [...]
>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>> if this should go via drm instead.
>>>>>>
>>>>>> Applied to for-next/hardening, thanks!
>>>>>>
>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>          https://git.kernel.org/kees/c/a6046ac659d6
>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>> I'm so confused; from the discussion I saw that Alex said both instances
>>> were false positives?
>>>
>>>>> The value in the structure is byte swapped based on some firmware
>>>>> endianness which not necessary matches the CPU endianness.
>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>> will always match.
>>> Which I think is what is being said here?
>>>
>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>
>>>>> And because of those reasons I strongly think that patches like this
>>>>> should go through the DRM tree :)
>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>> should carry these patches?
>> Probably best if the relevant maintainer pick them up individually.
>>
>> Some of those structures are filled in by firmware/hardware and only the
>> maintainers can judge if that value actually matches what the compiler
>> needs.
>>
>> We have cases where individual bits are used as flags or when the size is
>> byte swapped etc...
>>
>> Even Alex and I didn't immediately say how and where that field is actually
>> used and had to dig that up. That's where the confusion came from.
> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> hopefully those can get picked up for the DRM tree?

I will pick those up to go through drm-misc-next.

Going to ping maintainers once more when I'm not sure if stuff is 
correct or not.

Christian.

>
> Thanks!
>
> -Kees
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:11               ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:11 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	David Airlie, Karol Herbst, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Yifan Zhang, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Melissa Wen, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu, Hawking Zhang

Am 02.10.23 um 20:08 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>> benefit from the annotation.
>>>>>>>
>>>>>>> [...]
>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>> if this should go via drm instead.
>>>>>>
>>>>>> Applied to for-next/hardening, thanks!
>>>>>>
>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>          https://git.kernel.org/kees/c/a6046ac659d6
>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>> I'm so confused; from the discussion I saw that Alex said both instances
>>> were false positives?
>>>
>>>>> The value in the structure is byte swapped based on some firmware
>>>>> endianness which not necessary matches the CPU endianness.
>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>> will always match.
>>> Which I think is what is being said here?
>>>
>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>
>>>>> And because of those reasons I strongly think that patches like this
>>>>> should go through the DRM tree :)
>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>> should carry these patches?
>> Probably best if the relevant maintainer pick them up individually.
>>
>> Some of those structures are filled in by firmware/hardware and only the
>> maintainers can judge if that value actually matches what the compiler
>> needs.
>>
>> We have cases where individual bits are used as flags or when the size is
>> byte swapped etc...
>>
>> Even Alex and I didn't immediately say how and where that field is actually
>> used and had to dig that up. That's where the confusion came from.
> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> hopefully those can get picked up for the DRM tree?

I will pick those up to go through drm-misc-next.

Going to ping maintainers once more when I'm not sure if stuff is 
correct or not.

Christian.

>
> Thanks!
>
> -Kees
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:11               ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-02 18:11 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, Tvrtko Ursulin, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	John Harrison, Hawking Zhang

Am 02.10.23 um 20:08 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>> benefit from the annotation.
>>>>>>>
>>>>>>> [...]
>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>> if this should go via drm instead.
>>>>>>
>>>>>> Applied to for-next/hardening, thanks!
>>>>>>
>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>          https://git.kernel.org/kees/c/a6046ac659d6
>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>> I'm so confused; from the discussion I saw that Alex said both instances
>>> were false positives?
>>>
>>>>> The value in the structure is byte swapped based on some firmware
>>>>> endianness which not necessary matches the CPU endianness.
>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>> will always match.
>>> Which I think is what is being said here?
>>>
>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>
>>>>> And because of those reasons I strongly think that patches like this
>>>>> should go through the DRM tree :)
>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>> should carry these patches?
>> Probably best if the relevant maintainer pick them up individually.
>>
>> Some of those structures are filled in by firmware/hardware and only the
>> maintainers can judge if that value actually matches what the compiler
>> needs.
>>
>> We have cases where individual bits are used as flags or when the size is
>> byte swapped etc...
>>
>> Even Alex and I didn't immediately say how and where that field is actually
>> used and had to dig that up. That's where the confusion came from.
> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> hopefully those can get picked up for the DRM tree?

I will pick those up to go through drm-misc-next.

Going to ping maintainers once more when I'm not sure if stuff is 
correct or not.

Christian.

>
> Thanks!
>
> -Kees
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
  2023-10-02 18:11               ` [Nouveau] " Christian König
                                   ` (3 preceding siblings ...)
  (?)
@ 2023-10-02 18:22                 ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:22 UTC (permalink / raw)
  To: Christian König
  Cc: Christian König, Alex Deucher, David Airlie, Pan, Xinhui,
	Karol Herbst, Tom Rix, Joonas Lahtinen, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Evan Quan, Emma Anholt, amd-gfx,
	Kuogee Hsieh, Lijo Lazar, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, Dmitry Baryshkov, Chia-I Wu,
	llvm, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	virtualization, Sean Paul, Neil Armstrong, Xiaojian Du, Lang Yu,
	Bjorn Andersson, Tejas Upadhyay, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Rob Clark, Melissa Wen, John Harrison,
	Daniel Vetter, Alex Deucher, Nirmoy Das, freedreno, Zack Rusin,
	linux-hardening

On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> Am 02.10.23 um 20:08 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > benefit from the annotation.
> > > > > > > > 
> > > > > > > > [...]
> > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > if this should go via drm instead.
> > > > > > > 
> > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > 
> > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > >          https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > were false positives?
> > > > 
> > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > endianness which not necessary matches the CPU endianness.
> > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > will always match.
> > > > Which I think is what is being said here?
> > > > 
> > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > 
> > > > > > And because of those reasons I strongly think that patches like this
> > > > > > should go through the DRM tree :)
> > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > should carry these patches?
> > > Probably best if the relevant maintainer pick them up individually.
> > > 
> > > Some of those structures are filled in by firmware/hardware and only the
> > > maintainers can judge if that value actually matches what the compiler
> > > needs.
> > > 
> > > We have cases where individual bits are used as flags or when the size is
> > > byte swapped etc...
> > > 
> > > Even Alex and I didn't immediately say how and where that field is actually
> > > used and had to dig that up. That's where the confusion came from.
> > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > hopefully those can get picked up for the DRM tree?
> 
> I will pick those up to go through drm-misc-next.
> 
> Going to ping maintainers once more when I'm not sure if stuff is correct or
> not.

Sounds great; thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:22                 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:22 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, linux-arm-msm,
	Joonas Lahtinen, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	Matthew Brost, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, Tvrtko Ursulin, Christian König,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> Am 02.10.23 um 20:08 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > benefit from the annotation.
> > > > > > > > 
> > > > > > > > [...]
> > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > if this should go via drm instead.
> > > > > > > 
> > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > 
> > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > >          https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > were false positives?
> > > > 
> > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > endianness which not necessary matches the CPU endianness.
> > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > will always match.
> > > > Which I think is what is being said here?
> > > > 
> > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > 
> > > > > > And because of those reasons I strongly think that patches like this
> > > > > > should go through the DRM tree :)
> > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > should carry these patches?
> > > Probably best if the relevant maintainer pick them up individually.
> > > 
> > > Some of those structures are filled in by firmware/hardware and only the
> > > maintainers can judge if that value actually matches what the compiler
> > > needs.
> > > 
> > > We have cases where individual bits are used as flags or when the size is
> > > byte swapped etc...
> > > 
> > > Even Alex and I didn't immediately say how and where that field is actually
> > > used and had to dig that up. That's where the confusion came from.
> > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > hopefully those can get picked up for the DRM tree?
> 
> I will pick those up to go through drm-misc-next.
> 
> Going to ping maintainers once more when I'm not sure if stuff is correct or
> not.

Sounds great; thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:22                 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:22 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, linux-arm-msm,
	Joonas Lahtinen, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Andrzej Hajda, Marijn Suijten, David Airlie,
	Matthew Brost, Karol Herbst, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, Andi Shyti,
	nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	Christian König, intel-gfx, Kevin Wang, Abhinav Kumar,
	Jani Nikula, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Yifan Zhang, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Melissa Wen, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> Am 02.10.23 um 20:08 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > benefit from the annotation.
> > > > > > > > 
> > > > > > > > [...]
> > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > if this should go via drm instead.
> > > > > > > 
> > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > 
> > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > >          https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > were false positives?
> > > > 
> > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > endianness which not necessary matches the CPU endianness.
> > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > will always match.
> > > > Which I think is what is being said here?
> > > > 
> > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > 
> > > > > > And because of those reasons I strongly think that patches like this
> > > > > > should go through the DRM tree :)
> > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > should carry these patches?
> > > Probably best if the relevant maintainer pick them up individually.
> > > 
> > > Some of those structures are filled in by firmware/hardware and only the
> > > maintainers can judge if that value actually matches what the compiler
> > > needs.
> > > 
> > > We have cases where individual bits are used as flags or when the size is
> > > byte swapped etc...
> > > 
> > > Even Alex and I didn't immediately say how and where that field is actually
> > > used and had to dig that up. That's where the confusion came from.
> > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > hopefully those can get picked up for the DRM tree?
> 
> I will pick those up to go through drm-misc-next.
> 
> Going to ping maintainers once more when I'm not sure if stuff is correct or
> not.

Sounds great; thanks!

-Kees

-- 
Kees Cook
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:22                 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:22 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, linux-arm-msm, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	Christian König, intel-gfx, Kevin Wang, Abhinav Kumar,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Melissa Wen, Nirmoy Das, Lang Yu,
	John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> Am 02.10.23 um 20:08 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > benefit from the annotation.
> > > > > > > > 
> > > > > > > > [...]
> > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > if this should go via drm instead.
> > > > > > > 
> > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > 
> > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > >          https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > were false positives?
> > > > 
> > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > endianness which not necessary matches the CPU endianness.
> > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > will always match.
> > > > Which I think is what is being said here?
> > > > 
> > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > 
> > > > > > And because of those reasons I strongly think that patches like this
> > > > > > should go through the DRM tree :)
> > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > should carry these patches?
> > > Probably best if the relevant maintainer pick them up individually.
> > > 
> > > Some of those structures are filled in by firmware/hardware and only the
> > > maintainers can judge if that value actually matches what the compiler
> > > needs.
> > > 
> > > We have cases where individual bits are used as flags or when the size is
> > > byte swapped etc...
> > > 
> > > Even Alex and I didn't immediately say how and where that field is actually
> > > used and had to dig that up. That's where the confusion came from.
> > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > hopefully those can get picked up for the DRM tree?
> 
> I will pick those up to go through drm-misc-next.
> 
> Going to ping maintainers once more when I'm not sure if stuff is correct or
> not.

Sounds great; thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:22                 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:22 UTC (permalink / raw)
  To: Christian König
  Cc: Emma Anholt, Tom Rix, linux-arm-msm, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Christian König,
	intel-gfx, Kevin Wang, Abhinav Kumar, Nathan Chancellor,
	Dmitry Baryshkov, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	Evan Quan, Yifan Zhang, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Melissa Wen, Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das,
	Lang Yu, Hawking Zhang

On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> Am 02.10.23 um 20:08 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > benefit from the annotation.
> > > > > > > > 
> > > > > > > > [...]
> > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > if this should go via drm instead.
> > > > > > > 
> > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > 
> > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > >          https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > were false positives?
> > > > 
> > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > endianness which not necessary matches the CPU endianness.
> > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > will always match.
> > > > Which I think is what is being said here?
> > > > 
> > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > 
> > > > > > And because of those reasons I strongly think that patches like this
> > > > > > should go through the DRM tree :)
> > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > should carry these patches?
> > > Probably best if the relevant maintainer pick them up individually.
> > > 
> > > Some of those structures are filled in by firmware/hardware and only the
> > > maintainers can judge if that value actually matches what the compiler
> > > needs.
> > > 
> > > We have cases where individual bits are used as flags or when the size is
> > > byte swapped etc...
> > > 
> > > Even Alex and I didn't immediately say how and where that field is actually
> > > used and had to dig that up. That's where the confusion came from.
> > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > hopefully those can get picked up for the DRM tree?
> 
> I will pick those up to go through drm-misc-next.
> 
> Going to ping maintainers once more when I'm not sure if stuff is correct or
> not.

Sounds great; thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-02 18:22                 ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-02 18:22 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, linux-arm-msm,
	Joonas Lahtinen, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	David Airlie, Matthew Brost, Karol Herbst, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	Christian König, intel-gfx, Kevin Wang, Abhinav Kumar,
	Jani Nikula, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Yifan Zhang, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Melissa Wen, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, John Harrison, Hawking Zhang

On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> Am 02.10.23 um 20:08 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > benefit from the annotation.
> > > > > > > > 
> > > > > > > > [...]
> > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > if this should go via drm instead.
> > > > > > > 
> > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > 
> > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > >          https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > were false positives?
> > > > 
> > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > endianness which not necessary matches the CPU endianness.
> > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > will always match.
> > > > Which I think is what is being said here?
> > > > 
> > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > 
> > > > > > And because of those reasons I strongly think that patches like this
> > > > > > should go through the DRM tree :)
> > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > should carry these patches?
> > > Probably best if the relevant maintainer pick them up individually.
> > > 
> > > Some of those structures are filled in by firmware/hardware and only the
> > > maintainers can judge if that value actually matches what the compiler
> > > needs.
> > > 
> > > We have cases where individual bits are used as flags or when the size is
> > > byte swapped etc...
> > > 
> > > Even Alex and I didn't immediately say how and where that field is actually
> > > used and had to dig that up. That's where the confusion came from.
> > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > hopefully those can get picked up for the DRM tree?
> 
> I will pick those up to go through drm-misc-next.
> 
> Going to ping maintainers once more when I'm not sure if stuff is correct or
> not.

Sounds great; thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
  2023-10-02 18:22                 ` [Nouveau] " Kees Cook
                                     ` (3 preceding siblings ...)
  (?)
@ 2023-10-05  9:42                   ` Christian König
  -1 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-05  9:42 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	David Airlie, Karol Herbst, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Yifan Zhang, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Melissa Wen, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu, Hawking Zhang

Am 02.10.23 um 20:22 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
>> Am 02.10.23 um 20:08 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>>>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>>>> benefit from the annotation.
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>>>> if this should go via drm instead.
>>>>>>>>
>>>>>>>> Applied to for-next/hardening, thanks!
>>>>>>>>
>>>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>>>           https://git.kernel.org/kees/c/a6046ac659d6
>>>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>>>> I'm so confused; from the discussion I saw that Alex said both instances
>>>>> were false positives?
>>>>>
>>>>>>> The value in the structure is byte swapped based on some firmware
>>>>>>> endianness which not necessary matches the CPU endianness.
>>>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>>>> will always match.
>>>>> Which I think is what is being said here?
>>>>>
>>>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>>>
>>>>>>> And because of those reasons I strongly think that patches like this
>>>>>>> should go through the DRM tree :)
>>>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>>>> should carry these patches?
>>>> Probably best if the relevant maintainer pick them up individually.
>>>>
>>>> Some of those structures are filled in by firmware/hardware and only the
>>>> maintainers can judge if that value actually matches what the compiler
>>>> needs.
>>>>
>>>> We have cases where individual bits are used as flags or when the size is
>>>> byte swapped etc...
>>>>
>>>> Even Alex and I didn't immediately say how and where that field is actually
>>>> used and had to dig that up. That's where the confusion came from.
>>> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
>>> hopefully those can get picked up for the DRM tree?
>> I will pick those up to go through drm-misc-next.
>>
>> Going to ping maintainers once more when I'm not sure if stuff is correct or
>> not.
> Sounds great; thanks!

I wasn't 100% sure for the VC4 patch, but pushed the whole set to 
drm-misc-next anyway.

This also means that the patches are now auto merged into the drm-tip 
integration branch and should any build or unit test go boom we should 
notice immediately and can revert it pretty easily.

Thanks,
Christian.

>
> -Kees
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-05  9:42                   ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-05  9:42 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Alex Deucher, David Airlie, Pan, Xinhui, Karol Herbst, Tom Rix,
	Joonas Lahtinen, dri-devel, Chris Wilson, Prike Liang, Huang Rui,
	Gerd Hoffmann, Andrzej Hajda, Marijn Suijten, Matthew Brost,
	Evan Quan, Emma Anholt, amd-gfx, Kuogee Hsieh, Lijo Lazar,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, Dmitry Baryshkov, Chia-I Wu, llvm, Yifan Zhang,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Tvrtko Ursulin, Nathan Chancellor, Le Ma, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, virtualization, Sean Paul,
	Neil Armstrong, Xiaojian Du, Lang Yu, Bjorn Andersson,
	Tejas Upadhyay, Nick Desaulniers, linux-kernel, Hawking Zhang,
	Rob Clark, Melissa Wen, John Harrison, Daniel Vetter,
	Alex Deucher, Nirmoy Das, freedreno, Zack Rusin, linux-hardening

Am 02.10.23 um 20:22 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
>> Am 02.10.23 um 20:08 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>>>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>>>> benefit from the annotation.
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>>>> if this should go via drm instead.
>>>>>>>>
>>>>>>>> Applied to for-next/hardening, thanks!
>>>>>>>>
>>>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>>>           https://git.kernel.org/kees/c/a6046ac659d6
>>>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>>>> I'm so confused; from the discussion I saw that Alex said both instances
>>>>> were false positives?
>>>>>
>>>>>>> The value in the structure is byte swapped based on some firmware
>>>>>>> endianness which not necessary matches the CPU endianness.
>>>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>>>> will always match.
>>>>> Which I think is what is being said here?
>>>>>
>>>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>>>
>>>>>>> And because of those reasons I strongly think that patches like this
>>>>>>> should go through the DRM tree :)
>>>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>>>> should carry these patches?
>>>> Probably best if the relevant maintainer pick them up individually.
>>>>
>>>> Some of those structures are filled in by firmware/hardware and only the
>>>> maintainers can judge if that value actually matches what the compiler
>>>> needs.
>>>>
>>>> We have cases where individual bits are used as flags or when the size is
>>>> byte swapped etc...
>>>>
>>>> Even Alex and I didn't immediately say how and where that field is actually
>>>> used and had to dig that up. That's where the confusion came from.
>>> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
>>> hopefully those can get picked up for the DRM tree?
>> I will pick those up to go through drm-misc-next.
>>
>> Going to ping maintainers once more when I'm not sure if stuff is correct or
>> not.
> Sounds great; thanks!

I wasn't 100% sure for the VC4 patch, but pushed the whole set to 
drm-misc-next anyway.

This also means that the patches are now auto merged into the drm-tip 
integration branch and should any build or unit test go boom we should 
notice immediately and can revert it pretty easily.

Thanks,
Christian.

>
> -Kees
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-05  9:42                   ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-05  9:42 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	John Harrison, Hawking Zhang

Am 02.10.23 um 20:22 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
>> Am 02.10.23 um 20:08 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>>>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>>>> benefit from the annotation.
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>>>> if this should go via drm instead.
>>>>>>>>
>>>>>>>> Applied to for-next/hardening, thanks!
>>>>>>>>
>>>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>>>           https://git.kernel.org/kees/c/a6046ac659d6
>>>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>>>> I'm so confused; from the discussion I saw that Alex said both instances
>>>>> were false positives?
>>>>>
>>>>>>> The value in the structure is byte swapped based on some firmware
>>>>>>> endianness which not necessary matches the CPU endianness.
>>>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>>>> will always match.
>>>>> Which I think is what is being said here?
>>>>>
>>>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>>>
>>>>>>> And because of those reasons I strongly think that patches like this
>>>>>>> should go through the DRM tree :)
>>>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>>>> should carry these patches?
>>>> Probably best if the relevant maintainer pick them up individually.
>>>>
>>>> Some of those structures are filled in by firmware/hardware and only the
>>>> maintainers can judge if that value actually matches what the compiler
>>>> needs.
>>>>
>>>> We have cases where individual bits are used as flags or when the size is
>>>> byte swapped etc...
>>>>
>>>> Even Alex and I didn't immediately say how and where that field is actually
>>>> used and had to dig that up. That's where the confusion came from.
>>> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
>>> hopefully those can get picked up for the DRM tree?
>> I will pick those up to go through drm-misc-next.
>>
>> Going to ping maintainers once more when I'm not sure if stuff is correct or
>> not.
> Sounds great; thanks!

I wasn't 100% sure for the VC4 patch, but pushed the whole set to 
drm-misc-next anyway.

This also means that the patches are now auto merged into the drm-tip 
integration branch and should any build or unit test go boom we should 
notice immediately and can revert it pretty easily.

Thanks,
Christian.

>
> -Kees
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-05  9:42                   ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-05  9:42 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	Chia-I Wu, linux-hardening, Alex Deucher, Lijo Lazar,
	Tvrtko Ursulin, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Yifan Zhang, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Melissa Wen, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, John Harrison, Hawking Zhang

Am 02.10.23 um 20:22 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
>> Am 02.10.23 um 20:08 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>>>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>>>> benefit from the annotation.
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>>>> if this should go via drm instead.
>>>>>>>>
>>>>>>>> Applied to for-next/hardening, thanks!
>>>>>>>>
>>>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>>>           https://git.kernel.org/kees/c/a6046ac659d6
>>>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>>>> I'm so confused; from the discussion I saw that Alex said both instances
>>>>> were false positives?
>>>>>
>>>>>>> The value in the structure is byte swapped based on some firmware
>>>>>>> endianness which not necessary matches the CPU endianness.
>>>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>>>> will always match.
>>>>> Which I think is what is being said here?
>>>>>
>>>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>>>
>>>>>>> And because of those reasons I strongly think that patches like this
>>>>>>> should go through the DRM tree :)
>>>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>>>> should carry these patches?
>>>> Probably best if the relevant maintainer pick them up individually.
>>>>
>>>> Some of those structures are filled in by firmware/hardware and only the
>>>> maintainers can judge if that value actually matches what the compiler
>>>> needs.
>>>>
>>>> We have cases where individual bits are used as flags or when the size is
>>>> byte swapped etc...
>>>>
>>>> Even Alex and I didn't immediately say how and where that field is actually
>>>> used and had to dig that up. That's where the confusion came from.
>>> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
>>> hopefully those can get picked up for the DRM tree?
>> I will pick those up to go through drm-misc-next.
>>
>> Going to ping maintainers once more when I'm not sure if stuff is correct or
>> not.
> Sounds great; thanks!

I wasn't 100% sure for the VC4 patch, but pushed the whole set to 
drm-misc-next anyway.

This also means that the patches are now auto merged into the drm-tip 
integration branch and should any build or unit test go boom we should 
notice immediately and can revert it pretty easily.

Thanks,
Christian.

>
> -Kees
>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-05  9:42                   ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-05  9:42 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Melissa Wen, Nirmoy Das, Lang Yu,
	John Harrison, Hawking Zhang

Am 02.10.23 um 20:22 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
>> Am 02.10.23 um 20:08 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>>>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>>>> benefit from the annotation.
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>>>> if this should go via drm instead.
>>>>>>>>
>>>>>>>> Applied to for-next/hardening, thanks!
>>>>>>>>
>>>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>>>           https://git.kernel.org/kees/c/a6046ac659d6
>>>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>>>> I'm so confused; from the discussion I saw that Alex said both instances
>>>>> were false positives?
>>>>>
>>>>>>> The value in the structure is byte swapped based on some firmware
>>>>>>> endianness which not necessary matches the CPU endianness.
>>>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>>>> will always match.
>>>>> Which I think is what is being said here?
>>>>>
>>>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>>>
>>>>>>> And because of those reasons I strongly think that patches like this
>>>>>>> should go through the DRM tree :)
>>>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>>>> should carry these patches?
>>>> Probably best if the relevant maintainer pick them up individually.
>>>>
>>>> Some of those structures are filled in by firmware/hardware and only the
>>>> maintainers can judge if that value actually matches what the compiler
>>>> needs.
>>>>
>>>> We have cases where individual bits are used as flags or when the size is
>>>> byte swapped etc...
>>>>
>>>> Even Alex and I didn't immediately say how and where that field is actually
>>>> used and had to dig that up. That's where the confusion came from.
>>> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
>>> hopefully those can get picked up for the DRM tree?
>> I will pick those up to go through drm-misc-next.
>>
>> Going to ping maintainers once more when I'm not sure if stuff is correct or
>> not.
> Sounds great; thanks!

I wasn't 100% sure for the VC4 patch, but pushed the whole set to 
drm-misc-next anyway.

This also means that the patches are now auto merged into the drm-tip 
integration branch and should any build or unit test go boom we should 
notice immediately and can revert it pretty easily.

Thanks,
Christian.

>
> -Kees
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-05  9:42                   ` Christian König
  0 siblings, 0 replies; 243+ messages in thread
From: Christian König @ 2023-10-05  9:42 UTC (permalink / raw)
  To: Kees Cook, Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, Tvrtko Ursulin, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	John Harrison, Hawking Zhang

Am 02.10.23 um 20:22 schrieb Kees Cook:
> On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
>> Am 02.10.23 um 20:08 schrieb Kees Cook:
>>> On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
>>>> Am 02.10.23 um 18:53 schrieb Kees Cook:
>>>>> On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
>>>>>> On Mon, Oct 2, 2023 at 5:20 AM Christian König
>>>>>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>>>>>> Am 29.09.23 um 21:33 schrieb Kees Cook:
>>>>>>>> On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
>>>>>>>>> This is a batch of patches touching drm for preparing 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 to structs that would
>>>>>>>>> benefit from the annotation.
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>> Since this got Acks, I figure I should carry it in my tree. Let me know
>>>>>>>> if this should go via drm instead.
>>>>>>>>
>>>>>>>> Applied to for-next/hardening, thanks!
>>>>>>>>
>>>>>>>> [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
>>>>>>>>           https://git.kernel.org/kees/c/a6046ac659d6
>>>>>>> STOP! In a follow up discussion Alex and I figured out that this won't work.
>>>>> I'm so confused; from the discussion I saw that Alex said both instances
>>>>> were false positives?
>>>>>
>>>>>>> The value in the structure is byte swapped based on some firmware
>>>>>>> endianness which not necessary matches the CPU endianness.
>>>>>> SMU10 is APU only so the endianess of the SMU firmware and the CPU
>>>>>> will always match.
>>>>> Which I think is what is being said here?
>>>>>
>>>>>>> Please revert that one from going upstream if it's already on it's way.
>>>>>>>
>>>>>>> And because of those reasons I strongly think that patches like this
>>>>>>> should go through the DRM tree :)
>>>>> Sure, that's fine -- please let me know. It was others Acked/etc. Who
>>>>> should carry these patches?
>>>> Probably best if the relevant maintainer pick them up individually.
>>>>
>>>> Some of those structures are filled in by firmware/hardware and only the
>>>> maintainers can judge if that value actually matches what the compiler
>>>> needs.
>>>>
>>>> We have cases where individual bits are used as flags or when the size is
>>>> byte swapped etc...
>>>>
>>>> Even Alex and I didn't immediately say how and where that field is actually
>>>> used and had to dig that up. That's where the confusion came from.
>>> Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
>>> hopefully those can get picked up for the DRM tree?
>> I will pick those up to go through drm-misc-next.
>>
>> Going to ping maintainers once more when I'm not sure if stuff is correct or
>> not.
> Sounds great; thanks!

I wasn't 100% sure for the VC4 patch, but pushed the whole set to 
drm-misc-next anyway.

This also means that the patches are now auto merged into the drm-tip 
integration branch and should any build or unit test go boom we should 
notice immediately and can revert it pretty easily.

Thanks,
Christian.

>
> -Kees
>


^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
  2023-10-05  9:42                   ` Christian König
                                       ` (3 preceding siblings ...)
  (?)
@ 2023-10-05 16:16                     ` Kees Cook
  -1 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-05 16:16 UTC (permalink / raw)
  To: Christian König
  Cc: Christian König, Alex Deucher, David Airlie, Pan, Xinhui,
	Karol Herbst, Tom Rix, Joonas Lahtinen, dri-devel, Chris Wilson,
	Prike Liang, Huang Rui, Gerd Hoffmann, Andrzej Hajda,
	Marijn Suijten, Matthew Brost, Evan Quan, Emma Anholt, amd-gfx,
	Kuogee Hsieh, Lijo Lazar, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, Dmitry Baryshkov, Chia-I Wu,
	llvm, Yifan Zhang, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Tvrtko Ursulin, Nathan Chancellor,
	Le Ma, Gurchetan Singh, Maxime Ripard, Rodrigo Vivi,
	virtualization, Sean Paul, Neil Armstrong, Xiaojian Du, Lang Yu,
	Bjorn Andersson, Tejas Upadhyay, Nick Desaulniers, linux-kernel,
	Hawking Zhang, Rob Clark, Melissa Wen, John Harrison,
	Daniel Vetter, Alex Deucher, Nirmoy Das, freedreno, Zack Rusin,
	linux-hardening

On Thu, Oct 05, 2023 at 11:42:38AM +0200, Christian König wrote:
> Am 02.10.23 um 20:22 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> > > Am 02.10.23 um 20:08 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > > > benefit from the annotation.
> > > > > > > > > > 
> > > > > > > > > > [...]
> > > > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > > > if this should go via drm instead.
> > > > > > > > > 
> > > > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > > > 
> > > > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > > > >           https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > > > were false positives?
> > > > > > 
> > > > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > > > endianness which not necessary matches the CPU endianness.
> > > > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > > > will always match.
> > > > > > Which I think is what is being said here?
> > > > > > 
> > > > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > > > 
> > > > > > > > And because of those reasons I strongly think that patches like this
> > > > > > > > should go through the DRM tree :)
> > > > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > > > should carry these patches?
> > > > > Probably best if the relevant maintainer pick them up individually.
> > > > > 
> > > > > Some of those structures are filled in by firmware/hardware and only the
> > > > > maintainers can judge if that value actually matches what the compiler
> > > > > needs.
> > > > > 
> > > > > We have cases where individual bits are used as flags or when the size is
> > > > > byte swapped etc...
> > > > > 
> > > > > Even Alex and I didn't immediately say how and where that field is actually
> > > > > used and had to dig that up. That's where the confusion came from.
> > > > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > > > hopefully those can get picked up for the DRM tree?
> > > I will pick those up to go through drm-misc-next.
> > > 
> > > Going to ping maintainers once more when I'm not sure if stuff is correct or
> > > not.
> > Sounds great; thanks!
> 
> I wasn't 100% sure for the VC4 patch, but pushed the whole set to
> drm-misc-next anyway.
> 
> This also means that the patches are now auto merged into the drm-tip
> integration branch and should any build or unit test go boom we should
> notice immediately and can revert it pretty easily.

Thanks very much; I'll keep an eye out for any reports.

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Nouveau] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-05 16:16                     ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-05 16:16 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Neil Armstrong,
	amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs,
	Andi Shyti, nouveau, David Airlie, virtualization, Chia-I Wu,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Thu, Oct 05, 2023 at 11:42:38AM +0200, Christian König wrote:
> Am 02.10.23 um 20:22 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> > > Am 02.10.23 um 20:08 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > > > benefit from the annotation.
> > > > > > > > > > 
> > > > > > > > > > [...]
> > > > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > > > if this should go via drm instead.
> > > > > > > > > 
> > > > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > > > 
> > > > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > > > >           https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > > > were false positives?
> > > > > > 
> > > > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > > > endianness which not necessary matches the CPU endianness.
> > > > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > > > will always match.
> > > > > > Which I think is what is being said here?
> > > > > > 
> > > > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > > > 
> > > > > > > > And because of those reasons I strongly think that patches like this
> > > > > > > > should go through the DRM tree :)
> > > > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > > > should carry these patches?
> > > > > Probably best if the relevant maintainer pick them up individually.
> > > > > 
> > > > > Some of those structures are filled in by firmware/hardware and only the
> > > > > maintainers can judge if that value actually matches what the compiler
> > > > > needs.
> > > > > 
> > > > > We have cases where individual bits are used as flags or when the size is
> > > > > byte swapped etc...
> > > > > 
> > > > > Even Alex and I didn't immediately say how and where that field is actually
> > > > > used and had to dig that up. That's where the confusion came from.
> > > > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > > > hopefully those can get picked up for the DRM tree?
> > > I will pick those up to go through drm-misc-next.
> > > 
> > > Going to ping maintainers once more when I'm not sure if stuff is correct or
> > > not.
> > Sounds great; thanks!
> 
> I wasn't 100% sure for the VC4 patch, but pushed the whole set to
> drm-misc-next anyway.
> 
> This also means that the patches are now auto merged into the drm-tip
> integration branch and should any build or unit test go boom we should
> notice immediately and can revert it pretty easily.

Thanks very much; I'll keep an eye out for any reports.

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-05 16:16                     ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-05 16:16 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Andrzej Hajda,
	Marijn Suijten, David Airlie, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	Chia-I Wu, linux-hardening, Alex Deucher, Lijo Lazar,
	Tvrtko Ursulin, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Jani Nikula, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Sean Paul, Yifan Zhang, Xiaojian Du, Le Ma, freedreno,
	Bjorn Andersson, Pan, Xinhui, Nick Desaulniers, linux-kernel,
	Rob Clark, Melissa Wen, Zack Rusin, Daniel Vetter, Alex Deucher,
	Nirmoy Das, Lang Yu, Christian König, John Harrison,
	Hawking Zhang

On Thu, Oct 05, 2023 at 11:42:38AM +0200, Christian König wrote:
> Am 02.10.23 um 20:22 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> > > Am 02.10.23 um 20:08 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > > > benefit from the annotation.
> > > > > > > > > > 
> > > > > > > > > > [...]
> > > > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > > > if this should go via drm instead.
> > > > > > > > > 
> > > > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > > > 
> > > > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > > > >           https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > > > were false positives?
> > > > > > 
> > > > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > > > endianness which not necessary matches the CPU endianness.
> > > > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > > > will always match.
> > > > > > Which I think is what is being said here?
> > > > > > 
> > > > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > > > 
> > > > > > > > And because of those reasons I strongly think that patches like this
> > > > > > > > should go through the DRM tree :)
> > > > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > > > should carry these patches?
> > > > > Probably best if the relevant maintainer pick them up individually.
> > > > > 
> > > > > Some of those structures are filled in by firmware/hardware and only the
> > > > > maintainers can judge if that value actually matches what the compiler
> > > > > needs.
> > > > > 
> > > > > We have cases where individual bits are used as flags or when the size is
> > > > > byte swapped etc...
> > > > > 
> > > > > Even Alex and I didn't immediately say how and where that field is actually
> > > > > used and had to dig that up. That's where the confusion came from.
> > > > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > > > hopefully those can get picked up for the DRM tree?
> > > I will pick those up to go through drm-misc-next.
> > > 
> > > Going to ping maintainers once more when I'm not sure if stuff is correct or
> > > not.
> > Sounds great; thanks!
> 
> I wasn't 100% sure for the VC4 patch, but pushed the whole set to
> drm-misc-next anyway.
> 
> This also means that the patches are now auto merged into the drm-tip
> integration branch and should any build or unit test go boom we should
> notice immediately and can revert it pretty easily.

Thanks very much; I'll keep an eye out for any reports.

-- 
Kees Cook
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-05 16:16                     ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-05 16:16 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, llvm, dri-devel,
	Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, Matthew Brost, Karol Herbst,
	Neil Armstrong, amd-gfx, Kuogee Hsieh, VMware Graphics Reviewers,
	Ben Skeggs, Andi Shyti, nouveau, David Airlie, virtualization,
	linux-hardening, Alex Deucher, Lijo Lazar, Tvrtko Ursulin,
	linux-arm-msm, intel-gfx, Kevin Wang, Abhinav Kumar,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Melissa Wen, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Thu, Oct 05, 2023 at 11:42:38AM +0200, Christian König wrote:
> Am 02.10.23 um 20:22 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> > > Am 02.10.23 um 20:08 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > > > benefit from the annotation.
> > > > > > > > > > 
> > > > > > > > > > [...]
> > > > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > > > if this should go via drm instead.
> > > > > > > > > 
> > > > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > > > 
> > > > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > > > >           https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > > > were false positives?
> > > > > > 
> > > > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > > > endianness which not necessary matches the CPU endianness.
> > > > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > > > will always match.
> > > > > > Which I think is what is being said here?
> > > > > > 
> > > > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > > > 
> > > > > > > > And because of those reasons I strongly think that patches like this
> > > > > > > > should go through the DRM tree :)
> > > > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > > > should carry these patches?
> > > > > Probably best if the relevant maintainer pick them up individually.
> > > > > 
> > > > > Some of those structures are filled in by firmware/hardware and only the
> > > > > maintainers can judge if that value actually matches what the compiler
> > > > > needs.
> > > > > 
> > > > > We have cases where individual bits are used as flags or when the size is
> > > > > byte swapped etc...
> > > > > 
> > > > > Even Alex and I didn't immediately say how and where that field is actually
> > > > > used and had to dig that up. That's where the confusion came from.
> > > > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > > > hopefully those can get picked up for the DRM tree?
> > > I will pick those up to go through drm-misc-next.
> > > 
> > > Going to ping maintainers once more when I'm not sure if stuff is correct or
> > > not.
> > Sounds great; thanks!
> 
> I wasn't 100% sure for the VC4 patch, but pushed the whole set to
> drm-misc-next anyway.
> 
> This also means that the patches are now auto merged into the drm-tip
> integration branch and should any build or unit test go boom we should
> notice immediately and can revert it pretty easily.

Thanks very much; I'll keep an eye out for any reports.

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [Intel-gfx] [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-05 16:16                     ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-05 16:16 UTC (permalink / raw)
  To: Christian König
  Cc: Emma Anholt, Tom Rix, llvm, dri-devel, Chris Wilson, Prike Liang,
	Huang Rui, Gerd Hoffmann, Andrzej Hajda, Marijn Suijten,
	David Airlie, Karol Herbst, Neil Armstrong, amd-gfx,
	Kuogee Hsieh, VMware Graphics Reviewers, Ben Skeggs, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, linux-arm-msm, intel-gfx, Kevin Wang,
	Abhinav Kumar, Nathan Chancellor, Dmitry Baryshkov,
	Gurchetan Singh, Maxime Ripard, Rodrigo Vivi, Evan Quan,
	Yifan Zhang, Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan,
	Xinhui, Nick Desaulniers, linux-kernel, Melissa Wen, Zack Rusin,
	Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, Hawking Zhang

On Thu, Oct 05, 2023 at 11:42:38AM +0200, Christian König wrote:
> Am 02.10.23 um 20:22 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> > > Am 02.10.23 um 20:08 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > > > benefit from the annotation.
> > > > > > > > > > 
> > > > > > > > > > [...]
> > > > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > > > if this should go via drm instead.
> > > > > > > > > 
> > > > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > > > 
> > > > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > > > >           https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > > > were false positives?
> > > > > > 
> > > > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > > > endianness which not necessary matches the CPU endianness.
> > > > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > > > will always match.
> > > > > > Which I think is what is being said here?
> > > > > > 
> > > > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > > > 
> > > > > > > > And because of those reasons I strongly think that patches like this
> > > > > > > > should go through the DRM tree :)
> > > > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > > > should carry these patches?
> > > > > Probably best if the relevant maintainer pick them up individually.
> > > > > 
> > > > > Some of those structures are filled in by firmware/hardware and only the
> > > > > maintainers can judge if that value actually matches what the compiler
> > > > > needs.
> > > > > 
> > > > > We have cases where individual bits are used as flags or when the size is
> > > > > byte swapped etc...
> > > > > 
> > > > > Even Alex and I didn't immediately say how and where that field is actually
> > > > > used and had to dig that up. That's where the confusion came from.
> > > > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > > > hopefully those can get picked up for the DRM tree?
> > > I will pick those up to go through drm-misc-next.
> > > 
> > > Going to ping maintainers once more when I'm not sure if stuff is correct or
> > > not.
> > Sounds great; thanks!
> 
> I wasn't 100% sure for the VC4 patch, but pushed the whole set to
> drm-misc-next anyway.
> 
> This also means that the patches are now auto merged into the drm-tip
> integration branch and should any build or unit test go boom we should
> notice immediately and can revert it pretty easily.

Thanks very much; I'll keep an eye out for any reports.

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

* Re: [PATCH 0/9] drm: Annotate structs with __counted_by
@ 2023-10-05 16:16                     ` Kees Cook
  0 siblings, 0 replies; 243+ messages in thread
From: Kees Cook @ 2023-10-05 16:16 UTC (permalink / raw)
  To: Christian König
  Cc: Tejas Upadhyay, Emma Anholt, Tom Rix, Joonas Lahtinen, llvm,
	dri-devel, Chris Wilson, Prike Liang, Huang Rui, Gerd Hoffmann,
	Andrzej Hajda, Marijn Suijten, David Airlie, Matthew Brost,
	Karol Herbst, Neil Armstrong, amd-gfx, Kuogee Hsieh,
	VMware Graphics Reviewers, Ben Skeggs, Andi Shyti, nouveau,
	David Airlie, virtualization, Chia-I Wu, linux-hardening,
	Alex Deucher, Lijo Lazar, Tvrtko Ursulin, linux-arm-msm,
	intel-gfx, Kevin Wang, Abhinav Kumar, Jani Nikula,
	Nathan Chancellor, Dmitry Baryshkov, Gurchetan Singh,
	Maxime Ripard, Rodrigo Vivi, Evan Quan, Sean Paul, Yifan Zhang,
	Xiaojian Du, Le Ma, freedreno, Bjorn Andersson, Pan, Xinhui,
	Nick Desaulniers, linux-kernel, Rob Clark, Melissa Wen,
	Zack Rusin, Daniel Vetter, Alex Deucher, Nirmoy Das, Lang Yu,
	Christian König, John Harrison, Hawking Zhang

On Thu, Oct 05, 2023 at 11:42:38AM +0200, Christian König wrote:
> Am 02.10.23 um 20:22 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> > > Am 02.10.23 um 20:08 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > > > <ckoenig.leichtzumerken@gmail.com> wrote:
> > > > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > > > This is a batch of patches touching drm for preparing 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 to structs that would
> > > > > > > > > > benefit from the annotation.
> > > > > > > > > > 
> > > > > > > > > > [...]
> > > > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > > > if this should go via drm instead.
> > > > > > > > > 
> > > > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > > > 
> > > > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > > > >           https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > > > were false positives?
> > > > > > 
> > > > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > > > endianness which not necessary matches the CPU endianness.
> > > > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > > > will always match.
> > > > > > Which I think is what is being said here?
> > > > > > 
> > > > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > > > 
> > > > > > > > And because of those reasons I strongly think that patches like this
> > > > > > > > should go through the DRM tree :)
> > > > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > > > should carry these patches?
> > > > > Probably best if the relevant maintainer pick them up individually.
> > > > > 
> > > > > Some of those structures are filled in by firmware/hardware and only the
> > > > > maintainers can judge if that value actually matches what the compiler
> > > > > needs.
> > > > > 
> > > > > We have cases where individual bits are used as flags or when the size is
> > > > > byte swapped etc...
> > > > > 
> > > > > Even Alex and I didn't immediately say how and where that field is actually
> > > > > used and had to dig that up. That's where the confusion came from.
> > > > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > > > hopefully those can get picked up for the DRM tree?
> > > I will pick those up to go through drm-misc-next.
> > > 
> > > Going to ping maintainers once more when I'm not sure if stuff is correct or
> > > not.
> > Sounds great; thanks!
> 
> I wasn't 100% sure for the VC4 patch, but pushed the whole set to
> drm-misc-next anyway.
> 
> This also means that the patches are now auto merged into the drm-tip
> integration branch and should any build or unit test go boom we should
> notice immediately and can revert it pretty easily.

Thanks very much; I'll keep an eye out for any reports.

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 243+ messages in thread

end of thread, other threads:[~2023-10-05 16:21 UTC | newest]

Thread overview: 243+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22 17:32 [PATCH 0/9] drm: Annotate structs with __counted_by Kees Cook
2023-09-22 17:32 ` Kees Cook
2023-09-22 17:32 ` Kees Cook
2023-09-22 17:32 ` [Intel-gfx] " Kees Cook
2023-09-22 17:32 ` Kees Cook
2023-09-22 17:32 ` [Nouveau] " Kees Cook
2023-09-22 17:32 ` [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Intel-gfx] " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Nouveau] " Kees Cook
2023-09-22 17:41   ` Alex Deucher
2023-09-22 17:41     ` Alex Deucher
2023-09-22 17:41     ` [Intel-gfx] " Alex Deucher
2023-09-22 17:41     ` Alex Deucher
2023-09-22 17:41     ` Alex Deucher
2023-09-22 17:41     ` [Nouveau] " Alex Deucher
2023-09-25  6:30     ` Christian König
2023-09-25  6:30       ` Christian König
2023-09-25  6:30       ` [Intel-gfx] " Christian König
2023-09-25  6:30       ` Christian König
2023-09-25  6:30       ` Christian König via Virtualization
2023-09-25  6:30       ` [Nouveau] " Christian König
2023-09-25 14:07       ` Alex Deucher
2023-09-25 14:07         ` Alex Deucher
2023-09-25 14:07         ` [Intel-gfx] " Alex Deucher
2023-09-25 14:07         ` Alex Deucher
2023-09-25 14:07         ` Alex Deucher
2023-09-25 14:07         ` [Nouveau] " Alex Deucher
2023-09-25 14:14         ` Alex Deucher
2023-09-25 14:14           ` Alex Deucher
2023-09-25 14:14           ` [Intel-gfx] " Alex Deucher
2023-09-25 14:14           ` Alex Deucher
2023-09-25 14:14           ` Alex Deucher
2023-09-25 14:14           ` [Nouveau] " Alex Deucher
2023-09-25 17:52       ` Kees Cook
2023-09-25 17:52         ` Kees Cook
2023-09-25 17:52         ` [Intel-gfx] " Kees Cook
2023-09-25 17:52         ` Kees Cook
2023-09-25 17:52         ` Kees Cook
2023-09-25 17:52         ` [Nouveau] " Kees Cook
2023-09-25 17:56         ` Alex Deucher
2023-09-25 17:56           ` Alex Deucher
2023-09-25 17:56           ` [Intel-gfx] " Alex Deucher
2023-09-25 17:56           ` Alex Deucher
2023-09-25 17:56           ` Alex Deucher
2023-09-25 17:56           ` [Nouveau] " Alex Deucher
2023-09-23  2:13   ` Gustavo A. R. Silva
2023-09-23  2:13     ` Gustavo A. R. Silva
2023-09-23  2:13     ` [Intel-gfx] " Gustavo A. R. Silva
2023-09-23  2:13     ` Gustavo A. R. Silva
2023-09-23  2:13     ` Gustavo A. R. Silva
2023-09-23  2:13     ` [Nouveau] " Gustavo A. R. Silva
2023-09-22 17:32 ` [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Intel-gfx] " Kees Cook
2023-09-22 17:32   ` [Nouveau] " Kees Cook
2023-09-22 17:42   ` Alex Deucher
2023-09-22 17:42     ` Alex Deucher
2023-09-22 17:42     ` [Intel-gfx] " Alex Deucher
2023-09-22 17:42     ` Alex Deucher
2023-09-22 17:42     ` Alex Deucher
2023-09-22 17:42     ` [Nouveau] " Alex Deucher
2023-09-23  2:14   ` Gustavo A. R. Silva
2023-09-23  2:14     ` Gustavo A. R. Silva
2023-09-23  2:14     ` Gustavo A. R. Silva
2023-09-23  2:14     ` Gustavo A. R. Silva
2023-09-23  2:14     ` [Intel-gfx] " Gustavo A. R. Silva
2023-09-23  2:14     ` [Nouveau] " Gustavo A. R. Silva
2023-09-22 17:32 ` [Nouveau] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Intel-gfx] " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-23  2:14   ` Gustavo A. R. Silva
2023-09-23  2:14     ` Gustavo A. R. Silva
2023-09-23  2:14     ` [Intel-gfx] " Gustavo A. R. Silva
2023-09-23  2:14     ` Gustavo A. R. Silva
2023-09-23  2:14     ` [Nouveau] " Gustavo A. R. Silva
2023-09-23  2:14     ` Gustavo A. R. Silva
2023-09-25 10:08   ` Andrzej Hajda
2023-09-25 10:08     ` Andrzej Hajda
2023-09-25 10:08     ` [Intel-gfx] " Andrzej Hajda
2023-09-25 10:08     ` Andrzej Hajda
2023-09-25 10:08     ` [Nouveau] " Andrzej Hajda
2023-09-25 17:50     ` Kees Cook
2023-09-25 17:50       ` Kees Cook
2023-09-25 17:50       ` [Intel-gfx] " Kees Cook
2023-09-25 17:50       ` Kees Cook
2023-09-25 17:50       ` Kees Cook
2023-09-25 17:50       ` [Nouveau] " Kees Cook
2023-09-25 12:20   ` Andi Shyti
2023-09-25 12:20     ` [Intel-gfx] " Andi Shyti
2023-09-25 12:20     ` Andi Shyti
2023-09-25 12:20     ` Andi Shyti
2023-09-25 12:20     ` [Nouveau] " Andi Shyti
2023-09-22 17:32 ` [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Nouveau] " Kees Cook
2023-09-22 17:32   ` [Intel-gfx] " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-23  2:15   ` Gustavo A. R. Silva
2023-09-23  2:15     ` Gustavo A. R. Silva
2023-09-23  2:15     ` [Intel-gfx] " Gustavo A. R. Silva
2023-09-23  2:15     ` Gustavo A. R. Silva
2023-09-23  2:15     ` Gustavo A. R. Silva
2023-09-23  2:15     ` [Nouveau] " 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 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Nouveau] " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 19:00   ` Lyude Paul
2023-09-22 19:00     ` Lyude Paul
2023-09-22 19:00     ` [Intel-gfx] " Lyude Paul
2023-09-22 19:00     ` Lyude Paul
2023-09-22 19:00     ` Lyude Paul
2023-09-22 19:00     ` [Nouveau] " Lyude Paul
2023-09-23  2:15   ` Gustavo A. R. Silva
2023-09-23  2:15     ` Gustavo A. R. Silva
2023-09-23  2:15     ` Gustavo A. R. Silva
2023-09-23  2:15     ` [Intel-gfx] " Gustavo A. R. Silva
2023-09-23  2:15     ` Gustavo A. R. Silva
2023-09-23  2:15     ` [Nouveau] " Gustavo A. R. Silva
2023-09-22 17:32 ` [Nouveau] [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Intel-gfx] " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-23  2:16   ` Gustavo A. R. Silva
2023-09-23  2:16     ` Gustavo A. R. Silva
2023-09-23  2:16     ` Gustavo A. R. Silva
2023-09-23  2:16     ` [Intel-gfx] " Gustavo A. R. Silva
2023-09-23  2:16     ` Gustavo A. R. Silva
2023-09-23  2:16     ` [Nouveau] " Gustavo A. R. Silva
2023-09-22 17:32 ` [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Intel-gfx] " Kees Cook
2023-09-22 17:32   ` [Nouveau] " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-23  2:36   ` Gustavo A. R. Silva
2023-09-23  2:36     ` Gustavo A. R. Silva
2023-09-23  2:36     ` [Intel-gfx] " Gustavo A. R. Silva
2023-09-23  2:36     ` Gustavo A. R. Silva
2023-09-23  2:36     ` Gustavo A. R. Silva
2023-09-23  2:36     ` [Nouveau] " 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 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Nouveau] " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 21:50   ` Zack Rusin
2023-09-22 21:50     ` [Nouveau] " Zack Rusin
2023-09-22 21:50     ` Zack Rusin
2023-09-22 21:50     ` [Intel-gfx] " Zack Rusin
2023-09-22 21:50     ` Zack Rusin
2023-09-23  2:37   ` Gustavo A. R. Silva
2023-09-23  2:37     ` Gustavo A. R. Silva
2023-09-23  2:37     ` [Intel-gfx] " Gustavo A. R. Silva
2023-09-23  2:37     ` Gustavo A. R. Silva
2023-09-23  2:37     ` [Nouveau] " Gustavo A. R. Silva
2023-09-22 17:32 ` [PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Intel-gfx] " Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` Kees Cook
2023-09-22 17:32   ` [Nouveau] " Kees Cook
2023-09-28 15:16   ` Maira Canal
2023-09-28 15:16     ` [Nouveau] " Maira Canal
2023-09-28 15:16     ` Maira Canal
2023-09-28 15:16     ` [Intel-gfx] " 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 ` [PATCH 0/9] " Kees Cook
2023-09-29 19:33   ` Kees Cook
2023-09-29 19:33   ` [Intel-gfx] " Kees Cook
2023-09-29 19:33   ` Kees Cook
2023-09-29 19:33   ` Kees Cook
2023-09-29 19:33   ` [Nouveau] " Kees Cook
2023-10-02  9:20   ` Christian König
2023-10-02  9:20     ` Christian König
2023-10-02  9:20     ` [Intel-gfx] " Christian König
2023-10-02  9:20     ` Christian König
2023-10-02  9:20     ` [Nouveau] " Christian König
2023-10-02  9:20     ` Christian König
2023-10-02 15:06     ` Alex Deucher
2023-10-02 15:06       ` Alex Deucher
2023-10-02 15:06       ` [Intel-gfx] " Alex Deucher
2023-10-02 15:06       ` Alex Deucher
2023-10-02 15:06       ` Alex Deucher
2023-10-02 15:06       ` [Nouveau] " Alex Deucher
2023-10-02 16:53       ` Kees Cook
2023-10-02 16:53         ` Kees Cook
2023-10-02 16:53         ` [Intel-gfx] " Kees Cook
2023-10-02 16:53         ` Kees Cook
2023-10-02 16:53         ` Kees Cook
2023-10-02 16:53         ` [Nouveau] " Kees Cook
2023-10-02 18:01         ` Christian König
2023-10-02 18:01           ` Christian König
2023-10-02 18:01           ` [Intel-gfx] " Christian König
2023-10-02 18:01           ` Christian König
2023-10-02 18:01           ` Christian König
2023-10-02 18:01           ` [Nouveau] " Christian König
2023-10-02 18:08           ` Kees Cook
2023-10-02 18:08             ` Kees Cook
2023-10-02 18:08             ` [Intel-gfx] " Kees Cook
2023-10-02 18:08             ` Kees Cook
2023-10-02 18:08             ` Kees Cook
2023-10-02 18:08             ` Kees Cook
2023-10-02 18:11             ` Christian König
2023-10-02 18:11               ` Christian König
2023-10-02 18:11               ` [Intel-gfx] " Christian König
2023-10-02 18:11               ` Christian König
2023-10-02 18:11               ` Christian König via Virtualization
2023-10-02 18:11               ` [Nouveau] " Christian König
2023-10-02 18:22               ` Kees Cook
2023-10-02 18:22                 ` Kees Cook
2023-10-02 18:22                 ` [Intel-gfx] " Kees Cook
2023-10-02 18:22                 ` Kees Cook
2023-10-02 18:22                 ` Kees Cook
2023-10-02 18:22                 ` [Nouveau] " Kees Cook
2023-10-05  9:42                 ` [Intel-gfx] " Christian König
2023-10-05  9:42                   ` Christian König
2023-10-05  9:42                   ` Christian König
2023-10-05  9:42                   ` Christian König
2023-10-05  9:42                   ` [Nouveau] " Christian König
2023-10-05  9:42                   ` Christian König
2023-10-05 16:16                   ` Kees Cook
2023-10-05 16:16                     ` Kees Cook
2023-10-05 16:16                     ` [Intel-gfx] " Kees Cook
2023-10-05 16:16                     ` Kees Cook
2023-10-05 16:16                     ` Kees Cook
2023-10-05 16:16                     ` [Nouveau] " Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.