Fix sigsetjmp/siglongjmp to save/restore RT signals on arm/x86 too.
Our arm and x86 ABIs shipped with a 32-bit `sigset_t`, so we need to
use sigprocmask64 to save/restore the RT signals too. (This is important
because several are in use by the system, and the behavior of our 32-bit
`sigset_t` is to clear the RT signals.)
Bug: http://b/72493232
Test: ran tests
Change-Id: Idff91f8b2849276e5a3073d07eccd84e02a34410
diff --git a/libc/arch-arm/bionic/setjmp.S b/libc/arch-arm/bionic/setjmp.S
index c10bd3e..30e7e23 100644
--- a/libc/arch-arm/bionic/setjmp.S
+++ b/libc/arch-arm/bionic/setjmp.S
@@ -56,12 +56,14 @@
//
// word name description
// 0 sigflag/cookie setjmp cookie in top 31 bits, signal mask flag in low bit
-// 1 sigmask signal mask (not used with _setjmp / _longjmp)
-// 2 float_base base of float registers (d8 to d15)
-// 18 float_state floating-point status and control register
-// 19 core_base base of core registers (r4-r11, r13-r14)
-// 29 checksum checksum of all of the core registers, to give better error messages.
-// 30 reserved reserved entries (room to grow)
+// 1 sigmask 64-bit signal mask (not used with _setjmp / _longjmp)
+// 2 " "
+// 3 reserved (unused to allow float_base to be maximally aligned)
+// 4 float_base base of float registers (d8 to d15)
+// 20 float_state floating-point status and control register
+// 21 core_base base of core registers (r4-r11, r13-r14)
+// 31 checksum checksum of all of the core registers, to give better error messages.
+// 32 reserved reserved entries (room to grow)
// 64
//
// NOTE: float_base must be at an even word index, since the
@@ -69,8 +71,8 @@
// that expect 8-byte alignment.
#define _JB_SIGFLAG 0
-#define _JB_SIGMASK (_JB_SIGFLAG+1)
-#define _JB_FLOAT_BASE (_JB_SIGMASK+1)
+#define _JB_SIGMASK (_JB_SIGFLAG + 1)
+#define _JB_FLOAT_BASE (_JB_SIGMASK + 3)
#define _JB_FLOAT_STATE (_JB_FLOAT_BASE + (15-8+1)*2)
#define _JB_CORE_BASE (_JB_FLOAT_STATE+1)
#define _JB_CHECKSUM (_JB_CORE_BASE+10)
@@ -151,7 +153,7 @@
add r2, r0, #(_JB_SIGMASK * 4)
mov r0, #2 // SIG_SETMASK
mov r1, #0
- bl sigprocmask
+ bl sigprocmask64
// Unalign the stack.
add sp, #4
@@ -221,7 +223,7 @@
mov r2, #0
add r1, r0, #(_JB_SIGMASK * 4)
mov r0, #2 // SIG_SETMASK
- bl sigprocmask
+ bl sigprocmask64
1:
ldmfd sp!, {r0, r1, lr}