forked from Minki/linux
A single fix for POSIX CPU timers to address a problem where POSIX CPU
timer delivery stops working for a new child task because copy_process() copies state information which is only valid for the parent task. -----BEGIN PGP SIGNATURE----- iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmGRDVUTHHRnbHhAbGlu dXRyb25peC5kZQAKCRCmGPVMDXSYocOFD/42NOdli73N+Jdq7APHUIHXzu+6DVT6 CI5toLQw+0KPoF0s1wg4+J0YCDt2k0Pu4lOabF3Ze/+c6RlR5zfCXESqsXdHaCjh E91Vs57u0ataRMEHo6KB6eBIutuF8hyxfY6vVXfkTRNAreUIWiwWYrlB0G64JVOG +/l1W7adovjLcLwcW+ArrnLJwkBKtXunK6PVv2IrdRHwpMHbwoNRCCCFvzkqnWmQ 4Yy2/NaB/PEBK5kezP1/j9EMcGCTWk1JJIm+l/PEwCCcbIgIdUahpW3XHAaqms6R oukqCvE5ukfmVzBFYBhCamhF8heyEeBVRqGU+Yyk48+I+DQFBCqaqa1NKSuEUdNL Nycy6Rp1yn7CHVSB461shMS6NJGOSNDBjv7vxer3WjV3HPJu7y0RrN7jXbkSfQnm hVKjkmbDEYwylgzFE5+T857NqD5MEXeuIBtTO08hNRnpd61aB3x+qq+8ElE6ST8Y pm6rMzw0AZ5buPK8QdGVDk0dD4WKObj1LzmRZvBtYeWynO6sxyKUl6B2CgAxrvn5 D1Li2/arkJMCVeIuIL5uE6DPoxSh8J7OuEC4KeWX8M8xQSEDImqfZ+tDL2Esv6jv xDmymq584hiCBc1CJjCOA9kZYe6KNXC7lkVOns6GaKKzLhkrcvUR3dUGhMyzxAMO t9QIAinR6JwRRA== =EBbc -----END PGP SIGNATURE----- Merge tag 'timers-urgent-2021-11-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull timer fix from Thomas Gleixner: "A single fix for POSIX CPU timers to address a problem where POSIX CPU timer delivery stops working for a new child task because copy_process() copies state information which is only valid for the parent task" * tag 'timers-urgent-2021-11-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: posix-cpu-timers: Clear task::posix_cputimers_work in copy_process()
This commit is contained in:
commit
622c72b651
@ -184,8 +184,10 @@ static inline void posix_cputimers_group_init(struct posix_cputimers *pct,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POSIX_CPU_TIMERS_TASK_WORK
|
||||
void clear_posix_cputimers_work(struct task_struct *p);
|
||||
void posix_cputimers_init_work(void);
|
||||
#else
|
||||
static inline void clear_posix_cputimers_work(struct task_struct *p) { }
|
||||
static inline void posix_cputimers_init_work(void) { }
|
||||
#endif
|
||||
|
||||
|
@ -2277,6 +2277,7 @@ static __latent_entropy struct task_struct *copy_process(
|
||||
p->pdeath_signal = 0;
|
||||
INIT_LIST_HEAD(&p->thread_group);
|
||||
p->task_works = NULL;
|
||||
clear_posix_cputimers_work(p);
|
||||
|
||||
#ifdef CONFIG_KRETPROBES
|
||||
p->kretprobe_instances.first = NULL;
|
||||
|
@ -1158,14 +1158,29 @@ static void posix_cpu_timers_work(struct callback_head *work)
|
||||
handle_posix_cpu_timers(current);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear existing posix CPU timers task work.
|
||||
*/
|
||||
void clear_posix_cputimers_work(struct task_struct *p)
|
||||
{
|
||||
/*
|
||||
* A copied work entry from the old task is not meaningful, clear it.
|
||||
* N.B. init_task_work will not do this.
|
||||
*/
|
||||
memset(&p->posix_cputimers_work.work, 0,
|
||||
sizeof(p->posix_cputimers_work.work));
|
||||
init_task_work(&p->posix_cputimers_work.work,
|
||||
posix_cpu_timers_work);
|
||||
p->posix_cputimers_work.scheduled = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize posix CPU timers task work in init task. Out of line to
|
||||
* keep the callback static and to avoid header recursion hell.
|
||||
*/
|
||||
void __init posix_cputimers_init_work(void)
|
||||
{
|
||||
init_task_work(¤t->posix_cputimers_work.work,
|
||||
posix_cpu_timers_work);
|
||||
clear_posix_cputimers_work(current);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user