Re: [patch 5/6] posix-cpu-timers: Sanitize thread clock permissions
From: Peter Zijlstra
Date: Thu Sep 05 2019 - 08:21:15 EST
On Thu, Sep 05, 2019 at 02:03:44PM +0200, Thomas Gleixner wrote:
> The thread clock permissions are restricted to tasks of the same thread
> group, but that also prevents a ptracer from reading them. This is
> inconsistent vs. the process restrictions and unnecessary strict.
>
> Relax it to ptrace permissions in the same way as process permissions are
> handled.
More of a meta comment on the added permission checking; so where
clock_getcpuclockid() is allowed to return -EPERM, it doesn't because
that's in glibc and it has no clue.
And these patches implement the ptrace checks and result in -EINVAL for
timer_create() and clock_gettime(), even though it should arguably be
-EPERM, but we're not allowed to return that here.