[RFC][possible bug] when should SS_AUTODISARM have effect?

From: Al Viro
Date: Wed Mar 18 2020 - 22:16:37 EST


Consider the following scenario: SIGPIPE has SA_ONSTACK
handler, SIGSEGV - non-SA_ONSTACK one. SIGPIPE is delivered
and we fail halfway through setting a sigframe for it.
OK, we get SIGSEGV forced in, which gets handled not on altstack.
But what should happen if we fail *after* having saved the
altstack settings into the sigframe that got abandoned?

AFAICS, we get them reset and the original setting
entirely lost. Shouldn't that thing be applied only after
we have succeeded in building the frame? In signal_delivered(),
perhaps...

I realize that this is out of scope for POSIX, so it's
not a matter of standard compliance, but it looks like a bit
of a QoI issue...