]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD: mostly filters and suppressions for fdleak tests
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 15 Jun 2024 15:09:05 +0000 (17:09 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 15 Jun 2024 15:25:15 +0000 (17:25 +0200)
Also make close_range behave like linux when highfd is UINT_MAX.
We should probably move close_range to generic.

coregrind/m_syswrap/syswrap-freebsd.c
none/tests/fdleak_cmsg_supp.supp
none/tests/filter_xml

index 426fa601547690a75740cdb06a670a9f30e6046a..b9532542a1689327b4bb3d13db794d8f2dfed268 100644 (file)
@@ -6862,7 +6862,7 @@ POST(sys___realpathat)
 #if (FREEBSD_VERS >= FREEBSD_12_2)
 
 // SYS_sys_close_range   575
-// int close_range(close_range(u_int lowfd, u_int highfd, int flags);
+// int close_range(u_int lowfd, u_int highfd, int flags);
 PRE(sys_close_range)
 {
    SysRes res = VG_(mk_SysRes_Success)(0);
@@ -6923,11 +6923,17 @@ POST(sys_close_range)
    if (last >= VG_(fd_hard_limit))
       last = VG_(fd_hard_limit) - 1;
 
-   for (fd = ARG1; fd <= last; fd++)
-      if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0)
-          && fd != VG_(log_output_sink).fd
-          && fd != VG_(xml_output_sink).fd)
-         ML_(record_fd_close)(tid, fd);
+   /* If the close_range range is too wide, we don't want to loop
+      through the whole range.  */
+   if (ARG2 == ~0U)
+     ML_(record_fd_close_range)(tid, ARG1);
+   else {
+      for (fd = ARG1; fd <= last; fd++)
+         if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0)
+             && fd != VG_(log_output_sink).fd
+             && fd != VG_(xml_output_sink).fd)
+            ML_(record_fd_close)(tid, fd);
+   }
 }
 #endif
 
index 5644147a9870dd27360d8c57e8e599537b1e57f7..92fbacabdb789b2668ab6e7ea1a40d7b435119ab 100644 (file)
@@ -1,7 +1,7 @@
 {
    sup1
    CoreError:FdNotClosed
-   fun:accept
+   fun:*accept
    fun:server
    fun:main
 }
 {
    sup3
    CoreError:FdNotClosed
-   fun:*open*
-   fun:server
-   fun:main
-}
-{
-   sup4
-   CoreError:FdNotClosed
+   ...
    fun:*open*
    fun:server
    #fun:main
 }
 {
-   sup5
+   sup4
    CoreError:FdNotClosed
    fun:recvmsg
    fun:client
    fun:main
 }
 {
-   sup6
+   sup5
    CoreError:FdNotClosed
+   ...
    fun:recvmsg
    fun:client
    fun:main
 }
 {
-   sup7
+   sup6
    CoreError:FdNotClosed
    fun:socket
    fun:client
index 70fdb6579195f2b9dcacd04df46b58a2e686d57b..d1ef570a05b0658cf46ad0fda88f07f9c1633861 100755 (executable)
@@ -2,6 +2,12 @@
 
 dir=`dirname $0`
 
+# FreeBSD adds this one extra line
+# but after filter_xml_frames it will just be <path>...<\/path>
+# which matches other lines, so get rid of it while we can
+# uniquely match it
+sed "/<path>internet<\/path>/d" |
+
 $dir/../../tests/filter_xml_frames  |
 perl    -p -e "s/<time>.*<\/time>/<time>...<\/time>/s" |
 perl    -p -e "s/<what>.*<\/what>/<what>...<\/what>/s" |