@vogel76 suggests the following:
I think initialization shall be done as follows:
struct sigaction sigact = {0};
sigset_t block_mask = {0};
sigemptyset (&block_mask);
sigact.sa_sigaction = segfault_handler;
sigact.sa_flags = SA_RESTART | SA_SIGINFO;
sigact.sa_mask = block_mask;
Valgrind complains about sa_mask field, and I think it is dangerous to leave trash there. Also I am not sure if inside this handler SIGINT shall be blocked to avoid spawning standard break handler during execution of SIGSEGV