[Bug 250311] devel/glib20: lock getfsent() usage to fix x11-fm/thunar crashes

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Oct 13 04:26:46 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250311

            Bug ID: 250311
           Summary: devel/glib20: lock getfsent() usage to fix
                    x11-fm/thunar crashes
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs at FreeBSD.org
          Reporter: sigsys at gmail.com
                CC: desktop at FreeBSD.org, xfce at FreeBSD.org
                CC: desktop at FreeBSD.org, xfce at FreeBSD.org

I had thunar crashing from time to time (especially in large directories) due
to concurrent use of getfsent() (which is not thread-safe).

(gdb) bt
#0  _flockfile (fp=0x0) at /usr/src/lib/libc/stdio/_flock_stub.c:68
#1  0x000000080bf59deb in fgets (buf=0x80bf8ff90 "\n", n=1024, fp=0x0) at
/usr/src/lib/libc/stdio/fgets.c:61
#2  0x000000080be7a1b4 in fstabscan () at /usr/src/lib/libc/gen/fstab.c:121
#3  0x000000080be7a03c in getfsent () at /usr/src/lib/libc/gen/fstab.c:227
#4  0x000000080a181c28 in g_unix_mount_points_get () at
/usr/local/lib/libgio-2.0.so.0
#5  0x000000080a181da9 in g_unix_mount_point_at () at
/usr/local/lib/libgio-2.0.so.0
#6  0x000000080a1e0811 in  () at /usr/local/lib/libgio-2.0.so.0
#7  0x000000080a1e0624 in  () at /usr/local/lib/libgio-2.0.so.0
#8  0x000000080a1e4235 in  () at /usr/local/lib/libgio-2.0.so.0
#9  0x000000080a1e3d4e in  () at /usr/local/lib/libgio-2.0.so.0
#10 0x000000080a116a88 in g_file_enumerator_next_file () at
/usr/local/lib/libgio-2.0.so.0
#11 0x000000000027ca39 in  ()
#12 0x000000000027c1ed in  ()
#13 0x00000000002a54ee in  ()
#14 0x0000000801f97b86 in  () at /usr/local/lib/libexo-2.so.0
#15 0x000000080a12bd9e in  () at /usr/local/lib/libgio-2.0.so.0
#16 0x000000080a15fc45 in  () at /usr/local/lib/libgio-2.0.so.0
#17 0x000000080ae6b483 in  () at /usr/local/lib/libglib-2.0.so.0
#18 0x000000080ae6a272 in  () at /usr/local/lib/libglib-2.0.so.0
#19 0x0000000806d1afac in thread_start (curthread=0x87f425400) at
/usr/src/lib/libthr/thread/thr_create.c:292
#20 0x0000000000000000 in  ()


Adding this patch fixes the problem.

devel/glib20/files/patch-gio_gunixmounts.c

--- gio/gunixmounts.c.orig      2020-10-01 09:17:53.138733000 -0400
+++ gio/gunixmounts.c   2020-10-13 00:14:04.413638000 -0400
@@ -1389,6 +1389,8 @@

 #elif (defined(HAVE_GETVFSSTAT) || defined(HAVE_GETFSSTAT)) &&
defined(HAVE_FSTAB_H) && defined(HAVE_SYS_MOUNT_H)

+G_LOCK_DEFINE_STATIC(getfsent);
+
 static GList *
 _g_get_unix_mount_points (void)
 {
@@ -1433,6 +1435,7 @@
 #endif
 #endif

+  G_LOCK (getfsent);
   while ((fstab = getfsent ()) != NULL)
     {
       gboolean is_read_only = FALSE;
@@ -1468,6 +1471,7 @@
     }

   endfsent ();
+  G_UNLOCK (getfsent);

   return g_list_reverse (return_list);
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-xfce mailing list