|
From: Paul F. <pa...@so...> - 2025-11-28 21:51:31
|
https://sourceware.org/cgit/valgrind/commit/?id=5d68d627f1d8ced4973ff9e138a1ec06922446e2 commit 5d68d627f1d8ced4973ff9e138a1ec06922446e2 Author: Paul Floyd <pj...@wa...> Date: Fri Nov 28 22:49:25 2025 +0100 Darwin: update signal tramp, helgrind and drd suppressions Change a couple of testcase asserts to match Darwin quirks. Signal tramp from Louis Brunner Diff: --- coregrind/m_libcsignal.c | 26 ++++++++++++++++++-------- darwin17.supp | 19 +++++++++++++++++++ helgrind/tests/tc12_rwl_trivial.c | 2 +- helgrind/tests/tc23_bogus_condwait.c | 5 ++++- include/vki/vki-darwin.h | 3 +++ 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/coregrind/m_libcsignal.c b/coregrind/m_libcsignal.c index d8563a4d02..d28b0b9b21 100644 --- a/coregrind/m_libcsignal.c +++ b/coregrind/m_libcsignal.c @@ -240,19 +240,29 @@ Int VG_(sigprocmask)( Int how, const vki_sigset_t* set, vki_sigset_t* oldset) #if defined(VGO_darwin) /* A helper function for sigaction on Darwin. */ -static -void darwin_signal_demux(void* a1, UWord a2, UWord a3, void* a4, void* a5) { +static +void darwin_signal_demux(void* catcher, UWord infostyle, UWord sig, void* sinfo, void* uctx +# if defined(VGA_arm64) +, void* token +# endif +) { VG_(debugLog)(2, "libcsignal", - "PRE demux sig, a2 = %lu, signo = %lu\n", a2, a3); - if (a2 == 1) - ((void(*)(int))a1) (a3); + "PRE demux sig, infostyle = %s, signo = %lu\n", infostyle == VKI_UC_TRAD ? "TRAD" : "FLAVOR", sig); + if (infostyle == VKI_UC_TRAD) + ((void(*)(int))catcher) (sig); else - ((void(*)(int,void*,void*))a1) (a3,a4,a5); + ((void(*)(int,void*,void*))catcher) (sig, sinfo, uctx); VG_(debugLog)(2, "libcsignal", - "POST demux sig, a2 = %lu, signo = %lu\n", a2, a3); - VG_(do_syscall2)(__NR_sigreturn, (UWord)a5, 0x1E); + "POST demux sig, infostyle = %s, signo = %lu\n", infostyle == VKI_UC_TRAD ? "TRAD" : "FLAVOR", sig); +# if defined(VGA_arm64) + VG_(do_syscall3)(__NR_sigreturn, (UWord)uctx, VKI_UC_FLAVOR, (UWord)token); + /* NOTREACHED */ + __asm__ __volatile__("udf #0"); +# else + VG_(do_syscall2)(__NR_sigreturn, (UWord)uctx, VKI_UC_FLAVOR); /* NOTREACHED */ __asm__ __volatile__("ud2"); +# endif } #endif diff --git a/darwin17.supp b/darwin17.supp index 6966f101cd..528a9f139a 100644 --- a/darwin17.supp +++ b/darwin17.supp @@ -866,6 +866,13 @@ fun:dispatch_once_f } +{ + OSX1013:helgrind:nanosleep + Helgrind:Race + ... + fun:nanosleep +} + { OSX1013:drd:nanosleep drd:ConflictingAccess @@ -1009,6 +1016,18 @@ fun:gomp_barrier_wait } +{ + OSX1013:helgrind:_os_unfair_lock_lock_slow + Helgrind:Race + fun:_os_unfair_lock_lock_slow +} + +{ + OSX1013:helgrind:sem_trywait + Helgrind:Race + fun:sem_trywait +} + { OSX1013:drd:object_dispose drd:ConflictingAccess diff --git a/helgrind/tests/tc12_rwl_trivial.c b/helgrind/tests/tc12_rwl_trivial.c index 35702ebb09..24f312c663 100644 --- a/helgrind/tests/tc12_rwl_trivial.c +++ b/helgrind/tests/tc12_rwl_trivial.c @@ -27,7 +27,7 @@ int main ( void ) /* this should fail - lock is unowned now */ r = pthread_rwlock_unlock( &rwl ); -#if defined(VGO_darwin) || defined(VGO_solaris) || defined(VGO_freebsd) +#if defined(VGO_solaris) || defined(VGO_freebsd) assert(r != 0); #else assert(r == 0); diff --git a/helgrind/tests/tc23_bogus_condwait.c b/helgrind/tests/tc23_bogus_condwait.c index f2ccf3517f..b106748179 100644 --- a/helgrind/tests/tc23_bogus_condwait.c +++ b/helgrind/tests/tc23_bogus_condwait.c @@ -90,7 +90,10 @@ int main ( void ) r= pthread_join( my_rescuer, NULL ); assert(!r); r= pthread_join( grabber, NULL ); assert(!r); - r= my_sem_destroy( quit_now ); assert(!r); + r= my_sem_destroy( quit_now ); +#if !defined(VGO_darwin) + assert(!r); +#endif return 0; } diff --git a/include/vki/vki-darwin.h b/include/vki/vki-darwin.h index 5cffcd1b64..d7fb765eda 100644 --- a/include/vki/vki-darwin.h +++ b/include/vki/vki-darwin.h @@ -526,6 +526,9 @@ typedef struct { //typedef struct __sigaction vki_sigaction_toK_t; //typedef struct sigaction vki_sigaction_fromK_t; +#define VKI_UC_TRAD 1 +#define VKI_UC_FLAVOR 30 + typedef struct { void* ksa_handler; |