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: <CABUrSUAykWDFKjLdiL4KrLmY3ztKnZdNNaP7g4U1ZmSs0d1haA@mail.gmail.com>
Date: Wed, 27 Mar 2024 16:15:16 -0700
From: Dominik Behr <dbehr@...gle.com>
To: Rob Clark <robdclark@...il.com>
Cc: Dominik Behr <dbehr@...omium.org>, dri-devel@...ts.freedesktop.org, 
	Rob Clark <robdclark@...omium.org>, 
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>, 
	Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>, 
	Sumit Semwal <sumit.semwal@...aro.org>, Christian König <christian.koenig@....com>, 
	Simon Ser <contact@...rsion.fr>, open list <linux-kernel@...r.kernel.org>, 
	"open list:DMA BUFFER SHARING FRAMEWORK:Keyword:bdma_(?:buf|fence|resv)b" <linux-media@...r.kernel.org>, 
	"moderated list:DMA BUFFER SHARING FRAMEWORK:Keyword:bdma_(?:buf|fence|resv)b" <linaro-mm-sig@...ts.linaro.org>
Subject: Re: [PATCH] drm/prime: Unbreak virtgpu dma-buf export

It is mapped, via iommu interface (vfio-iommu) when map_dma is called.
--
Dominik

On Mon, Mar 25, 2024 at 7:38 PM Rob Clark <robdclark@...il.com> wrote:
>
> This is actually a bit concerning.. importing a host page backed
> buffer without guest mapping into a passthru device probably doesn't
> work and should be rejected earlier.
>
> I do think we should relax the restriction (either taking my patch or
> reverting the commit it fixes) until we work this out properly
> (because the original patch is a regression), but importing a buffer
> without guest pages into a passthru device can't possibly work
> properly.  Maybe it works by chance if the host buffer is mapped to
> the guest, but that is not guaranteed.
>
> BR,
> -R
>
> On Mon, Mar 25, 2024 at 3:35 PM Dominik Behr <dbehr@...omium.org> wrote:
> >
> > It also fixes importing virtgpu blobs into real hardware, for instance amdgpu for DRI_PRIME rendering.
> >
> > On Fri, Mar 22, 2024 at 2:48 PM Rob Clark <robdclark@...il.com> wrote:
> >>
> >> From: Rob Clark <robdclark@...omium.org>
> >>
> >> virtgpu "vram" GEM objects do not implement obj->get_sg_table().  But
> >> they also don't use drm_gem_map_dma_buf().  In fact they may not even
> >> have guest visible pages.  But it is perfectly fine to export and share
> >> with other virtual devices.
> >>
> >> Reported-by: Dominik Behr <dbehr@...omium.org>
> >> Fixes: 207395da5a97 ("drm/prime: reject DMA-BUF attach when get_sg_table is missing")
> >> Signed-off-by: Rob Clark <robdclark@...omium.org>
> >> ---
> >>  drivers/gpu/drm/drm_prime.c | 7 ++++++-
> >>  1 file changed, 6 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> >> index 7352bde299d5..64dd6276e828 100644
> >> --- a/drivers/gpu/drm/drm_prime.c
> >> +++ b/drivers/gpu/drm/drm_prime.c
> >> @@ -582,7 +582,12 @@ int drm_gem_map_attach(struct dma_buf *dma_buf,
> >>  {
> >>         struct drm_gem_object *obj = dma_buf->priv;
> >>
> >> -       if (!obj->funcs->get_sg_table)
> >> +       /*
> >> +        * drm_gem_map_dma_buf() requires obj->get_sg_table(), but drivers
> >> +        * that implement their own ->map_dma_buf() do not.
> >> +        */
> >> +       if ((dma_buf->ops->map_dma_buf == drm_gem_map_dma_buf) &&
> >> +           !obj->funcs->get_sg_table)
> >>                 return -ENOSYS;
> >>
> >>         return drm_gem_pin(obj);
> >> --
> >> 2.44.0
> >>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ