Pullup ticket #4531 - requested by he security/libgpg-error: bug fix patch Revisions pulled up: - security/libgpg-error/Makefile 1.44 via patch - security/libgpg-error/distinfo 1.21 via patch - security/libgpg-error/patches/patch-src_estream.c 1.1 --- Module Name: pkgsrc Committed By: he Date: Wed Oct 29 12:28:50 UTC 2014 Modified Files: pkgsrc/security/libgpg-error: Makefile distinfo Added Files: pkgsrc/security/libgpg-error/patches: patch-src_estream.c Log Message: Use __attribute__((destructor)) instead of atexit(), so that the library wind-down function is both called on dlclose() and exit(). Should avoid segfault when trying to call the atexit function after dlclose() which unmaps the library. Fixes PR pkg/49333, thanks to joerg@ for the suggested fix. Also, the IRIX and NetBSD tool name to get at nawk is just "awk", flagged by pkglint. Bump PKGREVISION.diff -r1.40 -r1.40.2.1 pkgsrc/security/libgpg-error/Makefile
(tron)
@@ -1,16 +1,17 @@ | @@ -1,16 +1,17 @@ | |||
1 | # $NetBSD: Makefile,v 1.40 2014/09/14 16:45:54 wiz Exp $ | 1 | # $NetBSD: Makefile,v 1.40.2.1 2014/10/29 20:11:31 tron Exp $ | |
2 | 2 | |||
3 | DISTNAME= libgpg-error-1.15 | 3 | DISTNAME= libgpg-error-1.15 | |
4 | PKGREVISION= 1 | |||
4 | CATEGORIES= security | 5 | CATEGORIES= security | |
5 | MASTER_SITES= ftp://ftp.gnupg.org/gcrypt/libgpg-error/ \ | 6 | MASTER_SITES= ftp://ftp.gnupg.org/gcrypt/libgpg-error/ \ | |
6 | ftp://ftp.ring.gr.jp/pub/net/gnupg/libgpg-error/ \ | 7 | ftp://ftp.ring.gr.jp/pub/net/gnupg/libgpg-error/ \ | |
7 | ftp://mirror.switch.ch/mirror/gnupg/libgpg-error/ \ | 8 | ftp://mirror.switch.ch/mirror/gnupg/libgpg-error/ \ | |
8 | ftp://ftp.freenet.de/pub/ftp.gnupg.org/gcrypt/libgpg-error/ \ | 9 | ftp://ftp.freenet.de/pub/ftp.gnupg.org/gcrypt/libgpg-error/ \ | |
9 | ftp://ftp.gnupg.ca/libgpg-error/ | 10 | ftp://ftp.gnupg.ca/libgpg-error/ | |
10 | EXTRACT_SUFX= .tar.bz2 | 11 | EXTRACT_SUFX= .tar.bz2 | |
11 | 12 | |||
12 | MAINTAINER= minskim@NetBSD.org | 13 | MAINTAINER= minskim@NetBSD.org | |
13 | HOMEPAGE= http://www.gnupg.org/ | 14 | HOMEPAGE= http://www.gnupg.org/ | |
14 | COMMENT= Definitions of common error values for all GnuPG components | 15 | COMMENT= Definitions of common error values for all GnuPG components | |
15 | LICENSE= gnu-gpl-v2 AND gnu-lgpl-v2.1 | 16 | LICENSE= gnu-gpl-v2 AND gnu-lgpl-v2.1 | |
16 | 17 | |||
@@ -23,27 +24,27 @@ GNU_CONFIGURE= yes | @@ -23,27 +24,27 @@ GNU_CONFIGURE= yes | |||
23 | MAKE_ENV+= LC_ALL="C" | 24 | MAKE_ENV+= LC_ALL="C" | |
24 | MAKE_JOBS_SAFE= no | 25 | MAKE_JOBS_SAFE= no | |
25 | 26 | |||
26 | .include "../../mk/bsd.prefs.mk" | 27 | .include "../../mk/bsd.prefs.mk" | |
27 | 28 | |||
28 | .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) | 29 | .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) | |
29 | CONFIGURE_ENV+= CC_FOR_BUILD=${NATIVE_CC:Q} | 30 | CONFIGURE_ENV+= CC_FOR_BUILD=${NATIVE_CC:Q} | |
30 | .else | 31 | .else | |
31 | CONFIGURE_ENV+= CC_FOR_BUILD=${CC:Q}\ ${CFLAGS:M*:Q} | 32 | CONFIGURE_ENV+= CC_FOR_BUILD=${CC:Q}\ ${CFLAGS:M*:Q} | |
32 | .endif | 33 | .endif | |
33 | 34 | |||
34 | # XXX See HACKS | 35 | # XXX See HACKS | |
35 | .if ${OPSYS} == "IRIX" || !empty(MACHINE_PLATFORM:MNetBSD-[3-9]*) | 36 | .if ${OPSYS} == "IRIX" || !empty(MACHINE_PLATFORM:MNetBSD-[3-9]*) | |
36 | USE_TOOLS+= nawk | 37 | USE_TOOLS+= awk | |
37 | .else | 38 | .else | |
38 | USE_TOOLS+= gawk | 39 | USE_TOOLS+= gawk | |
39 | .endif | 40 | .endif | |
40 | 41 | |||
41 | # On Dragonfly i386, Pkgsrc libintl segfaults on bindtextdomain function | 42 | # On Dragonfly i386, Pkgsrc libintl segfaults on bindtextdomain function | |
42 | # while locking a thread. Until that's resolved, stop libgpg-error from | 43 | # while locking a thread. Until that's resolved, stop libgpg-error from | |
43 | # using NLS which invokes that function during initialization. | 44 | # using NLS which invokes that function during initialization. | |
44 | PLIST_VARS+= nls | 45 | PLIST_VARS+= nls | |
45 | .if ${OPSYS} == "DragonFly" && ${MACHINE} == "i386" | 46 | .if ${OPSYS} == "DragonFly" && ${MACHINE} == "i386" | |
46 | CONFIGURE_ARGS+= --disable-nls | 47 | CONFIGURE_ARGS+= --disable-nls | |
47 | .else | 48 | .else | |
48 | PLIST.nls= yes | 49 | PLIST.nls= yes | |
49 | .endif | 50 | .endif |
@@ -1,7 +1,8 @@ | @@ -1,7 +1,8 @@ | |||
1 | $NetBSD: distinfo,v 1.18 2014/09/16 23:17:48 tron Exp $ | 1 | $NetBSD: distinfo,v 1.18.2.1 2014/10/29 20:11:31 tron Exp $ | |
2 | 2 | |||
3 | SHA1 (libgpg-error-1.15.tar.bz2) = f41791121c66043fa18834597e0155ebcbff8ada | 3 | SHA1 (libgpg-error-1.15.tar.bz2) = f41791121c66043fa18834597e0155ebcbff8ada | |
4 | RMD160 (libgpg-error-1.15.tar.bz2) = 09d050254364d27ba3b98156c4b66b1e9490084a | 4 | RMD160 (libgpg-error-1.15.tar.bz2) = 09d050254364d27ba3b98156c4b66b1e9490084a | |
5 | Size (libgpg-error-1.15.tar.bz2) = 546865 bytes | 5 | Size (libgpg-error-1.15.tar.bz2) = 546865 bytes | |
6 | SHA1 (patch-src_estream.c) = e3086b363ef14f1b24cac7334c8ecbf8e94ddd3b | |||
6 | SHA1 (patch-src_gpg-error-config.in) = e22e99208192971f8c123d7ee9b22c5f615669e1 | 7 | SHA1 (patch-src_gpg-error-config.in) = e22e99208192971f8c123d7ee9b22c5f615669e1 | |
7 | SHA1 (patch-src_gpgrt-int.h) = 151ce28066bb456984e4ff53211d454ea4426cff | 8 | SHA1 (patch-src_gpgrt-int.h) = 151ce28066bb456984e4ff53211d454ea4426cff |
$NetBSD: patch-src_estream.c,v 1.1.2.2 2014/10/29 20:11:31 tron Exp $
Don't use atexit(), since this library mey be dlopen()ed
and dlclose()d before exit() is called.
Instead mark the do_deinit() function as a destructor.
--- src/estream.c.orig 2014-09-11 09:38:21.000000000 +0000
+++ src/estream.c
@@ -471,6 +471,7 @@ do_list_remove (estream_t stream, int wi
+__attribute__((destructor,used))
static void
do_deinit (void)
{
@@ -503,7 +504,16 @@ _gpgrt_es_init (void)
if (!initialized)
{
initialized = 1;
+#if 0
+ /* This library may be unloaded via dlclose() before
+ * exit() is called, causing the atexit handler to try
+ * to jump into unmapped address space, causing a segfault.
+ * This has been observed with apache and php. Instead, use
+ * the destructor attribute, since that will cause it
+ * to be called on dlclose() as well.
+ */
atexit (do_deinit);
+#endif
}
return 0;
}