diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-06-20 20:43:51 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-06-20 20:43:51 +0000 |
commit | 225bd7cd8384599c608dc284091a472e37b0c0c3 (patch) | |
tree | aad918e8b4d5d27d42a59417a9d71cf7585b07e1 /lib | |
parent | 9abc188cf05055f7d19ce2955498a9bd223cff97 (diff) |
We need to store the flagged passed to sigsetjmp(3) and use it in
siglongjmp(3) to decide wehther we need to restore the signal mask.
ok deraadt@, drahn@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/riscv64/gen/sigsetjmp.S | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/libc/arch/riscv64/gen/sigsetjmp.S b/lib/libc/arch/riscv64/gen/sigsetjmp.S index 74e4c390a00..c003ed53b29 100644 --- a/lib/libc/arch/riscv64/gen/sigsetjmp.S +++ b/lib/libc/arch/riscv64/gen/sigsetjmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsetjmp.S,v 1.3 2021/05/17 15:06:09 deraadt Exp $ */ +/* $OpenBSD: sigsetjmp.S,v 1.4 2021/06/20 20:43:50 kettenis Exp $ */ /* * Copyright (c) 2020 Dale Rahn <drahn@openbsd.org> * @@ -21,15 +21,14 @@ ENTRY(sigsetjmp) RETGUARD_SETUP(setjmp, t6) mv a2, a0 /* save jmpbuf in a2 */ - li a0, 0 + sw a1, (0 * 8)(a2) beqz a1, 1f /* Store the signal mask */ - li a1, 0 li a0, 1 /* SIG_BLOCK */ + li a1, 0 SYSTRAP(sigprocmask) -1: sw a0, (_JB_SIGMASK * 8)(a2) /* oset */ - +1: mv a0, a2 sd sp, (1 * 8)(a0) @@ -76,12 +75,12 @@ ENTRY(siglongjmp) RETGUARD_LOAD_RANDOM(longjmp, t6) mv a2, a0 /* move jmpbuf */ mv a3, a1 /* final return value */ - - /* Restore the signal mask */ - lw a1, (_JB_SIGMASK * 8)(a2) /* set */ + lw a1, (0 * 8)(a2) beqz a1, 1f + /* Restore the signal mask */ li a0, 3 /* SIG_SETMASK */ + lw a1, (_JB_SIGMASK * 8)(a2) /* set */ SYSTRAP(sigprocmask) 1: |