Re: [patch v6 01/20] posix-timers: Make signal delivery consistent

From: Frederic Weisbecker
Date: Fri Nov 01 2024 - 08:26:56 EST


Le Thu, Oct 31, 2024 at 04:46:24PM +0100, Thomas Gleixner a écrit :
> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>
> Signals of timers which are reprogammed, disarmed or deleted can deliver
> signals related to the past. The POSIX spec 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."
>
> In both cases it is reasonable to expect that pending signals are
> discarded. Especially in the reprogramming case it does not make sense to
> account for previous overruns or to deliver a signal for a timer which has
> been disarmed. This makes the behaviour consistent and understandable.
>
> Remove the si_sys_private check from the signal delivery code and invoke
> posix_timer_deliver_signal() unconditionally for posix timer related
> signals.
>
> Change posix_timer_deliver_signal() so it controls the actual signal
> delivery via the return value. It now instructs the signal code to drop the
> signal when:
>
> 1) The timer does not longer exist in the hash table
>
> 2) The timer signal_seq value is not the same as the si_sys_private value
> which was set when the signal was queued.
>
> This is also a preparatory change to embed the sigqueue into the k_itimer
> structure, which in turn allows to remove the si_sys_private magic.
>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

Reviewed-by: Frederic Weisbecker <frederic@xxxxxxxxxx>