summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-05-29 22:39:21 +0000
committerguenther <guenther@openbsd.org>2016-05-29 22:39:21 +0000
commit747916cc0b0dad1fb1857f01f7e2a17363db526d (patch)
treead6f1f09548ddd6af1d29ff95fe9a6b036b7138f
parentWrap <machine/sysarch.h> to prevent overriding internal calls, for (diff)
downloadwireguard-openbsd-747916cc0b0dad1fb1857f01f7e2a17363db526d.tar.xz
wireguard-openbsd-747916cc0b0dad1fb1857f01f7e2a17363db526d.zip
Switch from calling obsolete sig{block,setmask} to directly using the
sigprocmask syscall ok kettenis@
-rw-r--r--lib/libc/arch/amd64/gen/setjmp.S24
-rw-r--r--lib/libc/arch/amd64/gen/sigsetjmp.S24
2 files changed, 27 insertions, 21 deletions
diff --git a/lib/libc/arch/amd64/gen/setjmp.S b/lib/libc/arch/amd64/gen/setjmp.S
index ecc41dba63f..751471216ee 100644
--- a/lib/libc/arch/amd64/gen/setjmp.S
+++ b/lib/libc/arch/amd64/gen/setjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: setjmp.S,v 1.6 2016/05/12 15:46:03 deraadt Exp $ */
+/* $OpenBSD: setjmp.S,v 1.7 2016/05/29 22:39:21 guenther Exp $ */
/* $NetBSD: __setjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */
/*
@@ -37,7 +37,7 @@
*/
-#include <machine/asm.h>
+#include "SYS.h"
#include <machine/setjmp.h>
.section .openbsd.randomdata,"aw",@progbits
@@ -59,10 +59,12 @@ __jmpxor:
*/
ENTRY(setjmp)
- pushq %rdi
- xorq %rdi,%rdi
- call _C_LABEL(_libc_sigblock)
- popq %rdi
+ movq %rdi,%r8 /* save jmpbuf addr */
+ movl $1,%edi /* how = SIG_BLOCK */
+ xorl %esi,%esi /* set = empty */
+ movl $SYS_sigprocmask,%eax
+ syscall
+ movq %r8,%rdi /* restore jmpbuf addr */
movq %rax,(_JB_SIGMASK * 8)(%rdi)
movq (%rsp),%r11
@@ -91,10 +93,11 @@ ENTRY(longjmp)
movq %rdi,%r12
movl %esi,%r8d
- movq (_JB_SIGMASK * 8)(%rdi),%rdi
- pushq %r8
- call _C_LABEL(_libc_sigsetmask)
- popq %r8
+ movq (_JB_SIGMASK * 8)(%rdi),%rsi /* get set from sc_mask */
+ movl $3,%edi /* how = SIG_SETMASK */
+ movl $SYS_sigprocmask,%eax
+ syscall
+ movl %r8d,%eax
leaq __jmpxor(%rip),%rcx
movq (_JB_RBX * 8)(%r12),%rbx
@@ -112,7 +115,6 @@ ENTRY(longjmp)
movq (_JB_R12 * 8)(%r12),%r12
xorq %rcx,%rcx
- movl %r8d,%eax
testl %eax,%eax
jnz 1f
incl %eax
diff --git a/lib/libc/arch/amd64/gen/sigsetjmp.S b/lib/libc/arch/amd64/gen/sigsetjmp.S
index 3983af0c0f9..ecce6204b26 100644
--- a/lib/libc/arch/amd64/gen/sigsetjmp.S
+++ b/lib/libc/arch/amd64/gen/sigsetjmp.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigsetjmp.S,v 1.6 2016/05/12 15:46:03 deraadt Exp $ */
+/* $OpenBSD: sigsetjmp.S,v 1.7 2016/05/29 22:39:21 guenther Exp $ */
/* $NetBSD: __setjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */
/*
@@ -37,7 +37,7 @@
*/
-#include <machine/asm.h>
+#include "SYS.h"
#include <machine/setjmp.h>
.hidden __jmpxor
@@ -57,10 +57,12 @@ ENTRY(sigsetjmp)
testl %esi,%esi
jz 2f
- pushq %rdi
- xorq %rdi,%rdi
- call _C_LABEL(_libc_sigblock)
- popq %rdi
+ movq %rdi,%r8 /* save jmpbuf addr */
+ movl $1,%edi /* how = SIG_BLOCK */
+ xorl %esi,%esi /* set = empty */
+ movl $SYS_sigprocmask,%eax
+ syscall
+ movq %r8,%rdi /* restore jmpbuf addr */
movq %rax,(_JB_SIGMASK * 8)(%rdi)
2: movq (%rsp),%r11
@@ -87,13 +89,15 @@ END(sigsetjmp)
ENTRY(siglongjmp)
movq %rdi,%r12
- pushq %rsi
+ movl %esi,%r8d
cmpl $0, (_JB_SIGFLAG * 8)(%rdi)
jz 2f
- movq (_JB_SIGMASK * 8)(%rdi),%rdi
- call _C_LABEL(_libc_sigsetmask)
-2: popq %rax
+ movq (_JB_SIGMASK * 8)(%rdi),%rsi /* get set from sc_mask */
+ movl $3,%edi /* how = SIG_SETMASK */
+ movl $SYS_sigprocmask,%eax
+ syscall
+2: movl %r8d,%eax
leaq __jmpxor(%rip),%rcx
movq (_JB_RBX * 8)(%r12),%rbx