Skip to content

posix-cpu-timers: Use pids not tasks in lookup

Eric W. Biederman kernel-hardening linux-api linux-fsdevel linux-security-module lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3posix-cpu-timers: Extend rcu_read_lock removing task_struct referenceskernel/time/posix-cpu-timers.c+23 -200 replies
2/3posix-cpu-timers: Replace cpu_timer_pid_type with clock_pid_typekernel/time/posix-cpu-timers.c+4 -40 replies
3/3posix-cpu-timers: Replace __get_task_for_clock with pid_for_clockkernel/time/posix-cpu-timers.c+30 -450 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/3] posix-cpu-timers: Use pids not tasks in lookup

The current posix-cpu-timer code uses pids when holding persistent references in timers. However the lookups from clockid_t still return tasks that need to be converted into pids for use.

This results in usage being pid->task->pid and that can race with release_task and de_thread. This can lead to some not wrong but surprising results. Surprising enough that Oleg and I both thought there were some bugs in the code for a while.

This set of changes modifies the code to just lookup, verify, and return pids from the clockid_t lookups to remove those potentialy troublesome races.

Eric W. Biederman (3):
posix-cpu-timers: Extend rcu_read_lock removing task_struct references
posix-cpu-timers: Replace cpu_timer_pid_type with clock_pid_type
posix-cpu-timers: Replace __get_task_for_clock with pid_for_clock

 kernel/time/posix-cpu-timers.c | 102 ++++++++++++++++++-----------------------
 1 file changed, 45 insertions(+), 57 deletions(-)

---

The changes can also be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git proc-testing