[libvirt] [PATCH v3] util: Block SIGPIPE until execve in childprocess

wang.yechao255 at zte.com.cn wang.yechao255 at zte.com.cn
Thu Oct 17 10:53:06 UTC 2019


> The fork'd child process inherits all signal handlers from the parent.
> These handlers may no longer be valid since we are mass-closing all
> file descriptors. We thus need to kill off all the signal handlers
> in the forkd child.
>
> There's a window between fork & sigaction where signals can still
> get delivered to the child & run the undesirable handlers. So we must
> mask all signals immediately before fork, only unmasking them after
> we have set all signal handlers back to their defaults.
>
> We just need to set SIGPIPE to a dummy no-op handler before this
> unmask

If do that, i think the SIGPIPE ignored code before running hooks in virExec()
can be removed.

---
Best wishes
Wang Yechao


More information about the libvir-list mailing list