A signal is a mechanism for transferring control, that is typically used to notify a process that an event has occurred. That process can then respond to that event accordingly. C99 provides functions for sending and handling signals within a C program.
Signals are handled by a process by registering a signal handler using the signal() function, which is specified as:
| Code Block |
|---|
void (*signal(int sig, void (*func)(int)))(int);
|
This is conceptually equivalent to
| Code Block |
|---|
typedef void (*SighandlerType)(int signum);
extern SighandlerType signal(int signum, SighandlerType handler);
|
Improper handling of signals can lead to security vulnerabilities. The following rules and recommendations are meant to eliminate common errors associated with signal handling.
Recommendations
SIG00-A. Mask signals handled by non-interruptible signal handlers
...