On Tue, Oct 15, 2019 at 09:59:46PM -0500, Eric Blake wrote:
On 10/15/19 9:43 PM, Eric Blake wrote:
> On 10/15/19 9:25 PM, Wang Yechao wrote:
> > Libvirtd has set SIGPIPE to ignored, and virFork resets all signal
> > handlers to the defaults. But child process may write logs to
> > stderr/stdout, that may generate SIGPIPE if journald has stopped.
> >
> > So block SIGPIPE in virFork, and unblock it before execve.
>
> How does that help? If writing to stderr hits EOF, it will queue up a
> SIGPIPE to be delivered as soon as you unblock SIGPIPE.
>
> The correct fix is to not unblock SIGPIPE until after any point at which
> you would be performing I/O that must not fail due to SIGPIPE, rather
> than messing with signal masks to just delay when SIGPIPE is delivered.
Let's word this better:
The correct fix is to keep SIGPIPE ignored until after any point at which
you would be performing I/O that must not cause SIGPIPE, reverting SIGPIPE
back to SIG_DFL at the last possible moment. Messing with signal masks
merely delays when SIGPIPE is delivered, rather than avoiding it.
The challenge here is that we're in between fork + execve and want signal
handlers back to their defaults at time of execve.
If we set SIGPIPE to SIG_IGN and then execve() will that get reset back
to SIG_DFL automatically ?
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|