Better handling of sigset_t on LP32.
The main motivation here is that the sigprocmask in pthread_exit wasn't
actually blocking the real-time signals, and debuggerd (amongst other
things) is using them. I wasn't able to write a test that actually won
that race but I did write an equivalent one for posix_spawn.
This also fixes all the uses of sigset_t where the sigset_t isn't
exposed to the outside (which we can't easily fix because it would be
an ABI change).
Bug: https://issuetracker.google.com/72291624
Test: ran tests
Change-Id: Ib6eebebc5a7b0150079f1cb79593247917dcf750
diff --git a/libc/bionic/sigpause.cpp b/libc/bionic/sigpause.cpp
index 8ba42d4..6b5d74a 100644
--- a/libc/bionic/sigpause.cpp
+++ b/libc/bionic/sigpause.cpp
@@ -28,9 +28,12 @@
#include <signal.h>
+#include "private/kernel_sigset_t.h"
+
int sigpause(int sig) {
- sigset_t set;
- if (sigprocmask(SIG_SETMASK, nullptr, &set) == -1) return -1;
- if (sigdelset(&set, sig) == -1) return -1;
- return sigsuspend(&set);
+ kernel_sigset_t set;
+ set.clear();
+ if (__rt_sigprocmask(SIG_SETMASK, nullptr, &set, sizeof(set)) == -1) return -1;
+ if (!set.clear(sig)) return -1;
+ return __rt_sigsuspend(&set, sizeof(set));
}