lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 23 Sep 2021 18:04:32 +0200 (CEST) From: Thomas Gleixner <tglx@...utronix.de> To: LKML <linux-kernel@...r.kernel.org> Cc: Peter Zijlstra <peterz@...radead.org>, "Eric W. Biederman" <ebiederm@...ssion.com> Subject: [patch 08/11] signal: Move itimer rearming into itimer code Move the itimer rearming functionality into itimer.c which cleans up the ifdeffery in the signal code. While at it replace the open coded hrtimer_forward() invocation with hrtimer_forward_now() which is equivalent. Signed-off-by: Thomas Gleixner <tglx@...utronix.de> Cc: "Eric W. Biederman" <ebiederm@...ssion.com> --- include/linux/posix-timers.h | 3 +++ kernel/signal.c | 14 ++------------ kernel/time/itimer.c | 13 +++++++++++++ 3 files changed, 18 insertions(+), 12 deletions(-) --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -174,6 +174,8 @@ static inline void posix_cputimers_rt_wa .posix_cputimers = { \ .bases = INIT_CPU_TIMERBASES(s.posix_cputimers.bases), \ }, + +void itimer_restart(void); #else struct posix_cputimers { }; struct cpu_timer { }; @@ -181,6 +183,7 @@ struct cpu_timer { }; static inline void posix_cputimers_init(struct posix_cputimers *pct) { } static inline void posix_cputimers_group_init(struct posix_cputimers *pct, u64 cpu_limit) { } +static inline void itimer_restart(void) { } #endif #ifdef CONFIG_POSIX_CPU_TIMERS_TASK_WORK --- a/kernel/signal.c +++ b/kernel/signal.c @@ -651,7 +651,6 @@ int dequeue_signal(struct task_struct *t if (!signr) { signr = __dequeue_signal(&tsk->signal->shared_pending, mask, info, &resched_timer); -#ifdef CONFIG_POSIX_TIMERS /* * itimer signal ? * @@ -665,17 +664,8 @@ int dequeue_signal(struct task_struct *t * reducing the timer noise on heavy loaded !highres * systems too. */ - if (unlikely(signr == SIGALRM)) { - struct hrtimer *tmr = &tsk->signal->real_timer; - - if (!hrtimer_is_queued(tmr) && - tsk->signal->it_real_incr != 0) { - hrtimer_forward(tmr, tmr->base->get_time(), - tsk->signal->it_real_incr); - hrtimer_restart(tmr); - } - } -#endif + if (unlikely(signr == SIGALRM)) + itimer_restart(); } recalc_sigpending(); --- a/kernel/time/itimer.c +++ b/kernel/time/itimer.c @@ -150,6 +150,19 @@ COMPAT_SYSCALL_DEFINE2(getitimer, int, w } #endif +void itimer_restart(void) +{ + struct task_struct *tsk = current; + struct hrtimer *tmr = &tsk->signal->real_timer; + + lockdep_assert_task_sighand_held(current); + + if (!hrtimer_is_queued(tmr) && tsk->signal->it_real_incr != 0) { + hrtimer_forward_now(tmr, tsk->signal->it_real_incr); + hrtimer_restart(tmr); + } +} + /* * The timer is automagically restarted, when interval != 0 */
Powered by blists - more mailing lists