From fe2176acc032e68d3af32f8dc92bd61042a28ed2cb98d2fed7504963f04a6d76 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 15 Feb 2016 16:07:18 +0000 Subject: [PATCH 1/2] - update to 3.11.0: * 3.11.0 is a feature release with many improvements and the usual collection of bug fixes. - replace gcc-version.patch with gcc5.patch: This is the upstream version - drop valgrind-linux-4.0.patch: merged upstream - add svn-r15766.patch: Fix valgrind with recent kernels - jit-register-unregister.diff commented out, needs porting OBS-URL: https://build.opensuse.org/package/show/devel:tools/valgrind?expand=0&rev=134 --- armv6-support.diff | 6 +- gcc-version.patch | 13 ---- gcc5.patch | 58 +++++++++++++++ glibc-version.patch | 8 +-- jit-register-unregister.diff | 33 +++++---- svn-r15766.patch | 133 +++++++++++++++++++++++++++++++++++ valgrind-3.10.1.tar.bz2 | 3 - valgrind-3.11.0.tar.bz2 | 3 + valgrind-linux-4.0.patch | 31 -------- valgrind.changes | 12 ++++ valgrind.spec | 21 +++--- 11 files changed, 242 insertions(+), 79 deletions(-) delete mode 100644 gcc-version.patch create mode 100644 gcc5.patch create mode 100644 svn-r15766.patch delete mode 100644 valgrind-3.10.1.tar.bz2 create mode 100644 valgrind-3.11.0.tar.bz2 delete mode 100644 valgrind-linux-4.0.patch diff --git a/armv6-support.diff b/armv6-support.diff index 8645293..72ff70f 100644 --- a/armv6-support.diff +++ b/armv6-support.diff @@ -1,6 +1,8 @@ ---- configure.ac +Index: configure.ac +=================================================================== +--- configure.ac.orig +++ configure.ac -@@ -190,7 +190,7 @@ +@@ -234,7 +234,7 @@ case "${host_cpu}" in ARCH_MAX="s390x" ;; diff --git a/gcc-version.patch b/gcc-version.patch deleted file mode 100644 index fe07937..0000000 --- a/gcc-version.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: configure.ac -=================================================================== ---- configure.ac.orig -+++ configure.ac -@@ -138,7 +138,7 @@ case "${is_clang}-${gcc_version}" in - notclang-4.*) - AC_MSG_RESULT([ok (${gcc_version})]) - ;; -- notclang-5.*) -+ notclang-5*) - AC_MSG_RESULT([ok (${gcc_version})]) - ;; - clang-2.9|clang-3.*|clang-4.*) diff --git a/gcc5.patch b/gcc5.patch new file mode 100644 index 0000000..0715ac1 --- /dev/null +++ b/gcc5.patch @@ -0,0 +1,58 @@ +------------------------------------------------------------------------ +r15773 | bart | 2016-01-25 05:27:25 +0100 (Mo, 25. Jan 2016) | 7 Zeilen + +configure.ac: Port to gcc 5 + +Apparently gcc 5 behaves as follows: +$ gcc -dumpversion +5 + + +------------------------------------------------------------------------ +Index: configure.ac +=================================================================== +--- configure.ac (Revision 15772) ++++ configure.ac (Revision 15773) +@@ -160,7 +160,7 @@ case "${is_clang}-${gcc_version}" in + icc-1[[3-9]].*) + AC_MSG_RESULT([ok (ICC version ${gcc_version})]) + ;; +- notclang-[[3-9]].*|notclang-[[1-9][0-9]]*) ++ notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*) + AC_MSG_RESULT([ok (${gcc_version})]) + ;; + clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*) +Index: drd/tests/std_thread2.cpp +=================================================================== +--- drd/tests/std_thread2.cpp (Revision 15772) ++++ drd/tests/std_thread2.cpp (Revision 15773) +@@ -26,6 +26,7 @@ int main(int argc, char** argv) + return 0; + } + ++#if defined(__GNUC__) && __GNUC__ -0 < 6 + // + // From libstdc++-v3/src/c++11/thread.cc + // +@@ -70,3 +71,4 @@ namespace std + } + } + } ++#endif +Index: drd/tests/std_thread.cpp +=================================================================== +--- drd/tests/std_thread.cpp (Revision 15772) ++++ drd/tests/std_thread.cpp (Revision 15773) +@@ -21,6 +21,7 @@ int main(int argc, char** argv) + return 0; + } + ++#if defined(__GNUC__) && __GNUC__ -0 < 6 + // + // From libstdc++-v3/src/c++11/thread.cc + // +@@ -65,3 +66,4 @@ namespace std + } + } + } ++#endif diff --git a/glibc-version.patch b/glibc-version.patch index 65857f6..4d88ab2 100644 --- a/glibc-version.patch +++ b/glibc-version.patch @@ -1,8 +1,8 @@ -Index: valgrind-3.10.1/configure.ac +Index: valgrind-3.11.0/configure.ac =================================================================== ---- valgrind-3.10.1.orig/configure.ac -+++ valgrind-3.10.1/configure.ac -@@ -1018,6 +1018,20 @@ case "${GLIBC_VERSION}" in +--- valgrind-3.11.0.orig/configure.ac ++++ valgrind-3.11.0/configure.ac +@@ -1049,6 +1049,20 @@ case "${GLIBC_VERSION}" in DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" ;; diff --git a/jit-register-unregister.diff b/jit-register-unregister.diff index 5af4830..def6e92 100644 --- a/jit-register-unregister.diff +++ b/jit-register-unregister.diff @@ -2,7 +2,7 @@ Index: coregrind/m_debuginfo/debuginfo.c =================================================================== --- coregrind/m_debuginfo/debuginfo.c.orig +++ coregrind/m_debuginfo/debuginfo.c -@@ -50,6 +50,7 @@ +@@ -49,6 +49,7 @@ #include "pub_core_oset.h" #include "pub_core_stacktrace.h" // VG_(get_StackTrace) XXX: circular dependency #include "pub_core_ume.h" @@ -10,8 +10,8 @@ Index: coregrind/m_debuginfo/debuginfo.c #include "priv_misc.h" /* dinfo_zalloc/free */ #include "priv_image.h" -@@ -1319,6 +1320,132 @@ void VG_(di_notify_pdb_debuginfo)( Int f - #endif /* defined(VGO_linux) || defined(VGO_darwin) */ +@@ -1430,6 +1431,132 @@ void VG_(di_notify_pdb_debuginfo)( Int f + #endif /* defined(VGO_linux) || defined(VGO_darwin) || defined(VGO_solaris) */ +/* Storing and retrieving information caused by JITted code. TODO: @@ -143,32 +143,31 @@ Index: coregrind/m_debuginfo/debuginfo.c /*------------------------------------------------------------*/ /*--- ---*/ /*--- TOP LEVEL: QUERYING EXISTING DEBUG INFO ---*/ -@@ -1638,8 +1765,19 @@ Bool get_sym_name ( Bool do_cxx_demangli +@@ -1755,8 +1882,18 @@ Bool get_sym_name ( Bool do_cxx_demangli PtrdiffT offset; search_all_symtabs ( a, &di, &sno, match_anywhere_in_sym, findText ); -- if (di == NULL) +- if (di == NULL) { + if (di == NULL) + { + *buf = ""; + if (findText) + { -+ JitEntry* je = jit_lookup (a, buf, nbuf); -+ if (!je) -+ return False; -+ if (offsetP) -+ *offsetP = a - je->start; -+ return True; ++ JitEntry* je = jit_lookup (a, buf, nbuf); ++ if (!je) ++ return False; ++ if (offsetP) ++ *offsetP = a - je->start; ++ return True; + } return False; -+ } + } - vg_assert(di->symtab[sno].pri_name); - VG_(demangle) ( do_cxx_demangling, do_z_demangling, Index: coregrind/m_scheduler/scheduler.c =================================================================== --- coregrind/m_scheduler/scheduler.c.orig +++ coregrind/m_scheduler/scheduler.c -@@ -2062,6 +2062,16 @@ void do_client_request ( ThreadId tid ) +@@ -2087,6 +2087,16 @@ void do_client_request ( ThreadId tid ) LibVEX_InitIRI ( (IRICB *)arg[1] ); break; @@ -206,7 +205,7 @@ Index: include/valgrind.h =================================================================== --- include/valgrind.h.orig +++ include/valgrind.h -@@ -6170,6 +6170,10 @@ typedef +@@ -6706,6 +6706,10 @@ typedef /* Querying of debug info. */ VG_USERREQ__MAP_IP_TO_SRCLOC = 0x1701, @@ -217,7 +216,7 @@ Index: include/valgrind.h /* Disable/enable error reporting level. Takes a single Word arg which is the delta to this thread's error disablement indicator. Hence 1 disables or further -@@ -6337,6 +6341,19 @@ VALGRIND_PRINTF_BACKTRACE(const char *fo +@@ -6873,6 +6877,19 @@ VALGRIND_PRINTF_BACKTRACE(const char *fo _qyy_arg1, _qyy_arg2, \ _qyy_arg3, 0) diff --git a/svn-r15766.patch b/svn-r15766.patch new file mode 100644 index 0000000..3fa4f21 --- /dev/null +++ b/svn-r15766.patch @@ -0,0 +1,133 @@ +------------------------------------------------------------------------ +r15766 | mjw | 2016-01-21 12:37:43 +0100 (Do, 21. Jan 2016) | 13 Zeilen + +Bug #357833 Setting RLIMIT_DATA to zero breaks with linux 4.5+ + +We used to set the process datasize rlimit to zero to prevent +any internal use of brk() from having any effect. But later +linux kernels redefine RLIMIT_DATA as the size of any data +areas, including some dynamic mmap memory allocations. + +See bug #357833 for the commit that went into linux 4.5 +changing the definition of RLIMIT_DATA. So don't mess with +RLIMIT_DATA anymore. Just remember it for use in the syscall +wrappers. + +This also cleans up some hacks around the execv and spawn wrappers. +------------------------------------------------------------------------ +Index: coregrind/m_syswrap/syswrap-generic.c +=================================================================== +--- coregrind/m_syswrap/syswrap-generic.c.orig ++++ coregrind/m_syswrap/syswrap-generic.c +@@ -3014,9 +3014,6 @@ PRE(sys_execve) + vg_assert(j == tot_args+1); + } + +- /* restore the DATA rlimit for the child */ +- VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data)); +- + /* + Set the signal state up for exec. + +Index: coregrind/m_syswrap/syswrap-solaris.c +=================================================================== +--- coregrind/m_syswrap/syswrap-solaris.c.orig ++++ coregrind/m_syswrap/syswrap-solaris.c +@@ -1539,21 +1539,12 @@ PRE(sys_spawn) + #undef COPY_CHAR_TO_ARGENV + #undef COPY_STRING_TOARGENV + +- /* HACK: Temporarily restore the DATA rlimit for spawned child. +- This is a terrible hack to provide sensible brk limit for child. */ +- VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data)); +- + /* Actual spawn() syscall. */ + SysRes res = VG_(do_syscall5)(__NR_spawn, (UWord) path, (UWord) attrs, + attrs_size, (UWord) argenv, argenv_size); + SET_STATUS_from_SysRes(res); + VG_(free)(argenv); + +- /* Restore DATA rlimit back to its previous value set in m_main.c. */ +- struct vki_rlimit zero = { 0, 0 }; +- zero.rlim_max = VG_(client_rlimit_data).rlim_max; +- VG_(setrlimit)(VKI_RLIMIT_DATA, &zero); +- + if (SUCCESS) { + PRINT(" spawn: process %d spawned child %ld\n", VG_(getpid)(), RES); + } +@@ -3619,9 +3610,6 @@ PRE(sys_execve) + VG_(sigprocmask)(VKI_SIG_SETMASK, &tst->sig_mask, NULL); + } + +- /* Restore the DATA rlimit for the child. */ +- VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data)); +- + /* Debug-only printing. */ + if (0) { + HChar **cpp; +Index: coregrind/m_main.c +=================================================================== +--- coregrind/m_main.c.orig ++++ coregrind/m_main.c +@@ -1627,7 +1627,6 @@ Int valgrind_main ( Int argc, HChar **ar + Bool logging_to_fd = False; + const HChar* xml_fname_unexpanded = NULL; + Int loglevel, i; +- struct vki_rlimit zero = { 0, 0 }; + XArray* addr2dihandle = NULL; + + //============================================================ +@@ -1800,13 +1799,15 @@ Int valgrind_main ( Int argc, HChar **ar + VG_(debugLog)(1, "main", "... %s\n", VG_(name_of_launcher)); + + //-------------------------------------------------------------- +- // Get the current process datasize rlimit, and set it to zero. +- // This prevents any internal uses of brk() from having any effect. +- // We remember the old value so we can restore it on exec, so that +- // child processes will have a reasonable brk value. ++ // We used to set the process datasize rlimit to zero to prevent ++ // any internal use of brk() from having any effect. But later ++ // linux kernels redefine RLIMIT_DATA as the size of any data ++ // areas, including some dynamic mmap memory allocations. ++ // See bug #357833 for the commit that went into linux 4.5 ++ // changing the definition of RLIMIT_DATA. So don't mess with ++ // RLIMIT_DATA here now anymore. Just remember it for use in ++ // the syscall wrappers. + VG_(getrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data)); +- zero.rlim_max = VG_(client_rlimit_data).rlim_max; +- VG_(setrlimit)(VKI_RLIMIT_DATA, &zero); + + // Get the current process stack rlimit. + VG_(getrlimit)(VKI_RLIMIT_STACK, &VG_(client_rlimit_stack)); +Index: coregrind/m_libcproc.c +=================================================================== +--- coregrind/m_libcproc.c.orig ++++ coregrind/m_libcproc.c +@@ -450,9 +450,6 @@ void VG_(execv) ( const HChar* filename, + HChar** envp; + SysRes res; + +- /* restore the DATA rlimit for the child */ +- VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data)); +- + envp = VG_(env_clone)(VG_(client_envp)); + VG_(env_remove_valgrind_env_stuff)( envp, True /*ro_strings*/, NULL ); + +@@ -511,17 +508,9 @@ Int VG_(spawn) ( const HChar *filename, + # undef COPY_CHAR_TO_ARGENV + # undef COPY_STRING_TOARGENV + +- /* HACK: Temporarily restore the DATA rlimit for spawned child. */ +- VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data)); +- + SysRes res = VG_(do_syscall5)(__NR_spawn, (UWord) filename, (UWord) NULL, 0, + (UWord) argenv, argenv_size); + +- /* Restore DATA rlimit back to its previous value set in m_main.c. */ +- struct vki_rlimit zero = { 0, 0 }; +- zero.rlim_max = VG_(client_rlimit_data).rlim_max; +- VG_(setrlimit)(VKI_RLIMIT_DATA, &zero); +- + VG_(free)(argenv); + for (HChar **p = envp; *p != NULL; p++) { + VG_(free)(*p); diff --git a/valgrind-3.10.1.tar.bz2 b/valgrind-3.10.1.tar.bz2 deleted file mode 100644 index 15301a9..0000000 --- a/valgrind-3.10.1.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fa253dc26ddb661b6269df58144eff607ea3f76a9bcfe574b0c7726e1dfcb997 -size 10967905 diff --git a/valgrind-3.11.0.tar.bz2 b/valgrind-3.11.0.tar.bz2 new file mode 100644 index 0000000..e023234 --- /dev/null +++ b/valgrind-3.11.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c396271a8c1ddd5a6fb9abe714ea1e8a86fce85b30ab26b4266aeb4c2413b42 +size 11910809 diff --git a/valgrind-linux-4.0.patch b/valgrind-linux-4.0.patch deleted file mode 100644 index 07586dd..0000000 --- a/valgrind-linux-4.0.patch +++ /dev/null @@ -1,31 +0,0 @@ -Index: configure.ac -=================================================================== ---- configure.ac (revision 14954) -+++ configure.ac (revision 14955) -@@ -325,20 +325,14 @@ - kernel=`uname -r` - - case "${kernel}" in -- 2.6.*|3.*) -- AC_MSG_RESULT([2.6.x/3.x family (${kernel})]) -- AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x or Linux 3.x]) -+ 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*) -+ AC_MSG_RESULT([unsupported (${kernel})]) -+ AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6]) - ;; - -- 2.4.*) -- AC_MSG_RESULT([2.4 family (${kernel})]) -- AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x]) -- ;; -- -- *) -- AC_MSG_RESULT([unsupported (${kernel})]) -- AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6]) -- ;; -+ *) -+ AC_MSG_RESULT([2.6 or later (${kernel})]) -+ ;; - esac - - ;; diff --git a/valgrind.changes b/valgrind.changes index 0264ac3..34f1b0e 100644 --- a/valgrind.changes +++ b/valgrind.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Mon Feb 15 16:04:59 UTC 2016 - dmueller@suse.com + +- update to 3.11.0: + * 3.11.0 is a feature release with many improvements and the usual + collection of bug fixes. +- replace gcc-version.patch with gcc5.patch: This is the upstream + version +- drop valgrind-linux-4.0.patch: merged upstream +- add svn-r15766.patch: Fix valgrind with recent kernels +- jit-register-unregister.diff commented out, needs porting + ------------------------------------------------------------------- Thu Aug 6 12:09:47 UTC 2015 - schwab@suse.de diff --git a/valgrind.spec b/valgrind.spec index d5fb1c3..51227d4 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -1,7 +1,7 @@ # # spec file for package valgrind # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,7 +25,7 @@ %define building_docs 0 %endif Name: valgrind -Version: 3.10.1 +Version: 3.11.0 Release: 0 Summary: Memory Management Debugger License: GPL-2.0+ @@ -37,8 +37,8 @@ Source0: http://valgrind.org/downloads/%{name}-%{version}.tar.bz2 Patch1: jit-register-unregister.diff Patch2: armv6-support.diff Patch3: glibc-version.patch -Patch4: gcc-version.patch -Patch5: valgrind-linux-4.0.patch +Patch4: gcc5.patch +Patch5: svn-r15766.patch BuildRequires: automake BuildRequires: docbook-xsl-stylesheets BuildRequires: docbook_4 @@ -110,22 +110,25 @@ but it has been successfully used to optimize several KDE applications. %prep %setup -q -%patch1 +#%patch1 %patch2 %patch3 -p1 %patch4 %patch5 %build +export FLAGS="%{optflags}" %ifarch %arm # Valgrind doesn't support compiling for Thumb yet. Remove when it gets # native thumb support. -RPM_OPT_FLAGS=${RPM_OPT_FLAGS/-mthumb/-mthumb-interwork -marm} +FLAGS=${FLAGS/-mthumb/-mthumb-interwork -marm} %endif # not a good idea to build valgrind with fortify, as it does not link glibc -RPM_OPT_FLAGS="${RPM_OPT_FLAGS/-D_FORTIFY_SOURCE=2/}" -export CFLAGS="%{optflags}" -export CXXFLAGS="%{optflags}" +FLAGS="${FLAGS/-D_FORTIFY_SOURCE=2/}" +FLAGS="${FLAGS/-fstack-protector/}" +export CFLAGS="$FLAGS" +export CXXFLAGS="$FLAGS" +export FFLAGS="$FLAGS" %if 0%{?suse_version} > 1100 autoreconf -fi %endif From f644d090f62c47598f326e85a99f605f69cec8ec064f4623d025f172c9f9983a Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 15 Feb 2016 20:39:51 +0000 Subject: [PATCH 2/2] OBS-URL: https://build.opensuse.org/package/show/devel:tools/valgrind?expand=0&rev=135 --- valgrind.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/valgrind.spec b/valgrind.spec index 51227d4..d2f25bb 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -110,7 +110,8 @@ but it has been successfully used to optimize several KDE applications. %prep %setup -q -#%patch1 +# needs porting to 3.11 +##%patch1 %patch2 %patch3 -p1 %patch4