Delete lies from x86_64 setjmp implementation.

Previously, the implementation of setjmp on x86_64 claimed that
sigprocmask would write to two longs' worth of bytes.

Bug: http://b/27856501
Change-Id: I9f32b40ac773a0cd91a976aace5bfba6e67fb0f8
This commit is contained in:
Josh Gao 2016-03-29 14:34:03 -07:00
parent 9260785393
commit c244fcb8a3
2 changed files with 26 additions and 3 deletions

View file

@ -35,8 +35,22 @@
#include <private/bionic_asm.h>
// These are only the callee-saved registers. Code calling setjmp
// will expect the rest to be clobbered anyway.
// The internal structure of a jmp_buf is totally private.
// Current layout (changes from release to release):
//
// word name description
// 0 rbx registers
// 1 rbp
// 2 r12
// 3 r13
// 4 r14
// 5 r15
// 6 rsp
// 7 pc
// 8 sigflag/cookie setjmp cookie in top 31 bits, signal mask flag in low bit
// 9 sigmask signal mask (includes rt signals as well)
// 10 reserved
#define _JB_RBX 0
#define _JB_RBP 1
@ -48,7 +62,6 @@
#define _JB_PC 7
#define _JB_SIGFLAG 8
#define _JB_SIGMASK 9
#define _JB_SIGMASK_RT 10 // sigprocmask will write here too.
#define MANGLE_REGISTERS 1
.macro m_mangle_registers reg

View file

@ -411,4 +411,14 @@ TEST(signal, rt_tgsigqueueinfo) {
<< sent.si_code << ", received " << received.si_code
<< error_msg;
}
#if defined(__arm__) || defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
TEST(signal, sigset_size) {
// The setjmp implementations for ARM, AArch64, x86, and x86_64 assume that sigset_t can fit in a
// long. This is true because ARM and x86 have broken rt signal support, and AArch64 and x86_64
// both have a SIGRTMAX defined as 64.
static_assert(sizeof(sigset_t) <= sizeof(long), "sigset_t doesn't fit in a long");
}
#endif
#endif