From: Paul Floyd Date: Tue, 23 Nov 2021 20:58:45 +0000 (+0100) Subject: Disable auxv PAGESIZES workaround on FreeBSD 13 X-Git-Tag: VALGRIND_3_19_0~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01e05ea81c4886636b44545eb501139b76d5dc7a;p=thirdparty%2Fvalgrind.git Disable auxv PAGESIZES workaround on FreeBSD 13 Leaving it in place for 11 (which is now EOL) and 12 - not woth the complexity for them. Improve comment for supporession. Also add a pointer to the illumos source web page for lwp_unlock_mutex in case the syswrap ever needs improving. --- diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index d19186a42c..71fb8add17 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -578,7 +578,7 @@ Addr setup_client_stack( void* init_sp, /* --- auxv --- */ auxv = (struct auxv *)ptr; *client_auxv = (UInt *)auxv; -#if defined(VGP_x86_freebsd) +#if defined(VGP_x86_freebsd) && (VGO_freebsd <= FREEBSD_13) int* pagesizes = NULL; #endif @@ -610,6 +610,17 @@ Addr setup_client_stack( void* init_sp, * copies out the data for a sysctl sees this discrepancy and * sets an ENOMEM error. So guest execution doesn't even get past * executing the dynamic linker. + * + * This was fixed in the kernel in May 2020, see + * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246215 + * + * That means this workaround is not needed for + * FreeBSD 13 or later, any version + * FreeBSD 12 1201515 and later + * FreeBSD 11 1104501 and later + * + * Because this is rather complicated I've just disabled the hack + * for 13 and later */ for (; orig_auxv->a_type != AT_NULL; auxv++, orig_auxv++) { @@ -649,7 +660,7 @@ Addr setup_client_stack( void* init_sp, // case AT_CANARYLEN: // case AT_EXECPATH: // case AT_CANARY: -#if defined(VGP_x86_freebsd) +#if defined(VGP_x86_freebsd) && (VGO_freebsd <= FREEBSD_13) case AT_PAGESIZESLEN: if (!VG_(is32on64)()) { VG_(debugLog)(2, "initimg", diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c index d1ce0fd6bb..ea46073427 100644 --- a/coregrind/m_syswrap/syswrap-solaris.c +++ b/coregrind/m_syswrap/syswrap-solaris.c @@ -10639,6 +10639,8 @@ PRE(sys_lwp_mutex_register) PRE(sys_lwp_mutex_unlock) { /* int lwp_mutex_unlock(lwp_mutex_t *lp); */ + /* see https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/syscall/lwp_sobj.c#L3137-L3138 + * (illumos, obviously) */ vki_lwp_mutex_t *lp = (vki_lwp_mutex_t*)ARG1; PRINT("sys_lwp_mutex_unlock ( %#lx )", ARG1); PRE_REG_READ1(int, "lwp_mutex_unlock", lwp_mutex_t *, lp); diff --git a/freebsd.supp b/freebsd.supp index b86b800d80..10d4a10454 100644 --- a/freebsd.supp +++ b/freebsd.supp @@ -1,5 +1,9 @@ # Suppressions for FreeBSD / Memcheck -#This is a workaround for a bug in rtld + +# This is a workaround for a bug in rtld / sysctl hw.pagesizes +# it was fixed in May 2020 in the kernel +# removing it means either waiting for 12-RELEASE EOL +# or some tricky kernel detection in configure.ac { MEMCHECK-RTLD-32ON64 Memcheck:Addr4