Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

posix-timers: Move sequence logic into struct k_itimer

The posix timer signal handling uses siginfo::si_sys_private for handling
the sequence counter check. That indirection is not longer required and the
sequence count value at signal queueing time can be stored in struct
k_itimer itself.

This removes the requirement of treating siginfo::si_sys_private special as
it's now always zero as the kernel does not touch it anymore.

Suggested-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Link: https://lore.kernel.org/all/20241105064213.852619866@linutronix.de

+7 -10
+2
include/linux/posix-timers.h
··· 162 162 * @it_overrun: The overrun counter for pending signals 163 163 * @it_overrun_last: The overrun at the time of the last delivered signal 164 164 * @it_signal_seq: Sequence count to control signal delivery 165 + * @it_sigqueue_seq: The sequence count at the point where the signal was queued 165 166 * @it_sigev_notify: The notify word of sigevent struct for signal delivery 166 167 * @it_interval: The interval for periodic timers 167 168 * @it_signal: Pointer to the creators signal struct ··· 185 184 s64 it_overrun; 186 185 s64 it_overrun_last; 187 186 unsigned int it_signal_seq; 187 + unsigned int it_sigqueue_seq; 188 188 int it_sigev_notify; 189 189 enum pid_type it_pid_type; 190 190 ktime_t it_interval;
+1 -1
include/uapi/asm-generic/siginfo.h
··· 46 46 __kernel_timer_t _tid; /* timer id */ 47 47 int _overrun; /* overrun count */ 48 48 sigval_t _sigval; /* same as below */ 49 - int _sys_private; /* not to be passed to user */ 49 + int _sys_private; /* Not used by the kernel. Historic leftover. Always 0. */ 50 50 } _timer; 51 51 52 52 /* POSIX.1b signals */
+3 -5
kernel/signal.c
··· 1976 1976 return -1; 1977 1977 1978 1978 /* 1979 - * Update @q::info::si_sys_private for posix timer signals with 1980 - * sighand locked to prevent a race against dequeue_signal() which 1981 - * decides based on si_sys_private whether to invoke 1982 - * posixtimer_rearm() or not. 1979 + * Update @tmr::sigqueue_seq for posix timer signals with sighand 1980 + * locked to prevent a race against dequeue_signal(). 1983 1981 */ 1984 - q->info.si_sys_private = tmr->it_signal_seq; 1982 + tmr->it_sigqueue_seq = tmr->it_signal_seq; 1985 1983 1986 1984 ret = 1; /* the signal is ignored */ 1987 1985 if (!prepare_signal(sig, t, false)) {
+1 -4
kernel/time/posix-timers.c
··· 259 259 * since the signal was queued. In either case, don't rearm and 260 260 * drop the signal. 261 261 */ 262 - if (timr->it_signal_seq != info->si_sys_private || WARN_ON_ONCE(!timr->it_signal)) 262 + if (timr->it_signal_seq != timr->it_sigqueue_seq || WARN_ON_ONCE(!timr->it_signal)) 263 263 return false; 264 264 265 265 if (!timr->it_interval || WARN_ON_ONCE(timr->it_status != POSIX_TIMER_REQUEUE_PENDING)) ··· 297 297 posixtimer_putref(timr); 298 298 299 299 spin_lock(&current->sighand->siglock); 300 - 301 - /* Don't expose the si_sys_private value to userspace */ 302 - info->si_sys_private = 0; 303 300 return ret; 304 301 } 305 302