Ticket #45309: glib2-45309.patch

File glib2-45309.patch, 2.3 KB (added by jeremyhu (Jeremy Huddleston Sequoia), 9 years ago)

glib2-45309.patch

  • Portfile

     
    1111conflicts                   glib2-devel
    1212set my_name                 glib
    1313version                     2.42.0
     14revision                    1
    1415set branch                  [join [lrange [split ${version} .] 0 1] .]
    1516categories                  devel
    1617maintainers                 ryandesign openmaintainer
     
    4344                            patch-gio_xdgmime_xdgmime.c.diff \
    4445                            patch-gio_gdbusprivate.c.diff \
    4546                            patch-get-launchd-dbus-session-address.diff \
     47                            patch-gmodule-gmodule-dl.c.diff \
    4648                            yosemite-symbol-lookup.patch
    4749
    4850depends_build               bin:xmllint:libxml2
  • files/patch-gmodule-gmodule-dl.c.diff

     
     1--- gmodule/gmodule-dl.c.orig   2014-07-04 16:59:10.000000000 -0700
     2+++ gmodule/gmodule-dl.c        2014-11-03 10:53:31.000000000 -0800
     3@@ -126,16 +126,18 @@ static void
     4 _g_module_close (gpointer handle,
     5                 gboolean is_unref)
     6 {
     7-  /* are there any systems out there that have dlopen()/dlclose()
     8-   * without a reference count implementation?
     9+  /* Intentionally not dlclose()ing because it is safer to leave the library
     10+   * loaded in memory than to close it and possibly leave dangling pointers
     11+   * to things like atexit handlers, atfork handlers, blocks, etc.
     12+   *
     13+   * See https://trac.macports.org/ticket/45309 for an example from when
     14+   * a library used by a module added a new dependency which had an
     15+   * initializer which added a child atfork handler.  The result is that
     16+   * after closing the module, the system had a dangling pointer for the
     17+   * atfork handler which would at best crash on the child side of fork()
     18+   * and at worst lead to arbitray code execution of whatever happened to be
     19+   * at that location in memory at a later time in the process.
     20    */
     21-  is_unref |= 1;
     22
     23-  if (is_unref)
     24-    {
     25-      if (dlclose (handle) != 0)
     26-       g_module_set_error (fetch_dlerror (TRUE));
     27-    }
     28 }
     29 
     30 static gpointer