dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: "Daniel Stone" <daniels@collabora.com>,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	"Michel Dänzer" <michel@daenzer.net>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"wayland-devel @ lists . freedesktop . org"
	<wayland-devel@lists.freedesktop.org>,
	"Jason Ekstrand" <jason@jlekstrand.net>,
	"Dave Airlie" <airlied@redhat.com>,
	"ML mesa-dev" <mesa-dev@lists.freedesktop.org>
Subject: Re: [Mesa-dev] [PATCH 0/6] dma-buf: Add an API for exporting sync files (v12)
Date: Fri, 18 Jun 2021 18:42:49 +0200	[thread overview]
Message-ID: <b364d818-edeb-a2e9-a3a0-960e2463f086@amd.com> (raw)
In-Reply-To: <CAKMK7uHng_beNWeYa50Nxrz2SQVmjTuuN-cAYz-SQtAymGdH3Q@mail.gmail.com>

Am 18.06.21 um 17:17 schrieb Daniel Vetter:
> [SNIP]
> Ignoring _all_ fences is officially ok for pinned dma-buf. This is
> what v4l does. Aside from it's definitely not just i915 that does this
> even on the drm side, we have a few more drivers nowadays.

No it seriously isn't. If drivers are doing this they are more than broken.

See the comment in dma-resv.h

  * Based on bo.c which bears the following copyright notice,
  * but is dual licensed:
....


The handling in ttm_bo.c is and always was that the exclusive fence is 
used for buffer moves.

As I said multiple times now the *MAIN* purpose of the dma_resv object 
is memory management and *NOT* synchronization.

Those restrictions come from the original design of TTM where the 
dma_resv object originated from.

The resulting consequences are that:

a) If you access the buffer without waiting for the exclusive fence you 
run into a potential information leak.
     We kind of let that slip for V4L since they only access the buffers 
for writes, so you can't do any harm there.

b) If you overwrite the exclusive fence with a new one without waiting 
for the old one to signal you open up the possibility for userspace to 
access freed up memory.
     This is a complete show stopper since it means that taking over the 
system is just a typing exercise.


What you have done by allowing this in is ripping open a major security 
hole for any DMA-buf import in i915 from all TTM based driver.

This needs to be fixed ASAP, either by waiting in i915 and all other 
drivers doing this for the exclusive fence while importing a DMA-buf or 
by marking i915 and all other drivers as broken.

Sorry, but if you allowed that in you seriously have no idea what you 
are talking about here and where all of this originated from.

Regards,
Christian.

  reply	other threads:[~2021-06-18 16:43 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 21:09 [PATCH 0/6] dma-buf: Add an API for exporting sync files (v12) Jason Ekstrand
2021-06-10 21:09 ` [PATCH 1/6] dma-buf: Add dma_fence_array_for_each (v2) Jason Ekstrand
2021-06-10 21:09 ` [PATCH 2/6] dma-buf: Add dma_resv_get_singleton (v6) Jason Ekstrand
2021-06-11  7:11   ` Christian König
2021-06-10 21:09 ` [PATCH 3/6] dma-buf: Document DMA_BUF_IOCTL_SYNC (v2) Jason Ekstrand
2021-06-10 21:14   ` Jason Ekstrand
2021-06-15  7:10     ` Pekka Paalanen
2021-06-11  7:24   ` Christian König
2021-06-10 21:09 ` [PATCH 4/6] dma-buf: Add an API for exporting sync files (v12) Jason Ekstrand
2021-06-13 18:26   ` Jason Ekstrand
2021-10-20 20:31   ` Simon Ser
2021-06-10 21:09 ` [PATCH 5/6] RFC: dma-buf: Add an extra fence to dma_resv_get_singleton_unlocked Jason Ekstrand
2021-06-11  7:44   ` Christian König
2021-06-10 21:09 ` [PATCH 6/6] RFC: dma-buf: Add an API for importing sync files (v7) Jason Ekstrand
2022-03-22 15:02   ` msizanoen
2021-06-15  8:41 ` [Mesa-dev] [PATCH 0/6] dma-buf: Add an API for exporting sync files (v12) Christian König
2021-06-16 18:30   ` Jason Ekstrand
2021-06-17  7:37     ` Christian König
2021-06-17 19:58       ` Daniel Vetter
2021-06-18  9:15         ` Christian König
2021-06-18 13:54           ` Jason Ekstrand
2021-06-18 14:31           ` Daniel Vetter
2021-06-18 14:42             ` Christian König
2021-06-18 15:17               ` Daniel Vetter
2021-06-18 16:42                 ` Christian König [this message]
2021-06-18 17:20                   ` Daniel Vetter
2021-06-18 18:01                     ` Christian König
2021-06-18 18:45                       ` Daniel Vetter
2021-06-21 10:16                         ` Christian König
2021-06-21 13:57                           ` Daniel Vetter
2021-06-18 18:20                   ` Daniel Stone
2021-06-18 18:44                     ` Christian König

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=b364d818-edeb-a2e9-a3a0-960e2463f086@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@redhat.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jason@jlekstrand.net \
    --cc=mesa-dev@lists.freedesktop.org \
    --cc=michel@daenzer.net \
    --cc=wayland-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

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

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