* [PATCH -next] drm/vmwgfx: Allow dropped masters render-node like access on legacy nodes
@ 2015-08-27 12:55 Thomas Hellstrom
2015-08-27 13:07 ` Thomas Hellstrom
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Hellstrom @ 2015-08-27 12:55 UTC (permalink / raw)
To: dri-devel; +Cc: Thomas Hellstrom
Applications like gnome-shell may try to render after dropping master
privileges. Since the driver should now be safe against this scenario,
allow those applications to use their legacy node like a render node.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 ++++++-
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 5 +++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 03854d6..e13b20b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1052,10 +1052,15 @@ static struct vmw_master *vmw_master_check(struct drm_device *dev,
}
/*
- * Check if we were previously master, but now dropped.
+ * Check if we were previously master, but now dropped. In that
+ * case, allow at least render node functionality.
*/
if (vmw_fp->locked_master) {
mutex_unlock(&dev->master_mutex);
+
+ if (flags & DRM_RENDER_ALLOW)
+ return NULL;
+
DRM_ERROR("Dropped master trying to access ioctl that "
"requires authentication.\n");
return ERR_PTR(-EACCES);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 5b8595b..4f0794d 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -911,6 +911,11 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
"surface reference.\n");
return -EACCES;
}
+ if (ACCESS_ONCE(vmw_fpriv(file_priv)->locked_master)) {
+ DRM_ERROR("Locked master refused legacy "
+ "surface reference.\n");
+ }
+
handle = u_handle;
}
--
2.4.3
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH -next] drm/vmwgfx: Allow dropped masters render-node like access on legacy nodes
2015-08-27 12:55 [PATCH -next] drm/vmwgfx: Allow dropped masters render-node like access on legacy nodes Thomas Hellstrom
@ 2015-08-27 13:07 ` Thomas Hellstrom
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Hellstrom @ 2015-08-27 13:07 UTC (permalink / raw)
To: Thomas Hellstrom; +Cc: dri-devel
On 08/27/2015 02:55 PM, Thomas Hellstrom wrote:
> Applications like gnome-shell may try to render after dropping master
> privileges. Since the driver should now be safe against this scenario,
> allow those applications to use their legacy node like a render node.
>
> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 ++++++-
> drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 5 +++++
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index 03854d6..e13b20b 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -1052,10 +1052,15 @@ static struct vmw_master *vmw_master_check(struct drm_device *dev,
> }
>
> /*
> - * Check if we were previously master, but now dropped.
> + * Check if we were previously master, but now dropped. In that
> + * case, allow at least render node functionality.
> */
> if (vmw_fp->locked_master) {
> mutex_unlock(&dev->master_mutex);
> +
> + if (flags & DRM_RENDER_ALLOW)
> + return NULL;
> +
> DRM_ERROR("Dropped master trying to access ioctl that "
> "requires authentication.\n");
> return ERR_PTR(-EACCES);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> index 5b8595b..4f0794d 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> @@ -911,6 +911,11 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
> "surface reference.\n");
> return -EACCES;
> }
> + if (ACCESS_ONCE(vmw_fpriv(file_priv)->locked_master)) {
> + DRM_ERROR("Locked master refused legacy "
> + "surface reference.\n");
Actually, a return -EACCES is missing here. I'll send out a v2.
/Thomas
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-27 13:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-27 12:55 [PATCH -next] drm/vmwgfx: Allow dropped masters render-node like access on legacy nodes Thomas Hellstrom
2015-08-27 13:07 ` Thomas Hellstrom
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.