[127768] trunk/dports/devel
ryandesign at macports.org
ryandesign at macports.org
Mon Nov 3 11:37:25 PST 2014
Revision: 127768
https://trac.macports.org/changeset/127768
Author: ryandesign at macports.org
Date: 2014-11-03 11:37:25 -0800 (Mon, 03 Nov 2014)
Log Message:
-----------
glib2, glib2-devel: don't dlclose in _g_module_close (#45309)
Modified Paths:
--------------
trunk/dports/devel/glib2/Portfile
trunk/dports/devel/glib2-devel/Portfile
Added Paths:
-----------
trunk/dports/devel/glib2/files/patch-gmodule-gmodule-dl.c.diff
trunk/dports/devel/glib2-devel/files/patch-gmodule-gmodule-dl.c.diff
Modified: trunk/dports/devel/glib2/Portfile
===================================================================
--- trunk/dports/devel/glib2/Portfile 2014-11-03 19:27:58 UTC (rev 127767)
+++ trunk/dports/devel/glib2/Portfile 2014-11-03 19:37:25 UTC (rev 127768)
@@ -11,6 +11,7 @@
conflicts glib2-devel
set my_name glib
version 2.42.0
+revision 1
set branch [join [lrange [split ${version} .] 0 1] .]
categories devel
maintainers ryandesign openmaintainer
@@ -43,6 +44,7 @@
patch-gio_xdgmime_xdgmime.c.diff \
patch-gio_gdbusprivate.c.diff \
patch-get-launchd-dbus-session-address.diff \
+ patch-gmodule-gmodule-dl.c.diff \
yosemite-symbol-lookup.patch
depends_build bin:xmllint:libxml2
Added: trunk/dports/devel/glib2/files/patch-gmodule-gmodule-dl.c.diff
===================================================================
--- trunk/dports/devel/glib2/files/patch-gmodule-gmodule-dl.c.diff (rev 0)
+++ trunk/dports/devel/glib2/files/patch-gmodule-gmodule-dl.c.diff 2014-11-03 19:37:25 UTC (rev 127768)
@@ -0,0 +1,30 @@
+--- gmodule/gmodule-dl.c.orig 2014-07-04 16:59:10.000000000 -0700
++++ gmodule/gmodule-dl.c 2014-11-03 10:53:31.000000000 -0800
+@@ -126,16 +126,18 @@ static void
+ _g_module_close (gpointer handle,
+ gboolean is_unref)
+ {
+- /* are there any systems out there that have dlopen()/dlclose()
+- * without a reference count implementation?
++ /* Intentionally not dlclose()ing because it is safer to leave the library
++ * loaded in memory than to close it and possibly leave dangling pointers
++ * to things like atexit handlers, atfork handlers, blocks, etc.
++ *
++ * See https://trac.macports.org/ticket/45309 for an example from when
++ * a library used by a module added a new dependency which had an
++ * initializer which added a child atfork handler. The result is that
++ * after closing the module, the system had a dangling pointer for the
++ * atfork handler which would at best crash on the child side of fork()
++ * and at worst lead to arbitray code execution of whatever happened to be
++ * at that location in memory at a later time in the process.
+ */
+- is_unref |= 1;
+-
+- if (is_unref)
+- {
+- if (dlclose (handle) != 0)
+- g_module_set_error (fetch_dlerror (TRUE));
+- }
+ }
+
+ static gpointer
Modified: trunk/dports/devel/glib2-devel/Portfile
===================================================================
--- trunk/dports/devel/glib2-devel/Portfile 2014-11-03 19:27:58 UTC (rev 127767)
+++ trunk/dports/devel/glib2-devel/Portfile 2014-11-03 19:37:25 UTC (rev 127768)
@@ -11,6 +11,7 @@
conflicts glib2
set my_name glib
version 2.43.0
+revision 1
set branch [join [lrange [split ${version} .] 0 1] .]
categories devel
maintainers ryandesign openmaintainer
@@ -43,6 +44,7 @@
patch-gio_xdgmime_xdgmime.c.diff \
patch-gio_gdbusprivate.c.diff \
patch-get-launchd-dbus-session-address.diff \
+ patch-gmodule-gmodule-dl.c.diff \
yosemite-symbol-lookup.patch
depends_build bin:xmllint:libxml2
Added: trunk/dports/devel/glib2-devel/files/patch-gmodule-gmodule-dl.c.diff
===================================================================
--- trunk/dports/devel/glib2-devel/files/patch-gmodule-gmodule-dl.c.diff (rev 0)
+++ trunk/dports/devel/glib2-devel/files/patch-gmodule-gmodule-dl.c.diff 2014-11-03 19:37:25 UTC (rev 127768)
@@ -0,0 +1,30 @@
+--- gmodule/gmodule-dl.c.orig 2014-07-04 16:59:10.000000000 -0700
++++ gmodule/gmodule-dl.c 2014-11-03 10:53:31.000000000 -0800
+@@ -126,16 +126,18 @@ static void
+ _g_module_close (gpointer handle,
+ gboolean is_unref)
+ {
+- /* are there any systems out there that have dlopen()/dlclose()
+- * without a reference count implementation?
++ /* Intentionally not dlclose()ing because it is safer to leave the library
++ * loaded in memory than to close it and possibly leave dangling pointers
++ * to things like atexit handlers, atfork handlers, blocks, etc.
++ *
++ * See https://trac.macports.org/ticket/45309 for an example from when
++ * a library used by a module added a new dependency which had an
++ * initializer which added a child atfork handler. The result is that
++ * after closing the module, the system had a dangling pointer for the
++ * atfork handler which would at best crash on the child side of fork()
++ * and at worst lead to arbitray code execution of whatever happened to be
++ * at that location in memory at a later time in the process.
+ */
+- is_unref |= 1;
+-
+- if (is_unref)
+- {
+- if (dlclose (handle) != 0)
+- g_module_set_error (fetch_dlerror (TRUE));
+- }
+ }
+
+ static gpointer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20141103/4b8116e2/attachment-0001.html>
More information about the macports-changes
mailing list