diff options
author | Elliott Hughes <enh@google.com> | 2014-12-05 22:24:49 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-12-08 12:46:15 -0800 |
commit | 1c0c0ede573e3caf86b6fc395ba933bfb7235afa (patch) | |
tree | a5c72851a8f4548bc4a18f571c63ca11c4075394 /libc/arch-x86_64 | |
parent | 7d3a99b1bb06c3a261252680b4c3295cbcd77894 (diff) | |
download | bionic-1c0c0ede573e3caf86b6fc395ba933bfb7235afa.zip bionic-1c0c0ede573e3caf86b6fc395ba933bfb7235afa.tar.gz bionic-1c0c0ede573e3caf86b6fc395ba933bfb7235afa.tar.bz2 |
Fix signal mask save/restore for x86-64.
Bug: 16918359
Change-Id: I30bf61e7d5f1c21daa3a1a21d361e98d77220bf3
Diffstat (limited to 'libc/arch-x86_64')
-rw-r--r-- | libc/arch-x86_64/bionic/setjmp.S | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/libc/arch-x86_64/bionic/setjmp.S b/libc/arch-x86_64/bionic/setjmp.S index a8f614f..28981fa 100644 --- a/libc/arch-x86_64/bionic/setjmp.S +++ b/libc/arch-x86_64/bionic/setjmp.S @@ -48,6 +48,7 @@ #define _JB_PC 7 #define _JB_SIGFLAG 8 #define _JB_SIGMASK 9 +#define _JB_SIGMASK_RT 10 // sigprocmask will write here too. ENTRY(setjmp) movl $1,%esi @@ -62,18 +63,19 @@ END(_setjmp) // int sigsetjmp(sigjmp_buf env, int save_signal_mask); ENTRY(sigsetjmp) // Record whether or not we're saving the signal mask. - movl %esi,(_JB_SIGFLAG * 8)(%rdi) + movl %esi,(_JB_SIGFLAG * 8)(%rdi) // Do we need to save the signal mask? testl %esi,%esi jz 2f - // Save the signal mask. - pushq %rdi - xorq %rdi,%rdi - call PIC_PLT(sigblock) - popq %rdi - movq %rax,(_JB_SIGMASK * 8)(%rdi) + // Save current signal mask. + pushq %rdi // Push 'env'. + // The 'how' argument is ignored if new_mask is NULL. + xorq %rsi,%rsi // NULL. + leaq (_JB_SIGMASK * 8)(%rdi),%rdx // old_mask. + call PIC_PLT(sigprocmask) + popq %rdi // Pop 'env'. 2: // Save the callee-save registers. @@ -97,12 +99,14 @@ ENTRY(siglongjmp) pushq %rsi // Push 'value'. // Do we need to restore the signal mask? - cmpl $0, (_JB_SIGFLAG * 8)(%rdi) + cmpl $0,(_JB_SIGFLAG * 8)(%rdi) jz 2f // Restore the signal mask. - movq (_JB_SIGMASK * 8)(%rdi),%rdi - call PIC_PLT(sigsetmask) + movq $2,%rdi // SIG_SETMASK. + leaq (_JB_SIGMASK * 8)(%r12),%rsi // new_mask. + xorq %rdx,%rdx // NULL. + call PIC_PLT(sigprocmask) 2: popq %rax // Pop 'value'. |