summaryrefslogtreecommitdiff
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2024-10-01 10:42:04 +0200
committerThomas Gleixner <tglx@linutronix.de>2024-10-29 11:43:19 +0100
commitc775ea28d4e23f5e58b6953645ef90c1b27a8e83 (patch)
treef580b74b9254faf6dfda1e266ba54a81cfd5b7c9 /kernel/signal.c
parent4febce44cfebcb490b196d5d10ae9f403ca4c956 (diff)
signal: Allow POSIX timer signals to be dropped
In case that a timer was reprogrammed or deleted an already pending signal is obsolete. Right now such signals are kept around and eventually delivered. While POSIX is blury about this: - "The effect of disarming or resetting a timer with pending expiration notifications is unspecified." - "The disposition of pending signals for the deleted timer is unspecified." it is reasonable in both cases to expect that pending signals are discarded as they have no meaning anymore. Prepare the signal code to allow dropping posix timer signals. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/all/20241001083835.494416923@linutronix.de
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 1563c83ff224..df34aa47181e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -594,6 +594,7 @@ int dequeue_signal(sigset_t *mask, kernel_siginfo_t *info, enum pid_type *type)
lockdep_assert_held(&tsk->sighand->siglock);
+again:
*type = PIDTYPE_PID;
signr = __dequeue_signal(&tsk->pending, mask, info, &resched_timer);
if (!signr) {
@@ -625,9 +626,9 @@ int dequeue_signal(sigset_t *mask, kernel_siginfo_t *info, enum pid_type *type)
current->jobctl |= JOBCTL_STOP_DEQUEUED;
}
- if (IS_ENABLED(CONFIG_POSIX_TIMERS)) {
- if (unlikely(resched_timer))
- posixtimer_rearm(info);
+ if (IS_ENABLED(CONFIG_POSIX_TIMERS) && unlikely(resched_timer)) {
+ if (!posixtimer_deliver_signal(info))
+ goto again;
}
return signr;