summaryrefslogtreecommitdiff
path: root/include/linux/posix-timers.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2020-02-28 11:11:06 -0600
committerThomas Gleixner <tglx@linutronix.de>2020-03-04 09:54:55 +0100
commit55e8c8eb2c7b6bf30e99423ccfe7ca032f498f59 (patch)
tree5ea233fd8cf97b66952b78d773595598ffc000bc /include/linux/posix-timers.h
parentbeb41d9cbe4179058634e05d60235b6155c7b6c6 (diff)
downloadlwn-55e8c8eb2c7b6bf30e99423ccfe7ca032f498f59.tar.gz
lwn-55e8c8eb2c7b6bf30e99423ccfe7ca032f498f59.zip
posix-cpu-timers: Store a reference to a pid not a task
posix cpu timers do not handle the death of a process well. This is most clearly seen when a multi-threaded process calls exec from a thread that is not the leader of the thread group. The posix cpu timer code continues to pin the old thread group leader and is unable to find the siglock from there. This results in posix_cpu_timer_del being unable to delete a timer, posix_cpu_timer_set being unable to set a timer. Further to compensate for the problems in posix_cpu_timer_del on a multi-threaded exec all timers that point at the multi-threaded task are stopped. The code for the timers fundamentally needs to check if the target process/thread is alive. This needs an extra level of indirection. This level of indirection is already available in struct pid. So replace cpu.task with cpu.pid to get the needed extra layer of indirection. In addition to handling things more cleanly this reduces the amount of memory a timer can pin when a process exits and then is reaped from a task_struct to the vastly smaller struct pid. Fixes: e0a70217107e ("posix-cpu-timers: workaround to suppress the problems with mt exec") Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/87wo86tz6d.fsf@x220.int.ebiederm.org
Diffstat (limited to 'include/linux/posix-timers.h')
-rw-r--r--include/linux/posix-timers.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 3d10c84a97a9..e3f0f8585da4 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -69,7 +69,7 @@ static inline int clockid_to_fd(const clockid_t clk)
struct cpu_timer {
struct timerqueue_node node;
struct timerqueue_head *head;
- struct task_struct *task;
+ struct pid *pid;
struct list_head elist;
int firing;
};