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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey

On Wed, Aug 3, 2016 at 9:01 PM, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> 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
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux