• Thomas Gleixner's avatar
    selftests/timers/posix_timers: Add SIG_IGN test · 45c4225c
    Thomas Gleixner authored
    Add a test case to validate correct behaviour vs. SIG_IGN.
    
    The posix specification states:
    
      "Setting a signal action to SIG_IGN for a signal that is pending shall
       cause the pending signal to be discarded, whether or not it is blocked."
    
    The kernel implements this in the signal handling code, but due to the way
    how posix timers are handling SIG_IGN for periodic timers, the behaviour
    after installing a real handler again is inconsistent and suprising.
    
    The following sequence is expected to deliver a signal:
    
      install_handler(SIG);
      block_signal(SIG);
      timer_create(...);	 <- Should send SIG
      timer_settime(value=100ms, interval=100ms);
      sleep(1);		 <- Timer expires and queues signal, timer is not rearmed
      			    as that should happen in the signal delivery path
      ignore_signal(SIG);	 <- Discards queued signal
      install_handler(SIG);  <- Restore handler, should rearm but does not
      sleep(1);
      unblock_signal(SIG);	 <- Should deliver one signal with overrun count
      			    set in siginfo
    
    This fails because nothing rearms the timer when the signal handler is
    restored. Add a test for this case which fails until the signal and posix
    timer code is fixed.
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarFrederic Weisbecker <frederic@kernel.org>
    45c4225c
posix_timers.c 8.29 KB