[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<BL1PR12MB5144467CB7C017E030A4C3E3F7BB2@BL1PR12MB5144.namprd12.prod.outlook.com>
Date: Tue, 22 Apr 2025 16:26:07 +0000
From: "Deucher, Alexander" <Alexander.Deucher@....com>
To: Alex Deucher <alexdeucher@...il.com>, "Koenig, Christian"
<Christian.Koenig@....com>
CC: Denis Arefev <arefev@...mel.ru>, David Airlie <airlied@...il.com>, Simona
Vetter <simona@...ll.ch>, Andrey Grodzovsky <andrey.grodzovsky@....com>,
Chunming Zhou <david1.zhou@....com>, "amd-gfx@...ts.freedesktop.org"
<amd-gfx@...ts.freedesktop.org>, "dri-devel@...ts.freedesktop.org"
<dri-devel@...ts.freedesktop.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "lvc-project@...uxtesting.org"
<lvc-project@...uxtesting.org>, "stable@...r.kernel.org"
<stable@...r.kernel.org>
Subject: RE: [PATCH v2] drm/amdgpu: check a user-provided number of BOs in
list
[Public]
> -----Original Message-----
> From: Alex Deucher <alexdeucher@...il.com>
> Sent: Tuesday, April 22, 2025 9:46 AM
> To: Koenig, Christian <Christian.Koenig@....com>
> Cc: Denis Arefev <arefev@...mel.ru>; Deucher, Alexander
> <Alexander.Deucher@....com>; David Airlie <airlied@...il.com>; Simona Vetter
> <simona@...ll.ch>; Andrey Grodzovsky <andrey.grodzovsky@....com>;
> Chunming Zhou <david1.zhou@....com>; amd-gfx@...ts.freedesktop.org; dri-
> devel@...ts.freedesktop.org; linux-kernel@...r.kernel.org; lvc-
> project@...uxtesting.org; stable@...r.kernel.org
> Subject: Re: [PATCH v2] drm/amdgpu: check a user-provided number of BOs in list
>
> Applied. Thanks!
This change beaks the following IGT tests:
igt@...gpu/amd_vcn@...-decoder-create-decode-destroy@...-decoder-create
igt@...gpu/amd_vcn@...-decoder-create-decode-destroy@...-decoder-decode
igt@...gpu/amd_vcn@...-decoder-create-decode-destroy@...-decoder-destroy
igt@...gpu/amd_jpeg_dec@...gpu_cs_jpeg_decode
igt@...gpu/amd_cs_nop@...nops-with-nop-compute0@...nop-with-nop-compute0
igt@...gpu/amd_cs_nop@...nops-with-sync-compute0@...nop-with-sync-compute0
igt@...gpu/amd_cs_nop@...nops-with-fork-compute0@...nop-with-fork-compute0
igt@...gpu/amd_cs_nop@...nops-with-sync-fork-compute0@...nop-with-sync-fork-compute0
igt@...gpu/amd_basic@...rptr-with-ip-dma@...rptr
igt@...gpu/amd_basic@...compute-with-ip-compute@...compute
igt@...gpu/amd_basic@...sdma-with-ip-dma@...sdma
igt@...gpu/amd_basic@...ction-test-with-ip-dma@...ction_test
igt@...gpu/amd_cp_dma_misc@..._to_vram-amdgpu_hw_ip_compute0
igt@...gpu/amd_cp_dma_misc@...m_to_gtt-amdgpu_hw_ip_compute0
igt@...gpu/amd_cp_dma_misc@...m_to_vram-amdgpu_hw_ip_compute0
Alex
>
> On Tue, Apr 22, 2025 at 5:13 AM Koenig, Christian <Christian.Koenig@....com>
> wrote:
> >
> > [AMD Official Use Only - AMD Internal Distribution Only]
> >
> > Reviewed-by: Christian König <christian.koenig@....com>
> >
> > ________________________________________
> > Von: Denis Arefev <arefev@...mel.ru>
> > Gesendet: Freitag, 18. April 2025 10:31
> > An: Deucher, Alexander
> > Cc: Koenig, Christian; David Airlie; Simona Vetter; Andrey Grodzovsky;
> > Chunming Zhou; amd-gfx@...ts.freedesktop.org;
> > dri-devel@...ts.freedesktop.org; linux-kernel@...r.kernel.org;
> > lvc-project@...uxtesting.org; stable@...r.kernel.org
> > Betreff: [PATCH v2] drm/amdgpu: check a user-provided number of BOs in
> > list
> >
> > The user can set any value to the variable ‘bo_number’, via the ioctl
> > command DRM_IOCTL_AMDGPU_BO_LIST. This will affect the arithmetic
> > expression ‘in->bo_number * in->bo_info_size’, which is prone to
> > overflow. Add a valid value check.
> >
> > Found by Linux Verification Center (linuxtesting.org) with SVACE.
> >
> > Fixes: 964d0fbf6301 ("drm/amdgpu: Allow to create BO lists in CS ioctl
> > v3")
> > Cc: stable@...r.kernel.org
> > Signed-off-by: Denis Arefev <arefev@...mel.ru>
> > ---
> > V1 -> V2:
> > Set a reasonable limit 'USHRT_MAX' for 'bo_number' it as Christian
> > König <christian.koenig@....com> suggested
> >
> > drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
> > index 702f6610d024..85f7ee1e085d 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
> > @@ -189,6 +189,9 @@ int amdgpu_bo_create_list_entry_array(struct
> drm_amdgpu_bo_list_in *in,
> > struct drm_amdgpu_bo_list_entry *info;
> > int r;
> >
> > + if (!in->bo_number || in->bo_number > USHRT_MAX)
> > + return -EINVAL;
> > +
> > info = kvmalloc_array(in->bo_number, info_size, GFP_KERNEL);
> > if (!info)
> > return -ENOMEM;
> > --
> > 2.43.0
> >
Powered by blists - more mailing lists