]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Disable auxv PAGESIZES workaround on FreeBSD 13
authorPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 23 Nov 2021 20:58:45 +0000 (21:58 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 23 Nov 2021 20:58:45 +0000 (21:58 +0100)
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.

coregrind/m_initimg/initimg-freebsd.c
coregrind/m_syswrap/syswrap-solaris.c
freebsd.supp

index d19186a42c507f2dc0b1b0258950ace7719e7dcb..71fb8add17220bd68360cc036b8e60a69cf3a637 100644 (file)
@@ -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",
index d1ce0fd6bb1ef9d1d19588cb33ca403f16798cda..ea460734274bcc6f8f4a92975dcc9d9bd940bc69 100644 (file)
@@ -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);
index b86b800d80b15ebe41cdf2817fb15d5ce73001c1..10d4a104541debeac4a908e1ea4e1d1391eba175 100644 (file)
@@ -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