lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_MEZU=wD+wXdt+x0_LJS6y=PqkMLw7qD7yFk8ObR0k0-Q@mail.gmail.com>
Date:   Fri, 2 Jun 2023 14:22:59 -0400
From:   Alex Deucher <alexdeucher@...il.com>
To:     Christian König <christian.koenig@....com>
Cc:     Chia-I Wu <olvaffe@...il.com>, dri-devel@...ts.freedesktop.org,
        Philip Yang <Philip.Yang@....com>,
        Jammy Zhou <Jammy.Zhou@....com>,
        Mukul Joshi <mukul.joshi@....com>, Lang Yu <Lang.Yu@....com>,
        Felix Kuehling <Felix.Kuehling@....com>,
        "Pan, Xinhui" <Xinhui.Pan@....com>, linux-kernel@...r.kernel.org,
        amd-gfx@...ts.freedesktop.org,
        Marek Olšák <marek.olsak@....com>,
        Daniel Vetter <daniel@...ll.ch>,
        Alex Deucher <alexander.deucher@....com>,
        David Airlie <airlied@...il.com>,
        Danijel Slivka <danijel.slivka@....com>,
        Hawking Zhang <Hawking.Zhang@....com>
Subject: Re: [PATCH v3] amdgpu: validate offset_in_bo of drm_amdgpu_gem_va

Applied.  Thanks!


Alex

On Fri, Jun 2, 2023 at 7:43 AM Christian König <christian.koenig@....com> wrote:
>
> Am 02.06.23 um 00:44 schrieb Chia-I Wu:
> > This is motivated by OOB access in amdgpu_vm_update_range when
> > offset_in_bo+map_size overflows.
> >
> > v2: keep the validations in amdgpu_vm_bo_map
> > v3: add the validations to amdgpu_vm_bo_map/amdgpu_vm_bo_replace_map
> >      rather than to amdgpu_gem_va_ioctl
> >
> > Fixes: 9f7eb5367d00 ("drm/amdgpu: actually use the VM map parameters")
> > Signed-off-by: Chia-I Wu <olvaffe@...il.com>
>
> Reviewed-by: Christian König <christian.koenig@....com>
>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 16 ++++++++--------
> >   1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > index 22f9a65ca0fc7..76d57bc7ac620 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > @@ -1434,14 +1434,14 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
> >       uint64_t eaddr;
> >
> >       /* validate the parameters */
> > -     if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK ||
> > -         size == 0 || size & ~PAGE_MASK)
> > +     if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || size & ~PAGE_MASK)
> > +             return -EINVAL;
> > +     if (saddr + size <= saddr || offset + size <= offset)
> >               return -EINVAL;
> >
> >       /* make sure object fit at this offset */
> >       eaddr = saddr + size - 1;
> > -     if (saddr >= eaddr ||
> > -         (bo && offset + size > amdgpu_bo_size(bo)) ||
> > +     if ((bo && offset + size > amdgpu_bo_size(bo)) ||
> >           (eaddr >= adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT))
> >               return -EINVAL;
> >
> > @@ -1500,14 +1500,14 @@ int amdgpu_vm_bo_replace_map(struct amdgpu_device *adev,
> >       int r;
> >
> >       /* validate the parameters */
> > -     if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK ||
> > -         size == 0 || size & ~PAGE_MASK)
> > +     if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || size & ~PAGE_MASK)
> > +             return -EINVAL;
> > +     if (saddr + size <= saddr || offset + size <= offset)
> >               return -EINVAL;
> >
> >       /* make sure object fit at this offset */
> >       eaddr = saddr + size - 1;
> > -     if (saddr >= eaddr ||
> > -         (bo && offset + size > amdgpu_bo_size(bo)) ||
> > +     if ((bo && offset + size > amdgpu_bo_size(bo)) ||
> >           (eaddr >= adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT))
> >               return -EINVAL;
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ