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

Unified · Split

3 files
  1. include/asm-generic/delay.h +2 −2
  2. kernel/signal.c +4 −3
  3. kernel/time/ntp.c +1 −1
include/asm-generic/delay.h+2−2
@@ -75,11 +75,11 @@ static __always_inline void ndelay(unsigned long nsec) · 74 unmodified lines
75{75{
76 if (__builtin_constant_p(nsec)) {76 if (__builtin_constant_p(nsec)) {
77 if (nsec >= DELAY_CONST_MAX)77 if (nsec >= DELAY_CONST_MAX)
78 __bad_udelay();78 __bad_ndelay();
79 else79 else
80 __const_udelay(nsec * NDELAY_CONST_MULT);80 __const_udelay(nsec * NDELAY_CONST_MULT);
81 } else {81 } else {
82 __udelay(nsec);82 __ndelay(nsec);
83 }83 }
84}84}
85#define ndelay(x) ndelay(x)85#define ndelay(x) ndelay(x)
kernel/signal.c+4−3
@@ -1959,14 +1959,15 @@ static void posixtimer_queue_sigqueue(struct sigqueue *q, struct task_struct *t, · 1958 unmodified lines
1959 *1959 *
1960 * Where type is not PIDTYPE_PID, signals must be delivered to the1960 * Where type is not PIDTYPE_PID, signals must be delivered to the
1961 * process. In this case, prefer to deliver to current if it is in1961 * process. In this case, prefer to deliver to current if it is in
1962 * the same thread group as the target process, which avoids1962 * the same thread group as the target process and its sighand is
1963 * unnecessarily waking up a potentially idle task.1963 * stable, which avoids unnecessarily waking up a potentially idle task.
1964 */1964 */
1965static inline struct task_struct *posixtimer_get_target(struct k_itimer *tmr)1965static inline struct task_struct *posixtimer_get_target(struct k_itimer *tmr)
1966{1966{
1967 struct task_struct *t = pid_task(tmr->it_pid, tmr->it_pid_type);1967 struct task_struct *t = pid_task(tmr->it_pid, tmr->it_pid_type);
1968 1968
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)
1970 t = current;1971 t = current;
1971 return t;1972 return t;
1972}1973}
kernel/time/ntp.c+1−1
@@ -798,7 +798,7 @@ int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts, · 797 unmodified lines
798 798
799 txc->offset = shift_right(ntpdata->time_offset * NTP_INTERVAL_FREQ, NTP_SCALE_SHIFT);799 txc->offset = shift_right(ntpdata->time_offset * NTP_INTERVAL_FREQ, NTP_SCALE_SHIFT);
800 if (!(ntpdata->time_status & STA_NANO))800 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);
802 }802 }
803 803
804 result = ntpdata->time_state;804 result = ntpdata->time_state;