Re: [hackers] [dwm][PATCH] do not call signal-unsafe function inside sighanlder

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Fri, 22 Jul 2022 17:20:23 +0200

Hi,

> > Do you have a reference of a description of this behaviour in an other system,
> > specification or standard?
> >
>
> C89 (7.7.1.1), C99 (7.14.1.1), POSIX 2001 and 2008 all say that "the
> equivalent of signal(sig, SIG_DFL)" may be executed prior to executing
> the signal handler (but is not required as long as the signal is blocked
> until the handler has returned).
>
> As for implementations, my signal(2) man page says BSD and glibc systems
> do not reset the handler, but the linux syscall does, as well as
> "original UNIX systems" and System V. I've no idea what other libcs do.
>

Yes, this is the problem with signal(3) and why the sigaction(2) interface
was designed (they didn't want to enforce bsd or systemV, and they just created
a new (and more complex) interface. If you use signal() you cannot assume any
behaviour. Also, notice that the bsd behaviour broke alarm() because system
calls are always restarted instead of generating EINTR.


Regards,
Received on Fri Jul 22 2022 - 17:20:23 CEST

This archive was generated by hypermail 2.3.0 : Fri Jul 22 2022 - 18:24:29 CEST