drm: reduce GETCLIENT to a minimum
Subsystems (2)
PATCH v2 1/1 drm: reduce GETCLIENT to a minimum
The *only* known user of GETCLIENT is libva, which uses it to check whether its own context is authenticated. It used to iterate all clients, look for one that matches its own pid and then check its state.
The entire purpose for us to still have a GETCLIENT implementation is to serve libva. So lets not pretend we do anything else: Make this function return information on the caller's context only, fake the PID to the caller's pid so they always match, and just fill in the "authenticated" bit, nothing else.
This patch reduces the complexity of GETCLIENT to a bare minimum, avoids any dependency on priv->uid or priv->pid (allows us to get rid of them), and makes libva happy by always *exactly* returning the information it wants.
---
v2: Just re-order the series and send individual patches, since they do
not depend on each other.
drivers/gpu/drm/drm_ioctl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_ioctl.c +2 -3
@@ -189,9 +189,8 @@ static int drm_getclient(struct drm_device *dev, void *data,*/ if (client->idx ==0 ) { client->auth = file_priv->authenticated; - client->pid =pid_vnr (file_priv->pid); - client->uid =from_kuid_munged (current_user_ns (), - file_priv->uid); + client->pid =task_pid_vnr (current); + client->uid = overflowuid; client->magic =0 ; client->iocs =0 ;
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedQuoted 28 lines · David Herrmann
The *only* known user of GETCLIENT is libva, which uses it to check whether its own context is authenticated. It used to iterate all clients, look for one that matches its own pid and then check its state.
The entire purpose for us to still have a GETCLIENT implementation is to serve libva. So lets not pretend we do anything else: Make this function return information on the caller's context only, fake the PID to the caller's pid so they always match, and just fill in the "authenticated" bit, nothing else.
This patch reduces the complexity of GETCLIENT to a bare minimum, avoids any dependency on
priv->uidorpriv->pid(allows us to get rid of them), and makes libva happy by always *exactly* returning the information it wants.Signed-off-by David Herrmann <[email protected]>---
v2: Just re-order the series and send individual patches, since they do
not depend on each other.drivers/gpu/drm/drm_ioctl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_ioctl.c +0
-0
drivers/gpu/drm/drm_ioctl.c static int drm_getclient(struct drm_device *dev, void *data, · line 195
Quoted 10 lines
drivers/gpu/drm/drm_ioctl.c +2
-3@@ -189,9 +189,8 @@ static int drm_getclient(struct drm_device *dev, void *data,*/ if (client->idx ==0 ) { client->auth = file_priv->authenticated; - client->pid =pid_vnr (file_priv->pid); - client->uid =from_kuid_munged (current_user_ns (), - file_priv->uid); + client->pid =task_pid_vnr (current); + client->uid = overflowuid; client->magic =0 ; client->iocs =0 ;
Merged to drm-misc, thanks.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel