[PATCH 2/8] drm: remove redundant drm_file->uid

David Herrmann dh.herrmann at gmail.com
Thu Aug 4 08:29:20 UTC 2016


Hey

On Wed, Aug 3, 2016 at 9:01 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> On Wed, Aug 03, 2016 at 08:04:26PM +0200, David Herrmann wrote:
>> @@ -98,13 +99,14 @@ int drm_clients_info(struct seq_file *m, void *data)
>>
>>               rcu_read_lock(); /* locks pid_task()->comm */
>>               task = pid_task(priv->pid, PIDTYPE_PID);
>> +             uid = priv->filp ? priv->filp->f_cred->euid : GLOBAL_ROOT_UID;
>>               seq_printf(m, "%20s %5d %3d   %c    %c %5d %10u\n",
>>                          task ? task->comm : "<unknown>",
>>                          pid_vnr(priv->pid),
>>                          priv->minor->index,
>>                          drm_is_current_master(priv) ? 'y' : 'n',
>>                          priv->authenticated ? 'y' : 'n',
>> -                        from_kuid_munged(seq_user_ns(m), priv->uid),
>> +                        from_kuid_munged(seq_user_ns(m), uid),
>>                          priv->magic);
>>               rcu_read_unlock();
>>       }
>> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
>> index 33af4a5..49cd835 100644
>> --- a/drivers/gpu/drm/drm_ioctl.c
>> +++ b/drivers/gpu/drm/drm_ioctl.c
>> @@ -191,7 +191,9 @@ static int drm_getclient(struct drm_device *dev, void *data,
>>               client->auth = file_priv->authenticated;
>>               client->pid = pid_vnr(file_priv->pid);
>>               client->uid = from_kuid_munged(current_user_ns(),
>> -                                            file_priv->uid);
>> +                                            file_priv->filp ?
>> +                                            file_priv->filp->f_cred->euid :
>> +                                            GLOBAL_ROOT_UID);
>
> Why can't we use task_euid(pid_task(file_priv->pid)) here as well?

task_euid() changes semantics. With this patch I just tried to get rid
of "filp" usage, but keep semantics, so the ABI does not suddently
change.

Note that both calls are actually changed in follow-ups. "uid" is just
cleared to "overflowuid", since no-one ever looks at that field. And
"pid" is set to "pid_vnr(current)". However, I explicitly split those
patches to make sure it is easier to bisect.

Thanks
David


More information about the dri-devel mailing list