From: Paul Floyd Date: Mon, 10 Nov 2025 21:15:51 +0000 (+0100) Subject: Darwin syscall: fix signal masks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2da8f5e4d9306de608d8d15b3354b56e07f09de4;p=thirdparty%2Fvalgrind.git Darwin syscall: fix signal masks Merged From Louis Brunner's git repo. Fixes a few more regtest failures with OSX 10.13 amd64. --- diff --git a/coregrind/m_syswrap/syscall-amd64-darwin.S b/coregrind/m_syswrap/syscall-amd64-darwin.S index 456b4c84c..fbc81ff5d 100644 --- a/coregrind/m_syswrap/syscall-amd64-darwin.S +++ b/coregrind/m_syswrap/syscall-amd64-darwin.S @@ -99,18 +99,13 @@ L_$0_1: /* Even though we can't take a signal until the sigprocmask completes, If rip is in the range [1,2), the syscall hasn't been started yet */ /* Set the signal mask which should be current during the syscall. */ - /* GrP fixme signals - DDD: JRS fixme: use __NR___pthread_sigmask, not __NR_rt_sigprocmask - movq $__NR_rt_sigprocmask, %rax // syscall # - movq $VKI_SIG_SETMASK, %rdi // how + movq $$__NR___pthread_sigmask, %rax // syscall # + movq $$VKI_SIG_SETMASK, %rdi // how movq -24(%rbp), %rsi // sysmask movq -32(%rbp), %rdx // postmask - movq -40(%rbp), %r10 // sigsetSzB in r10 not rcx - DDD: fixme return address syscall - jnc 7f // sigprocmask failed - */ + jc L_$0_7 // sigprocmask failed /* OK, that worked. Now do the syscall proper. */ @@ -156,35 +151,26 @@ L_$0_3: /* In the range [3, 4), the syscall result is in %rax, L_$0_4: /* Re-block signals. If eip is in [4,5), then the syscall is complete and we needn't worry about it. */ - /* GrP fixme signals - DDD: JRS fixme: use __NR___pthread_sigmask, not __NR_rt_sigprocmask - PUSH_di_si_dx_cx_8 - - movq $__NR_rt_sigprocmask, %rax // syscall # - movq $VKI_SIG_SETMASK, %rdi // how - movq %rcx, %rsi // postmask + movq $$__NR___pthread_sigmask, %rax // syscall # + movq $$VKI_SIG_SETMASK, %rdi // how + movq -32(%rbp), %rsi // postmask xorq %rdx, %rdx // NULL - movq %r8, %r10 // sigsetSzB - DDD: fixme return address syscall - POP_di_si_dx_cx_8 + jc L_$0_7 // sigprocmask failed - jnc 7f // sigprocmask failed - */ L_$0_5: /* now safe from signals */ movq $$0, %rax /* SUCCESS */ movq %rbp, %rsp popq %rbp ret -/* GrP fixme signals L_$0_7: // failure: return 0x8000 | error code - DDD: fixme return value + andq $$0x7FFF, %rax + orq $$0x8000, %rax movq %rbp, %rsp popq %rbp ret -*/ .endmacro