Fixed segfault in valgrind because of executable stack
authorMaurice van der Pot <griffon26@gentoo.org>
Sun, 19 Dec 2004 18:36:31 +0000 (18:36 +0000)
committerMaurice van der Pot <griffon26@gentoo.org>
Sun, 19 Dec 2004 18:36:31 +0000 (18:36 +0000)
dev-util/valgrind/ChangeLog
dev-util/valgrind/Manifest
dev-util/valgrind/files/digest-valgrind-2.2.0-r1 [new file with mode: 0644]
dev-util/valgrind/files/valgrind-2.2.0-no-exec-stack.patch [new file with mode: 0644]
dev-util/valgrind/valgrind-2.2.0-r1.ebuild [new file with mode: 0644]

index c428071518e1745fe7a6b7969bc3e8ce77162185..d09a846241a9be4a279546c223b8b9feb0cc7a4f 100644 (file)
@@ -1,6 +1,14 @@
 # ChangeLog for dev-util/valgrind
 # Copyright 2000-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-util/valgrind/ChangeLog,v 1.39 2004/10/28 19:33:05 griffon26 Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-util/valgrind/ChangeLog,v 1.40 2004/12/19 18:36:31 griffon26 Exp $
+
+*valgrind-2.2.0-r1 (19 Dec 2004)
+
+  19 Dec 2004; Maurice van der Pot <griffon26@gentoo.org>
+  +files/valgrind-2.2.0-no-exec-stack.patch, +valgrind-2.2.0-r1.ebuild:
+  Remove nested function to enable running without an executable stack.
+  Fixes segmentation fault on nptl systems as reported by Pedro Morales 
+  <pemorale@dcc.uchile.cl> in bug #74716.
 
   28 Oct 2004; Maurice van der Pot <griffon26@gentoo.org> metadata.xml:
   Taken up maintenance of valgrind.
index 3dde4e38b14976db6610e1a3a7796af82b928968..11178c1cae67186d71aa89e71757bd22b429f798 100644 (file)
@@ -7,8 +7,9 @@ MD5 36b52cc7f792a5f6944af5e3488fc3cd valgrind-2.1.1-r1.ebuild 1140
 MD5 a0b171b6dab7cb44a9eab9bf70738b7c valgrind-2.1.1.ebuild 926
 MD5 74af16c4f9ed08248153f39e9181c7be valgrind-2.1.2.ebuild 1099
 MD5 799f0b61a3a686b4074bd61acc572c5c metadata.xml 1003
-MD5 ae6e19ad890434e670e098263cd07f2c ChangeLog 1886
 MD5 f89777a4817a47cc876c1a51cf1b2298 valgrind-2.2.0.ebuild 1384
+MD5 2675ae96f7b60ab128962ad107f8234b valgrind-2.2.0-r1.ebuild 1439
+MD5 dc34cde41d17fbdb81e1a79453934e69 ChangeLog 2238
 MD5 286d10f4514e8a85360ce6ba5654ae93 files/digest-valgrind-2.0.0 67
 MD5 a69fe5652a8ca5fb1d04521fe0c56850 files/digest-valgrind-2.1.0 138
 MD5 f50184c09d0376e66b1b79d0b45e94c2 files/digest-valgrind-2.1.1 67
@@ -18,10 +19,12 @@ MD5 1ba26123d6543d9b4faa808595fbb5b8 files/valgrind-2.1.1-pic.patch 8338
 MD5 96f4ea73f94e4b969cd764574aeef978 files/valgrind-2.1.2-kernel-headers.patch 826
 MD5 95845f5c26fd00027163547288c17e54 files/valgrind-configure.in-2.6.diff 336
 MD5 26192577445b467e528408118f7ee6ec files/digest-valgrind-2.2.0 139
+MD5 26192577445b467e528408118f7ee6ec files/digest-valgrind-2.2.0-r1 139
+MD5 fc1dda2b6f2603a4244ad25f555f2034 files/valgrind-2.2.0-no-exec-stack.patch 1711
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (GNU/Linux)
 
-iD8DBQFBgUl6MGnpIbeahxwRAj2hAJ9+l+lF6HBdSv+P5JYDPnCAQix0GACgrZmn
-X5p09MmDSLHlXugFIHa2+BI=
-=m/m+
+iD8DBQFBxco5MGnpIbeahxwRAjFFAJ9I610V23KsOfRj5MeKK/PvLysIjgCaAxOS
+AdnwVRx1Y4jbDnAJ+wFLvYs=
+=ZF5p
 -----END PGP SIGNATURE-----
diff --git a/dev-util/valgrind/files/digest-valgrind-2.2.0-r1 b/dev-util/valgrind/files/digest-valgrind-2.2.0-r1
new file mode 100644 (file)
index 0000000..b7acbc9
--- /dev/null
@@ -0,0 +1,2 @@
+MD5 30dc51f6fc94751b90b04af9c2e2c656 valgrind-2.2.0.tar.bz2 964987
+MD5 a9f5bf8d548ceed56343f8298887bb43 valgrind-2.2.0-ppc.tar.bz2 1000093
diff --git a/dev-util/valgrind/files/valgrind-2.2.0-no-exec-stack.patch b/dev-util/valgrind/files/valgrind-2.2.0-no-exec-stack.patch
new file mode 100644 (file)
index 0000000..e5e87dc
--- /dev/null
@@ -0,0 +1,62 @@
+diff -ruN valgrind-2.2.0/coregrind/vg_libpthread.c valgrind-2.2.0-fixed/coregrind/vg_libpthread.c
+--- valgrind-2.2.0/coregrind/vg_libpthread.c   2004-12-19 17:30:53.383502976 +0100
++++ valgrind-2.2.0-fixed/coregrind/vg_libpthread.c     2004-12-19 17:31:23.680897072 +0100
+@@ -1830,12 +1830,6 @@
+ /* Initialiser has completed. */
+ #define P_ONCE_COMPLETED ((PTHREAD_ONCE_INIT) + 2)
+ 
+-int __pthread_once ( pthread_once_t *once_control, 
+-                     void (*init_routine) (void) )
+-{
+-   int res;
+-   int done;
+-
+ #  define TAKE_LOCK                                   \
+       res = __pthread_mutex_lock(&once_masterlock);   \
+       my_assert(res == 0);
+@@ -1844,11 +1838,19 @@
+       res = __pthread_mutex_unlock(&once_masterlock); \
+       my_assert(res == 0);
+ 
+-   void cleanup(void *v) {
+-      TAKE_LOCK;
+-      *once_control = P_ONCE_NOT_DONE;
+-      RELEASE_LOCK;
+-   }
++static void cleanup(void *once_control) {
++   int res;
++   TAKE_LOCK;
++   *(pthread_once_t *)once_control = P_ONCE_NOT_DONE;
++   RELEASE_LOCK;
++}
++
++int __pthread_once ( pthread_once_t *once_control, 
++                     void (*init_routine) (void) )
++{
++   int res;
++   int done;
++
+ 
+    ensure_valgrind("pthread_once");
+ 
+@@ -1863,7 +1865,7 @@
+        /* Not started.  Change state to indicate running, drop the
+           lock and run.  */
+          *once_control = P_ONCE_RUNNING;
+-       _pthread_cleanup_push(NULL, cleanup, NULL);
++       _pthread_cleanup_push(NULL, cleanup, once_control);
+        RELEASE_LOCK;
+          init_routine();
+          /* re-take the lock, and set state to indicate done. */
+@@ -1904,9 +1906,10 @@
+ 
+    return 0;
+ 
++}
++
+ #  undef TAKE_LOCK
+ #  undef RELEASE_LOCK
+-}
+ 
+ #undef P_ONCE_NOT_DONE
+ #undef P_ONCE_RUNNING
diff --git a/dev-util/valgrind/valgrind-2.2.0-r1.ebuild b/dev-util/valgrind/valgrind-2.2.0-r1.ebuild
new file mode 100644 (file)
index 0000000..657a032
--- /dev/null
@@ -0,0 +1,51 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-util/valgrind/valgrind-2.2.0-r1.ebuild,v 1.1 2004/12/19 18:36:31 griffon26 Exp $
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="An open-source memory debugger for x86-GNU/Linux and ppc-GNU/Linux"
+HOMEPAGE="http://valgrind.kde.org"
+SRC_URI="x86? ( http://developer.kde.org/~sewardj/${P}.tar.bz2 )
+                ppc? ( http://ozlabs.org/~paulus/${P}-ppc.tar.bz2 )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 -sparc ~ppc -alpha"
+IUSE="X"
+RESTRICT="nostrip"
+
+RDEPEND="virtual/libc
+       X? ( virtual/x11 )"
+DEPEND="${RDEPEND}
+       sys-devel/autoconf"
+
+src_unpack() {
+       unpack ${A}
+       use ppc && cd "${WORKDIR}/${P}-ppc" || cd ${S}
+       #ugly but working workaround
+       if has_version '>=sys-kernel/linux26-headers-2.6.7' ; then
+               einfo "Removing net/if.h from the includes in vg_unsafe.h"
+               sed -i -e "s:#include <net/if.h>::" \
+                       coregrind/vg_unsafe.h ||die
+       fi
+       epatch "${FILESDIR}/${P}-no-exec-stack.patch"
+}
+src_compile() {
+       use ppc && cd "${WORKDIR}/${P}-ppc"
+
+       local myconf
+
+       filter-flags -fPIC
+
+       use X && myconf="--with-x" || myconf="--with-x=no"
+       # note: it does not appear safe to play with CFLAGS
+       econf ${myconf} || die
+       emake || die "emake failed"
+}
+
+src_install() {
+       use ppc && cd "${WORKDIR}/${P}-ppc"
+       einstall docdir="${D}/usr/share/doc/${PF}/html" || die
+       dodoc ACKNOWLEDGEMENTS AUTHORS FAQ.txt NEWS README* TODO
+}