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
Showing the changes to kernel (2 of 3 files). Show all
Unified · Split
| @@ -1959,14 +1959,15 @@ static void posixtimer_queue_sigqueue(struct sigqueue *q, struct task_struct *t, · 1958 unmodified lines | ||
| 1959 | 1959 | * |
| 1960 | 1960 | * Where type is not PIDTYPE_PID, signals must be delivered to the |
| 1961 | 1961 | * 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. | |
| 1964 | 1964 | */ |
| 1965 | 1965 | static inline struct task_struct *posixtimer_get_target(struct k_itimer *tmr) |
| 1966 | 1966 | { |
| 1967 | 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 | 1971 | t = current; |
| 1971 | 1972 | return t; |
| 1972 | 1973 | } |
| @@ -798,7 +798,7 @@ int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts, · 797 unmodified lines | ||
| 798 | 798 | |
| 799 | 799 | txc->offset = shift_right(ntpdata->time_offset * NTP_INTERVAL_FREQ, NTP_SCALE_SHIFT); |
| 800 | 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 | 804 | result = ntpdata->time_state; |