History

Merge tag 'timers_urgent_for_v6.13_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Borislav Petkov: - Fix a case where posix timers with a thread-group-wide target would miss signals if some of the group's threads are exiting - Fix a hang caused by ndelay() calling the wrong delay function __udelay() - Fix a wrong offset calculation in adjtimex(2) when using ADJ_MICRO (microsecond resolution) and a negative offset * tag 'timers_urgent_for_v6.13_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: posix-timers: Target group sigqueue to current task only if not exiting delay: Fix ndelay() spuriously treated as udelay() ntp: Remove invalid cast in time offset math

Linus Torvalds committed 1 year ago

Commit f788b5e2 parents 63f4993 63dffec3 files · +7 −6Browse files

Showing the changes to kernel (2 of 3 files). Show all

Unified · Split

2 files
  1. kernel/signal.c +4 −3
  2. kernel/time/ntp.c +1 −1
kernel/signal.c+4−3
@@ -1959,14 +1959,15 @@ static void posixtimer_queue_sigqueue(struct sigqueue *q, struct task_struct *t, · 1958 unmodified lines
19591959 *
19601960 * Where type is not PIDTYPE_PID, signals must be delivered to the
19611961 * process. In this case, prefer to deliver to current if it is in
1962− * the same thread group as the target process, which avoids
1963− * unnecessarily waking up a potentially idle task.
1962+ * the same thread group as the target process and its sighand is
1963+ * stable, which avoids unnecessarily waking up a potentially idle task.
19641964 */
19651965 static inline struct task_struct *posixtimer_get_target(struct k_itimer *tmr)
19661966 {
19671967 struct task_struct *t = pid_task(tmr->it_pid, tmr->it_pid_type);
19681968
1969− if (t && tmr->it_pid_type != PIDTYPE_PID && same_thread_group(t, current))
1969+ if (t && tmr->it_pid_type != PIDTYPE_PID &&
1970+ same_thread_group(t, current) && !current->exit_state)
19701971 t = current;
19711972 return t;
19721973 }
kernel/time/ntp.c+1−1
@@ -798,7 +798,7 @@ int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts, · 797 unmodified lines
798798
799799 txc->offset = shift_right(ntpdata->time_offset * NTP_INTERVAL_FREQ, NTP_SCALE_SHIFT);
800800 if (!(ntpdata->time_status & STA_NANO))
801− txc->offset = (u32)txc->offset / NSEC_PER_USEC;
801+ txc->offset = div_s64(txc->offset, NSEC_PER_USEC);
802802 }
803803
804804 result = ntpdata->time_state;