Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Oct 2020 04:26:45 +0000
From:      bugzilla-noreply@freebsd.org
To:        xfce@FreeBSD.org
Subject:   [Bug 250311] devel/glib20: lock getfsent() usage to fix x11-fm/thunar crashes
Message-ID:  <bug-250311-28711@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D250311

            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@FreeBSD.org
          Reporter: sigsys@gmail.com
                CC: desktop@FreeBSD.org, xfce@FreeBSD.org
                CC: desktop@FreeBSD.org, xfce@FreeBSD.org

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

(gdb) bt
#0  _flockfile (fp=3D0x0) at /usr/src/lib/libc/stdio/_flock_stub.c:68
#1  0x000000080bf59deb in fgets (buf=3D0x80bf8ff90 "\n", n=3D1024, fp=3D0x0=
) 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=3D0x87f425400) 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 =3D getfsent ()) !=3D NULL)
     {
       gboolean is_read_only =3D FALSE;
@@ -1468,6 +1471,7 @@
     }

   endfsent ();
+  G_UNLOCK (getfsent);

   return g_list_reverse (return_list);
 }

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-250311-28711>