From: Daniel Vetter <daniel@ffwll.ch>
To: "Koenig, Christian" <Christian.Koenig@amd.com>
Cc: David Airlie <airlied@linux.ie>,
Emil Velikov <emil.l.velikov@gmail.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>
Subject: Re: [PATCH 01/13] drm/amdgpu: introduce and honour DRM_FORCE_AUTH workaround
Date: Mon, 27 May 2019 15:20:41 +0200 [thread overview]
Message-ID: <20190527132041.GP21222@phenom.ffwll.local> (raw)
In-Reply-To: <3c9b5688-5e83-f173-00e3-6e139e05d466@amd.com>
On Mon, May 27, 2019 at 10:47:39AM +0000, Koenig, Christian wrote:
> Am 27.05.19 um 10:17 schrieb Emil Velikov:
> > From: Emil Velikov <emil.velikov@collabora.com>
> >
> > Currently one can circumvent DRM_AUTH, when the ioctl is exposed via the
> > render node. A seemingly deliberate design decision.
> >
> > Hence we can drop the DRM_AUTH all together (details in follow-up patch)
> > yet not all userspace checks if it's authenticated, but instead uses
> > uncommon assumptions.
> >
> > After days of digging through git log and testing, only a single (ab)use
> > was spotted - the Mesa RADV driver, using the AMDGPU_INFO ioctl and
> > assuming that failure implies lack of authentication.
> >
> > Affected versions are:
> > - the whole 18.2.x series, which is EOL
> > - the whole 18.3.x series, which is EOL
> > - the 19.0.x series, prior to 19.0.4
>
> Well you could have saved your time, cause this is still a NAK.
>
> For the record: I strongly think that we don't want to expose any render
> functionality on the primary node.
>
> To even go a step further I would say that at least on AMD hardware we
> should completely disable DRI2 for one of the next generations.
>
> As a follow up I would then completely disallow the DRM authentication
> for amdgpu, so that the command submission interface on the primary node
> can only be used by the display server.
So amdgpu is running in one direction, while everyone else is running in
the other direction? Please note that your patch to change i915 landed
already, so that ship is sailing (but we could ofc revert that back
again).
Imo really not a great idea if we do a amdgpu vs. everyone else split
here. If we want to deprecate dri2/flink/rendering on primary nodes across
the stack, then that should be a stack wide decision, not an amdgpu one.
Same for the other one, i.e. this stuff here.
-Daniel
>
> Regards,
> Christian.
>
> >
> > Add a special quirk for that case, thus we can drop DRM_AUTH bits as
> > mentioned earlier.
> >
> > Since all the affected userspace is EOL, we also add a kconfig option
> > to disable this quirk.
> >
> > The whole approach is inspired by DRIVER_KMS_LEGACY_CONTEXT
> >
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: Christian König <christian.koenig@amd.com>
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> > ---
> > drivers/gpu/drm/amd/amdgpu/Kconfig | 16 ++++++++++++++++
> > drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 12 +++++++++++-
> > drivers/gpu/drm/drm_ioctl.c | 5 +++++
> > include/drm/drm_ioctl.h | 17 +++++++++++++++++
> > 4 files changed, 49 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig b/drivers/gpu/drm/amd/amdgpu/Kconfig
> > index 9221e5489069..da415f445187 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/Kconfig
> > +++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
> > @@ -40,6 +40,22 @@ config DRM_AMDGPU_GART_DEBUGFS
> > Selecting this option creates a debugfs file to inspect the mapped
> > pages. Uses more memory for housekeeping, enable only for debugging.
> >
> > +config DRM_AMDGPU_FORCE_AUTH
> > + bool "Force authentication check on AMDGPU_INFO ioctl"
> > + default y
> > + help
> > + There were some version of the Mesa RADV drivers, which relied on
> > + the ioctl failing, if the client is not authenticated.
> > +
> > + Namely, the following versions are affected:
> > + - the whole 18.2.x series, which is EOL
> > + - the whole 18.3.x series, which is EOL
> > + - the 19.0.x series, prior to 19.0.4
> > +
> > + Modern distributions, should disable this. That will allow various
> > + other clients to work, that would otherwise require root privileges.
> > +
> > +
> > source "drivers/gpu/drm/amd/acp/Kconfig"
> > source "drivers/gpu/drm/amd/display/Kconfig"
> > source "drivers/gpu/drm/amd/amdkfd/Kconfig"
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > index b17d0545728e..b8076929440b 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > @@ -1214,7 +1214,17 @@ const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
> > DRM_IOCTL_DEF_DRV(AMDGPU_GEM_MMAP, amdgpu_gem_mmap_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> > DRM_IOCTL_DEF_DRV(AMDGPU_GEM_WAIT_IDLE, amdgpu_gem_wait_idle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> > DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> > - DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> > + /* The DRM_FORCE_AUTH is effectively a workaround for the RADV Mesa driver.
> > + * This is required for Mesa:
> > + * - the whole 18.2.x series, which is EOL
> > + * - the whole 18.3.x series, which is EOL
> > + * - the 19.0.x series, prior to 19.0.4
> > + */
> > + DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl,
> > +#if defined(DRM_AMDGPU_FORCE_AUTH)
> > + DRM_FORCE_AUTH|
> > +#endif
> > + DRM_AUTH|DRM_RENDER_ALLOW),
> > DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> > DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_FENCES, amdgpu_cs_wait_fences_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> > DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> > diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> > index 2263e3ddd822..9841c0076f02 100644
> > --- a/drivers/gpu/drm/drm_ioctl.c
> > +++ b/drivers/gpu/drm/drm_ioctl.c
> > @@ -544,6 +544,11 @@ int drm_ioctl_permit(u32 flags, struct drm_file *file_priv)
> > drm_is_render_client(file_priv)))
> > return -EACCES;
> >
> > + /* FORCE_AUTH is only for authenticated or render client */
> > + if (unlikely((flags & DRM_FORCE_AUTH) && !drm_is_render_client(file_priv) &&
> > + !file_priv->authenticated))
> > + return -EACCES;
> > +
> > return 0;
> > }
> > EXPORT_SYMBOL(drm_ioctl_permit);
> > diff --git a/include/drm/drm_ioctl.h b/include/drm/drm_ioctl.h
> > index fafb6f592c4b..6084ee32043d 100644
> > --- a/include/drm/drm_ioctl.h
> > +++ b/include/drm/drm_ioctl.h
> > @@ -126,6 +126,23 @@ enum drm_ioctl_flags {
> > * not set DRM_AUTH because they do not require authentication.
> > */
> > DRM_RENDER_ALLOW = BIT(5),
> > + /**
> > + * @DRM_FORCE_AUTH:
> > + *
> > + * Authentication of the primary node is mandatory. Regardless that the
> > + * user can usually circumvent that by using the render node with exact
> > + * same ioctl.
> > + *
> > + * Note: this is effectively a workaround for AMDGPU AMDGPU_INFO ioctl
> > + * and the RADV Mesa driver. This is required for Mesa:
> > + * - the whole 18.2.x series, which is EOL
> > + * - the whole 18.3.x series, which is EOL
> > + * - the 19.0.x series, prior to 19.0.4
> > + *
> > + * Note: later patch will effectively drop the DRM_AUTH for ioctls
> > + * annotated as DRM_AUTH | DRM_RENDER_ALLOW.
> > + */
> > + DRM_FORCE_AUTH = BIT(6),
> > };
> >
> > /**
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-05-27 13:20 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 8:17 [PATCH 01/13] drm/amdgpu: introduce and honour DRM_FORCE_AUTH workaround Emil Velikov
[not found] ` <20190527081741.14235-1-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-05-27 8:17 ` [PATCH 02/13] drm/amdgpu: drop DRM_AUTH usage from the driver Emil Velikov
2019-05-27 8:17 ` [PATCH 10/13] drm/radeon: drop DRM_AUTH from DRM_RENDER_ALLOW ioctls Emil Velikov
2019-05-27 10:47 ` [PATCH 01/13] drm/amdgpu: introduce and honour DRM_FORCE_AUTH workaround Koenig, Christian
[not found] ` <3c9b5688-5e83-f173-00e3-6e139e05d466-5C7GfCeVMHo@public.gmane.org>
2019-05-27 12:05 ` Emil Velikov
2019-05-27 12:20 ` Koenig, Christian
2019-05-27 12:52 ` Emil Velikov
2019-05-27 13:26 ` Daniel Vetter
2019-05-27 13:34 ` Daniel Vetter
2019-05-27 13:20 ` Daniel Vetter [this message]
[not found] ` <20190527132041.GP21222-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-05-27 13:26 ` Emil Velikov
2019-05-27 13:42 ` Koenig, Christian
[not found] ` <0426fb3e-e7bc-2464-cb42-4d5753956d23-5C7GfCeVMHo@public.gmane.org>
2019-05-27 15:26 ` Daniel Vetter
[not found] ` <CAKMK7uE_pRro8PxTwUq+pC_1GVVT7nUxan1T-kqSYT=BMHTf2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-05-28 6:58 ` Koenig, Christian
[not found] ` <d12a7dd4-595b-d0aa-a87d-527392fb0384-5C7GfCeVMHo@public.gmane.org>
2019-05-28 7:38 ` Daniel Vetter
[not found] ` <CAKMK7uE1ZWjCeg3q7qDrbcj89+DuPQwfjMqC8hTjDAMU5bhh-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-05-28 8:03 ` Koenig, Christian
[not found] ` <98c3d891-6966-2043-9709-4e718dbc6bac-5C7GfCeVMHo@public.gmane.org>
2019-05-28 8:18 ` Daniel Vetter
[not found] ` <CAKMK7uGsc7WzBBrfxape4Yy7fbKoDFH5J2F87Kx=7rE1+pXcXw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-05-28 16:10 ` Emil Velikov
2019-05-28 16:22 ` Koenig, Christian
2019-05-28 16:46 ` Emil Velikov
2019-05-28 20:05 ` Dave Airlie
[not found] ` <CAPM=9tzuQX4iQU=w4QfbE1ryq6sXc4k5SVh6V1_4AyH_O+D_oA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-05-29 13:03 ` Emil Velikov
2019-05-29 13:14 ` Koenig, Christian
2019-05-29 16:29 ` Emil Velikov
2019-05-31 12:20 ` Koenig, Christian
2019-06-04 17:59 ` Emil Velikov
2019-06-04 10:50 ` Michel Dänzer
[not found] ` <ee1b8980-3d78-aa6d-fe46-2c0d45c2bbdd-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-06-04 11:24 ` Koenig, Christian
2019-06-04 13:28 ` Daniel Vetter
2019-05-27 15:32 ` Emil Velikov
2019-05-27 13:11 ` Daniel Vetter
[not found] ` <20190527131143.GN21222-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-05-27 13:47 ` Emil Velikov
2019-06-14 12:09 ` Emil Velikov
2019-06-14 12:55 ` Koenig, Christian
[not found] ` <9dbdda6c-8916-e5ae-1676-86828b9890e7-5C7GfCeVMHo@public.gmane.org>
2019-06-14 14:16 ` Michel Dänzer
2019-06-14 15:53 ` Emil Velikov
2019-06-14 16:00 ` Koenig, Christian
[not found] ` <84b3337c-0cdc-44d4-02c6-c56bd729ed47-5C7GfCeVMHo@public.gmane.org>
2019-06-14 16:25 ` Emil Velikov
2019-06-20 16:30 ` Emil Velikov
2019-06-21 7:12 ` Koenig, Christian
[not found] ` <9cad6e74-4751-0b0a-35d1-e8f0ac4d3efc-5C7GfCeVMHo@public.gmane.org>
2019-06-21 7:41 ` Michel Dänzer
2019-06-21 8:23 ` Koenig, Christian
2019-06-21 9:09 ` Daniel Vetter
2019-06-21 9:25 ` Koenig, Christian
[not found] ` <be9f38f5-6bb5-9535-f3d9-bafa83370e0f-5C7GfCeVMHo@public.gmane.org>
2019-06-21 9:35 ` Daniel Vetter
[not found] ` <CAKMK7uE5qO4q3RYNDp22gkMSSJGgz9ChxhuWPYqXO6D1UUvy6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-21 10:16 ` Christian König
2019-06-21 10:20 ` Emil Velikov
2019-06-21 10:31 ` Koenig, Christian
[not found] ` <d241fab3-b6f0-d38a-b83f-03b70736b355-5C7GfCeVMHo@public.gmane.org>
2019-06-21 10:53 ` Emil Velikov
2019-06-21 11:07 ` Koenig, Christian
[not found] ` <338bb519-05f1-cb76-d965-81237f432937-5C7GfCeVMHo@public.gmane.org>
2019-06-21 11:58 ` Emil Velikov
2019-06-21 12:13 ` Koenig, Christian
[not found] ` <76158d1f-676d-2afa-244b-934967a9cb75-5C7GfCeVMHo@public.gmane.org>
2019-06-21 12:47 ` Emil Velikov
2019-06-21 13:00 ` Koenig, Christian
2019-06-21 15:37 ` Daniel Vetter
2019-06-21 15:24 ` Michel Dänzer
2019-06-21 11:03 ` Daniel Vetter
[not found] ` <CAKMK7uEVziNZJES9=JFBUu=LpmubS8=-A654cMN+QqhEmc8Fvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-21 11:37 ` Christian König
[not found] ` <c92dc683-6815-dc5a-dc2b-54517cc027de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-06-21 11:50 ` Daniel Vetter
[not found] ` <CAKMK7uHsv3HOXOQq=GGRkx6f+ssRg7dO7qEoBqRS9V_KiTN3Hg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-21 11:59 ` Daniel Vetter
[not found] ` <CAKMK7uG+EUhmZafFmjzSR=eq7543OELbHVaQnZZQGx0APSozwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-21 12:01 ` Emil Velikov
2019-06-21 15:15 ` Michel Dänzer
[not found] ` <b182c8e3-c060-71f0-2b3b-62600d825c9f-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-06-21 15:44 ` Daniel Vetter
2019-06-21 15:52 ` Michel Dänzer
[not found] ` <13024821-4767-eeaf-86eb-9ae1056f8931-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-06-24 9:37 ` Michel Dänzer
[not found] ` <b03e8977-c51a-9606-383f-cf4ba674dcdd-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-06-24 9:48 ` Daniel Vetter
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=20190527132041.GP21222@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=airlied@linux.ie \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
/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