summaryrefslogtreecommitdiff
path: root/dev-util/valgrind
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-09-08 10:50:14 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-09-08 10:50:14 +0100
commit3f71901f8c228f4de570abed1831ce3ee425343e (patch)
treea2dcd300d05ef8a2ec275b44a92a9d85bd3baa24 /dev-util/valgrind
parent12bb627384ddfd47382b9f1b6464481a58d01ebb (diff)
gentoo resync 08.09.2018
Diffstat (limited to 'dev-util/valgrind')
-rw-r--r--dev-util/valgrind/Manifest3
-rw-r--r--dev-util/valgrind/files/valgrind-3.13.0-accept-read-only-PT_LOAD-segments-and-rodata.patch95
-rw-r--r--dev-util/valgrind/files/valgrind-3.13.0-ignore-further-mappings-after-read-all-debuginfo.patch70
-rw-r--r--dev-util/valgrind/valgrind-3.13.0-r3.ebuild128
4 files changed, 296 insertions, 0 deletions
diff --git a/dev-util/valgrind/Manifest b/dev-util/valgrind/Manifest
index cb00ec01168d..9345ef0ead46 100644
--- a/dev-util/valgrind/Manifest
+++ b/dev-util/valgrind/Manifest
@@ -1,3 +1,5 @@
+AUX valgrind-3.13.0-accept-read-only-PT_LOAD-segments-and-rodata.patch 3765 BLAKE2B afce6e0e939040a76213733a4e3cb1ac0a26841fc9101d9fb8d74875861d8e5fb51f1813b2e377d15ea53a36166743c32550f00d1021bf4882fd8e2c4b43a127 SHA512 08c7db66502538f2dfa795b12dcbdfef6dc1f379da93af61f4a54fa48016be98a079c7ba4cc000d2972a2a1863ea01ce3d7c643ff993dfc3bc96d874b097473e
+AUX valgrind-3.13.0-ignore-further-mappings-after-read-all-debuginfo.patch 3340 BLAKE2B 344519d755c875acfd70eb7fd475057eacb1321401bafeffb2f632e1edfb01e88db9fef2cf6541db0cae9a7d11cd2d2eb1f00429561a22f96621242c696c9112 SHA512 28bc64b5157738302aee97cbaf0b57ca6f17166de1e63167fe879560f493510b2db17478847519731004f72f87904e0647f593a53d88aa8638b1e1738310954d
AUX valgrind-3.13.0-test-fixes.patch 929 BLAKE2B cf0316cc3637785bfa57cd2277ad7669ab968b28424bdcf56c47219c90d00915f51293bfc90f5319785752bcebbde7b011dbac964f9538ac2f4208ec7709047f SHA512 1cff77e987e2d20ce1563c96d76431c60c142c42afa978e32d3a8c8dda17d0f3c1ba29fe3d0fcf0e7445fa5ca9558690ecdaad259fb9d23f435dcdc0baa9175d
AUX valgrind-3.13.0-xml-socket.patch 934 BLAKE2B 151db92f36623a27a6798eb0e559211613fb70e6847985446f4d3cd2a31f9930377e66efc46ae86116f8bcec855cfef2640111bce543ecd3a3e92914f0fa04cb SHA512 a250d6c395a6a02f3898ca94edab92785a720024ce0555c0b48cfe6c96c3bfcc088c5c67242019cb7d89f68066cffde18efe2c74f9b7f8e068b012173c3ec189
AUX valgrind-3.7.0-fno-stack-protector.patch 554 BLAKE2B cd87e1bbf86b82face9dbbaddbbbb2773c6f1223e725898dfd5d0ae9078948642c4f2b9deca2bded676230bcfa20d39071f69e640a64dc254759115971374a82 SHA512 4f9573fd68a0e1e209518fb4100c27b697ccd28e7a39abaa921f1949cd87ffb79a6784d2d1f6e006d68a08c7217cee77cba378c18aab48b87a3824eedb53ed5e
@@ -7,6 +9,7 @@ DIST valgrind-3.13.0.tar.bz2 14723076 BLAKE2B cdf92087575cc851d316e2136081441f52
EBUILD valgrind-3.12.0.ebuild 2854 BLAKE2B 07c651acb3854432137f09513f991cb549b6192a704a26ed9626816f8650acfca0179c7064e772e59058a7657b1c0407a87753ec30b2209cf47aa04d68d908ca SHA512 a65f3ccca3a33e2bbae7d2616b2fa13a6a3913e927f601f8ef52172981f72c03219ccad126a801719688cb6106dea18c56ac0e14de194e065bffa744151ab457
EBUILD valgrind-3.13.0-r1.ebuild 3428 BLAKE2B 96f18609fe79c997b4d344ecf59be9356aafd5ed7bc4e03b028f06e3e938ee1f00440289f7918ab935ccc42fa2bea2d316bb1d96c43ef40a85374b12e0b5683c SHA512 aa0fe6e76e52d25c6b05a30c46de96aabf539f7166bd369b21b93522d52e01d9fc50c77769170021038b0ec60911cd07bf5afccca86e35ad49828e401ed4d61e
EBUILD valgrind-3.13.0-r2.ebuild 3879 BLAKE2B 03709383d7167d639ec5f3d461b0990c1d240a5260f5f4533a7dc79ca3b789ae9cfb7f749a11be2dfb410cadf7364ffd13515c63ee3673fee3fcb4d07b8a4b25 SHA512 c2f81be414f2d5d2853350b1e1652f5cc03578962d3a8ed5a31462defe970b1a5b7f4820f02fb76e4a7494ec5377af35149c0c22c9378619e2705247f490268b
+EBUILD valgrind-3.13.0-r3.ebuild 4121 BLAKE2B 0770974a05e87ad0ffec0516521d5954196b0a5ffc62ce2aae925bbe29a2acd076cac3d5751bf92535ce59f554ae51403849b1b7fb4c6f71ade7fcbe0c333554 SHA512 1f0921aba9cdd3a192fdc3ae5a77da773c7c9e485acbb38c9ac8de6208496d44d10edc01126e8488e17231c45cf8a769d3226ab18d8436e7857497a3b07dd2f8
EBUILD valgrind-3.13.0.ebuild 2854 BLAKE2B 8228042c5f24ce771f07f3b44c94a26dec805e7ce03ecd545a7b7caee1c3a41f93deeed2b298a99b9560614e64b54961e4df3c8d902984b34ed0b2e005568107 SHA512 771bf52c0436aa15175df29d10e3f191e5e9511a50dd466ef6a102c7b13d677ad84adf387b7edb99b6cdce1f38f644adbdc3a40bdaacabb22168f2aa07302fcc
EBUILD valgrind-9999.ebuild 3675 BLAKE2B 4405fa37a59f844c3ab8f5ca933408834a7986b4534542f7276214ed9616912f9df22b62f3bd2dcaa8693acaf0c19f09489d67ea8825bc8d2ee6e5d387aca10b SHA512 408fb2dd9e8676dcf117298f03dcedd5dd54f8eb33d75c04f6f890817a82a9035b7387d4a075ef7bebc52c2008ae99c7831eb0e9e7553eae449ccc3f6160a3fa
MISC metadata.xml 1139 BLAKE2B fef548fc43861a5c031c4db6fcd5a446cb3a33b030916a118de1d99e78fc893991cd20f06d545d7731668e4ad859ded8e8b980e35e383ba27ecb96b704757a95 SHA512 f3ee37b8e5f408c01d5f6308644305fcb945df008e5f708dbde95f73a1e7988f53799e28bd72f75bd5e01765414a0e11b8045f671e723beb46d90a50f5dd1846
diff --git a/dev-util/valgrind/files/valgrind-3.13.0-accept-read-only-PT_LOAD-segments-and-rodata.patch b/dev-util/valgrind/files/valgrind-3.13.0-accept-read-only-PT_LOAD-segments-and-rodata.patch
new file mode 100644
index 000000000000..41f73b43f351
--- /dev/null
+++ b/dev-util/valgrind/files/valgrind-3.13.0-accept-read-only-PT_LOAD-segments-and-rodata.patch
@@ -0,0 +1,95 @@
+See https://bugs.gentoo.org/664882
+
+From 64aa729bfae71561505a40c12755bd6b55bb3061 Mon Sep 17 00:00:00 2001
+From: Mark Wielaard <mark@klomp.org>
+Date: Thu, 12 Jul 2018 13:56:00 +0200
+Subject: [PATCH] Accept read-only PT_LOAD segments and .rodata.
+
+The new binutils ld -z separate-code option creates multiple read-only
+PT_LOAD segments and might place .rodata in a non-executable segment.
+
+Allow and keep track of separate read-only segments and allow a readonly
+page with .rodata section.
+
+Based on patches from Tom Hughes <tom@compton.nu> and
+H.J. Lu <hjl.tools@gmail.com>.
+
+https://bugs.kde.org/show_bug.cgi?id=395682
+---
+ coregrind/m_debuginfo/debuginfo.c | 2 --
+ coregrind/m_debuginfo/readelf.c | 34 +++++++++++++++++++++++--------
+ 3 files changed, 27 insertions(+), 10 deletions(-)
+
+--- a/coregrind/m_debuginfo/debuginfo.c
++++ b/coregrind/m_debuginfo/debuginfo.c
+@@ -957,9 +957,7 @@
+ # error "Unknown platform"
+ # endif
+
+-# if defined(VGP_x86_darwin) && DARWIN_VERS >= DARWIN_10_7
+ is_ro_map = seg->hasR && !seg->hasW && !seg->hasX;
+-# endif
+
+ # if defined(VGO_solaris)
+ is_rx_map = seg->hasR && seg->hasX && !seg->hasW;
+--- a/coregrind/m_debuginfo/readelf.c
++++ b/coregrind/m_debuginfo/readelf.c
+@@ -1785,7 +1785,7 @@
+ Bool loaded = False;
+ for (j = 0; j < VG_(sizeXA)(di->fsm.maps); j++) {
+ const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, j);
+- if ( (map->rx || map->rw)
++ if ( (map->rx || map->rw || map->ro)
+ && map->size > 0 /* stay sane */
+ && a_phdr.p_offset >= map->foff
+ && a_phdr.p_offset < map->foff + map->size
+@@ -1816,6 +1816,16 @@
+ i, (UWord)item.bias);
+ loaded = True;
+ }
++ if (map->ro
++ && (a_phdr.p_flags & (PF_R | PF_W | PF_X))
++ == PF_R) {
++ item.exec = False;
++ VG_(addToXA)(svma_ranges, &item);
++ TRACE_SYMTAB(
++ "PT_LOAD[%ld]: acquired as ro, bias 0x%lx\n",
++ i, (UWord)item.bias);
++ loaded = True;
++ }
+ }
+ }
+ if (!loaded) {
+@@ -2083,17 +2093,25 @@
+ }
+ }
+
+- /* Accept .rodata where mapped as rx (data), even if zero-sized */
++ /* Accept .rodata where mapped as rx or rw (data), even if zero-sized */
+ if (0 == VG_(strcmp)(name, ".rodata")) {
+- if (inrx && !di->rodata_present) {
+- di->rodata_present = True;
++ if (!di->rodata_present) {
+ di->rodata_svma = svma;
+- di->rodata_avma = svma + inrx->bias;
++ di->rodata_avma = svma;
+ di->rodata_size = size;
+- di->rodata_bias = inrx->bias;
+ di->rodata_debug_svma = svma;
+- di->rodata_debug_bias = inrx->bias;
+- /* NB was 'inrw' prior to r11794 */
++ if (inrx) {
++ di->rodata_avma += inrx->bias;
++ di->rodata_bias = inrx->bias;
++ di->rodata_debug_bias = inrx->bias;
++ } else if (inrw) {
++ di->rodata_avma += inrw->bias;
++ di->rodata_bias = inrw->bias;
++ di->rodata_debug_bias = inrw->bias;
++ } else {
++ BAD(".rodata");
++ }
++ di->rodata_present = True;
+ TRACE_SYMTAB("acquiring .rodata svma = %#lx .. %#lx\n",
+ di->rodata_svma,
+ di->rodata_svma + di->rodata_size - 1);
diff --git a/dev-util/valgrind/files/valgrind-3.13.0-ignore-further-mappings-after-read-all-debuginfo.patch b/dev-util/valgrind/files/valgrind-3.13.0-ignore-further-mappings-after-read-all-debuginfo.patch
new file mode 100644
index 000000000000..5b47512c1553
--- /dev/null
+++ b/dev-util/valgrind/files/valgrind-3.13.0-ignore-further-mappings-after-read-all-debuginfo.patch
@@ -0,0 +1,70 @@
+Follow up for valgrind-3.13.0-accept-read-only-PT_LOAD-segments-and-rodata.patch.
+
+From e752326cc050803c3bcfde1f8606bead66ff9642 Mon Sep 17 00:00:00 2001
+From: Julian Seward <jseward@acm.org>
+Date: Tue, 14 Aug 2018 10:13:46 +0200
+Subject: [PATCH] VG_(di_notify_mmap): once we've read debuginfo for an object,
+ ignore all further mappings. n-i-bz.
+
+Once we've read debuginfo for an object, ignore all further mappings. If we
+don't do that, applications that mmap in their own objects to inspect them for
+whatever reason, will cause "irrelevant" mappings to be recorded in the
+object's fsm.maps table. This can lead to serious problems later on.
+
+This has become necessary because 64aa729bfae71561505a40c12755bd6b55bb3061 of
+Thu Jul 12 2018 (the fix for bug 395682) started recording readonly segments
+in the fsm.maps table, where before they were ignored.
+---
+ coregrind/m_debuginfo/debuginfo.c | 29 ++++++++++++++++++++++++++++-
+ 1 file changed, 28 insertions(+), 1 deletion(-)
+
+diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
+index c36d498..55c05cb 100644
+--- a/coregrind/m_debuginfo/debuginfo.c
++++ b/coregrind/m_debuginfo/debuginfo.c
+@@ -1200,6 +1200,32 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd )
+ di = find_or_create_DebugInfo_for( filename );
+ vg_assert(di);
+
++ /* Ignore all mappings for this filename once we've read debuginfo for it.
++ This avoids the confusion of picking up "irrelevant" mappings in
++ applications which mmap their objects outside of ld.so, for example
++ Firefox's Gecko profiler.
++
++ What happens in that case is: the application maps the object "ro" for
++ whatever reason. We record the mapping di->fsm.maps. The application
++ later unmaps the object. However, the mapping is not removed from
++ di->fsm.maps. Later, when some other (unrelated) object is mapped (via
++ ld.so) into that address space, we first unload any debuginfo that has a
++ mapping intersecting that area. That means we will end up incorrectly
++ unloading debuginfo for the object with the "irrelevant" mappings. This
++ causes various problems, not least because it can unload the debuginfo
++ for libc.so and so cause malloc intercepts to become un-intercepted.
++
++ This fix assumes that all mappings made once we've read debuginfo for
++ an object are irrelevant. I think that's OK, but need to check with
++ mjw/thh. */
++ if (di->have_dinfo) {
++ if (debug)
++ VG_(printf)("di_notify_mmap-4x: "
++ "ignoring mapping because we already read debuginfo "
++ "for DebugInfo* %p\n", di);
++ return 0;
++ }
++
+ if (debug)
+ VG_(printf)("di_notify_mmap-4: "
+ "noting details in DebugInfo* at %p\n", di);
+@@ -1220,7 +1246,8 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd )
+ di->fsm.have_ro_map |= is_ro_map;
+
+ /* So, finally, are we in an accept state? */
+- if (di->fsm.have_rx_map && di->fsm.have_rw_map && !di->have_dinfo) {
++ vg_assert(!di->have_dinfo);
++ if (di->fsm.have_rx_map && di->fsm.have_rw_map) {
+ /* Ok, so, finally, we found what we need, and we haven't
+ already read debuginfo for this object. So let's do so now.
+ Yee-ha! */
+--
+2.9.3
+
diff --git a/dev-util/valgrind/valgrind-3.13.0-r3.ebuild b/dev-util/valgrind/valgrind-3.13.0-r3.ebuild
new file mode 100644
index 000000000000..4c963a7314dd
--- /dev/null
+++ b/dev-util/valgrind/valgrind-3.13.0-r3.ebuild
@@ -0,0 +1,128 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit autotools flag-o-matic toolchain-funcs multilib pax-utils
+
+DESCRIPTION="An open-source memory debugger for GNU/Linux"
+HOMEPAGE="http://www.valgrind.org"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="mpi"
+
+if [[ ${PV} == "9999" ]]; then
+ EGIT_REPO_URI="git://sourceware.org/git/${PN}.git/"
+ inherit git-r3
+else
+ SRC_URI="ftp://sourceware.org/pub/valgrind/${P}.tar.bz2"
+ KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris"
+fi
+
+DEPEND="mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ # Correct hard coded doc location
+ sed -i -e "s:doc/valgrind:doc/${PF}:" docs/Makefile.am || die
+
+ # Don't force multiarch stuff on OSX, bug #306467
+ sed -i -e 's:-arch \(i386\|x86_64\)::g' Makefile.all.am || die
+
+ # Respect CFLAGS, LDFLAGS
+ eapply "${FILESDIR}"/${PN}-3.7.0-respect-flags.patch
+
+ # Fix test failures on glibc-2.26
+ eapply "${FILESDIR}"/${P}-test-fixes.patch
+
+ # Fix --xml-socket command line option (qt-creator), bug #641790
+ eapply "${FILESDIR}"/${P}-xml-socket.patch
+
+ # Fix reading debug info from binaries built with -z separate-code, bug #664882
+ eapply "${FILESDIR}"/${P}-accept-read-only-PT_LOAD-segments-and-rodata.patch
+ eapply "${FILESDIR}"/${P}-ignore-further-mappings-after-read-all-debuginfo.patch
+
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ # upstream doesn't support this, but we don't build with
+ # Sun/Oracle ld, we have a GNU toolchain, so get some things
+ # working the Linux/GNU way
+ find "${S}" -name "Makefile.am" -o -name "Makefile.tool.am" | xargs \
+ sed -i -e 's:-M,/usr/lib/ld/map.noexstk:-z,noexecstack:' || die
+ cp "${S}"/coregrind/link_tool_exe_{linux,solaris}.in
+ fi
+
+ # Allow users to test their own patches
+ eapply_user
+
+ # Regenerate autotools files
+ eautoreconf
+}
+
+src_configure() {
+ local myconf=()
+
+ # Respect ar, bug #468114
+ tc-export AR
+
+ # -fomit-frame-pointer "Assembler messages: Error: junk `8' after expression"
+ # while compiling insn_sse.c in none/tests/x86
+ # -fstack-protector more undefined references to __guard and __stack_smash_handler
+ # because valgrind doesn't link to glibc (bug #114347)
+ # -fstack-protector-all Fails same way as -fstack-protector/-fstack-protector-strong.
+ # Note: -fstack-protector-explicit is a no-op for Valgrind, no need to strip it
+ # -fstack-protector-strong See -fstack-protector (bug #620402)
+ # -m64 -mx32 for multilib-portage, bug #398825
+ # -ggdb3 segmentation fault on startup
+ filter-flags -fomit-frame-pointer
+ filter-flags -fstack-protector
+ filter-flags -fstack-protector-all
+ filter-flags -fstack-protector-strong
+ filter-flags -m64 -mx32
+ replace-flags -ggdb3 -ggdb2
+
+ if use amd64 || use ppc64; then
+ ! has_multilib_profile && myconf+=("--enable-only64bit")
+ fi
+
+ # Force bitness on darwin, bug #306467
+ use x86-macos && myconf+=("--enable-only32bit")
+ use x64-macos && myconf+=("--enable-only64bit")
+
+ # Don't use mpicc unless the user asked for it (bug #258832)
+ if ! use mpi; then
+ myconf+=("--without-mpicc")
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_install() {
+ default
+
+ if [[ ${PV} == "9999" ]]; then
+ # Otherwise FAQ.txt won't exist:
+ emake -C docs FAQ.txt
+ mv docs/FAQ.txt . || die "Couldn't move FAQ.txt"
+ fi
+
+ dodoc FAQ.txt
+
+ pax-mark m "${ED}"/usr/$(get_libdir)/valgrind/*-*-linux
+
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ # fix install_names on shared libraries, can't turn them into bundles,
+ # as dyld won't load them any more then, bug #306467
+ local l
+ for l in "${ED}"/usr/lib/valgrind/*.so ; do
+ install_name_tool -id "${EPREFIX}"/usr/lib/valgrind/${l##*/} "${l}"
+ done
+ fi
+}
+
+pkg_postinst() {
+ elog "Valgrind will not work if glibc does not have debug symbols."
+ elog "To fix this you can add splitdebug to FEATURES in make.conf"
+ elog "and remerge glibc. See:"
+ elog "https://bugs.gentoo.org/show_bug.cgi?id=214065"
+ elog "https://bugs.gentoo.org/show_bug.cgi?id=274771"
+ elog "https://bugs.gentoo.org/show_bug.cgi?id=388703"
+}