[pacman-dev] [PATCH 1/2] sighandler: block signals while handling SIGSEGV

Allan McRae allan at archlinux.org
Mon Aug 5 08:10:12 UTC 2019


On 8/6/19 2:12 pm, Andrew Gregory wrote:
> If we get SIGSEGV we need to bail out quickly, leaving other signals
> unblocked could lead to other signal handlers getting triggered.
> 
> Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
> ---
> 
> Signals are hard.  I'd appreciate if somebody could double check my
> math on these patches.
> 

This is good.

Allan

>  src/pacman/sighandler.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/pacman/sighandler.c b/src/pacman/sighandler.c
> index ebcdebae..a4849a0c 100644
> --- a/src/pacman/sighandler.c
> +++ b/src/pacman/sighandler.c
> @@ -96,7 +96,7 @@ void install_segv_handler(void)
>  {
>  	struct sigaction new_action;
>  	new_action.sa_handler = segv_handler;
> -	sigemptyset(&new_action.sa_mask);
> +	sigfillset(&new_action.sa_mask);
>  	new_action.sa_flags = SA_RESTART;
>  	sigaction(SIGSEGV, &new_action, NULL);
>  }
> 


More information about the pacman-dev mailing list