Work around Rosetta signal handling issue (#455)

Rosetta does something strange to the signal handling registers but setting SA_SIGINFO prevents the issue from happening. Set the flag on XNU to work around the issue.
This commit is contained in:
Daniil Kulchenko 2022-08-19 10:10:59 -07:00
parent 1ce101c5a5
commit 366dcbde02

View file

@ -183,6 +183,10 @@ static int __sigaction(int sig, const struct sigaction *act,
if (IsXnu()) {
ap->sa_restorer = (void *)&__sigenter_xnu;
ap->sa_handler = (void *)&__sigenter_xnu;
// mitigate Rosetta signal handling strangeness
// https://github.com/jart/cosmopolitan/issues/455
ap->sa_flags |= SA_SIGINFO;
} else if (IsLinux()) {
if (!(ap->sa_flags & SA_RESTORER)) {
ap->sa_flags |= SA_RESTORER;