diff --git a/.gitignore b/.gitignore index 823cbe4..f76539f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /valgrind-3.19.0.tar.bz2 /valgrind-3.21.0.tar.bz2 +/valgrind-3.22.0.tar.bz2 diff --git a/sources b/sources index efed6a2..9965f6f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.21.0.tar.bz2) = 3e86cda2f2d6cd30807fac7933ba2c46a97a2b4a868db989e6b0cceeadf029af7ee34ba900466a346948289aacb30f4399799bb83b97cc49a4d2d810441e5cfd +SHA512 (valgrind-3.22.0.tar.bz2) = 2904c13f68245bbafcea70998c6bd20725271300a7e94b6751ca00916943595fc3fac8557da7ea8db31b54a43f092823a0a947bc142829da811d074e1fe49777 diff --git a/valgrind-3.16.0-some-Wl-z-now.patch b/valgrind-3.16.0-some-Wl-z-now.patch index 6231733..f6001d2 100644 --- a/valgrind-3.16.0-some-Wl-z-now.patch +++ b/valgrind-3.16.0-some-Wl-z-now.patch @@ -48,8 +48,8 @@ index 3c73210..fb6b7bb 100644 # If there is no secondary platform, and the platforms include x86-darwin, # then the primary platform must be x86-darwin. Hence: if ! VGCONF_HAVE_PLATFORM_SEC -@@ -96,7 +96,7 @@ endif - vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) +@@ -104,7 +104,7 @@ + vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) $(GDB_SCRIPTS_DIR) vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI) -vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ diff --git a/valgrind-3.16.0-some-stack-protector.patch b/valgrind-3.16.0-some-stack-protector.patch index b53c465..751cf39 100644 --- a/valgrind-3.16.0-some-stack-protector.patch +++ b/valgrind-3.16.0-some-stack-protector.patch @@ -94,10 +94,10 @@ index 94030fd..3c73210 100644 valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI) valgrind_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ # If there is no secondary platform, and the platforms include x86-darwin, -@@ -94,7 +94,7 @@ vgdb_SOURCES += vgdb-invoker-solaris.c +@@ -102,7 +102,7 @@ endif - vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) + vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) $(GDB_SCRIPTS_DIR) -vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) +vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI) diff --git a/valgrind-3.21.0-Add-with-gdbscripts-dir.patch b/valgrind-3.21.0-Add-with-gdbscripts-dir.patch deleted file mode 100644 index c241dc3..0000000 --- a/valgrind-3.21.0-Add-with-gdbscripts-dir.patch +++ /dev/null @@ -1,152 +0,0 @@ -From e3602b3eec0696b183722ea21da14588cf205c74 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Sun, 14 May 2023 23:34:05 +0200 -Subject: [PATCH] Add --with-gdbscripts-dir=PATH configure option - -Currently the gdb valgrind scripts are installed under VG_LIBDIR -which is normally pkglibexecdir which is likely not in the default -gdb safe-path (a list of directories from which it is safe to -auto-load files). So users will have to add the directory to their -.gdbinit file. - -This patch adds a --with-gdbscripts-dir=PATH configure option that -sets VG_GDBSCRIPTS_DIR to the given PATH (${libexecdir}/valgrind if -not given). A user can also configure --without-gdbscripts-dir to -disable adding a .debug_gdb_scripts section to the vgpreload library -and installing the valgrind-monitor python scripts completely. - -Use VG_GDBSCRIPTS_DIR as gdbscriptsdir to install the valgrind-monitor -python files and pass it with CPPFLAGS when building vg_preloaded.c -and vgdb.c to use instead of VG_LIBDIR. - -https://bugs.kde.org/show_bug.cgi?id=469768 ---- - NEWS | 8 ++++++++ - configure.ac | 17 +++++++++++++++++ - coregrind/Makefile.am | 20 +++++++++++++++----- - coregrind/vg_preloaded.c | 4 +++- - coregrind/vgdb.c | 9 +++++++-- - 5 files changed, 50 insertions(+), 8 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 15fbf5ea2..0cf84a1c0 100755 ---- a/configure.ac -+++ b/configure.ac -@@ -1198,6 +1198,23 @@ AC_MSG_RESULT([$xcodedir]) - AC_DEFINE_UNQUOTED(XCODE_DIR, "$xcodedir", [xcode sdk include directory]) - AC_SUBST(XCODE_DIR, [$xcodedir])]) - -+#---------------------------------------------------------------------------- -+# Where to install gdb scripts, defaults to VG_LIBDIR (pkglibexecdir) -+#---------------------------------------------------------------------------- -+AC_MSG_CHECKING([where gdb scripts are installed]) -+AC_ARG_WITH(gdbscripts-dir, -+ [ --with-gdbscripts-dir=PATH Specify path to install gdb scripts], -+ [gdbscriptsdir=${withval}], -+ [gdbscriptsdir=${libexecdir}/valgrind]) -+AC_MSG_RESULT([$gdbscriptsdir]) -+if test "x$gdbscriptsdir" != "xno"; then -+ AC_SUBST(VG_GDBSCRIPTS_DIR, [$gdbscriptsdir]) -+ AM_CONDITIONAL(GDBSCRIPTS, true) -+else -+ AC_SUBST(VG_GDBSCRIPTS_DIR, []) -+ AM_CONDITIONAL(GDBSCRIPTS, false) -+fi -+ - #---------------------------------------------------------------------------- - # Libc and suppressions - #---------------------------------------------------------------------------- -diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am -index 553211782..8a7f753a6 100644 ---- a/coregrind/Makefile.am -+++ b/coregrind/Makefile.am -@@ -101,7 +101,7 @@ - vgdb_SOURCES += vgdb-invoker-freebsd.c - endif - --vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) -+vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) $(GDB_SCRIPTS_DIR) - vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong - vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI) - vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ -Wl,-z,now -@@ -624,9 +624,15 @@ if VGCONF_OS_IS_DARWIN - noinst_DSYMS = $(noinst_PROGRAMS) - endif - -+if GDBSCRIPTS -+ GDB_SCRIPTS_DIR=-DVG_GDBSCRIPTS_DIR="\"@VG_GDBSCRIPTS_DIR@\"" -+else -+ GDB_SCRIPTS_DIR= -+endif -+ - vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_SOURCES = vg_preloaded.c - vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CPPFLAGS = \ -- $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -+ $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) $(GDB_SCRIPTS_DIR) - vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CFLAGS = \ - $(AM_CFLAGS_PSO_@VGCONF_PLATFORM_PRI_CAPS@) - vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \ -@@ -634,7 +640,7 @@ vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \ - if VGCONF_HAVE_PLATFORM_SEC - vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = vg_preloaded.c - vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CPPFLAGS = \ -- $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) -+ $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) $(GDBSCRIPTS_DIR) - vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CFLAGS = \ - $(AM_CFLAGS_PSO_@VGCONF_PLATFORM_SEC_CAPS@) - vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_LDFLAGS = \ -@@ -766,8 +772,12 @@ GDBSERVER_XML_FILES = \ - # so as to make sure these get copied into the install tree - vglibdir = $(pkglibexecdir) - vglib_DATA = $(GDBSERVER_XML_FILES) --vglib_DATA += m_gdbserver/valgrind-monitor.py --vglib_DATA += m_gdbserver/valgrind-monitor-def.py -+ -+if GDBSCRIPTS -+gdbscriptsdir = @VG_GDBSCRIPTS_DIR@ -+gdbscripts_DATA = m_gdbserver/valgrind-monitor.py -+gdbscripts_DATA += m_gdbserver/valgrind-monitor-def.py -+endif - - # so as to make sure these get copied into the tarball - EXTRA_DIST += $(GDBSERVER_XML_FILES) -diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c -index d6e05898c..86f6ac5a2 100644 ---- a/coregrind/vg_preloaded.c -+++ b/coregrind/vg_preloaded.c -@@ -61,7 +61,9 @@ - .popsection \n\ - "); - --DEFINE_GDB_PY_SCRIPT(VG_LIBDIR "/valgrind-monitor.py") -+#ifdef VG_GDBSCRIPTS_DIR -+DEFINE_GDB_PY_SCRIPT(VG_GDBSCRIPTS_DIR "/valgrind-monitor.py") -+#endif - #endif - - #if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd) -diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c -index 8ec424077..56a969de7 100644 ---- a/coregrind/vgdb.c -+++ b/coregrind/vgdb.c -@@ -1982,10 +1982,15 @@ void usage(void) - " -d arg tells to show debug info. Multiple -d args for more debug info\n" - "\n" - " -h --help shows this message\n" -+#ifdef VG_GDBSCRIPTS_DIR - " The GDB python code defining GDB front end valgrind commands is:\n %s\n" -+#endif - " To get help from the Valgrind gdbserver, use vgdb help\n" --"\n", vgdb_prefix_default(), VG_LIBDIR "/valgrind-monitor.py" -- ); -+"\n", vgdb_prefix_default() -+#ifdef VG_GDBSCRIPTS_DIR -+ , VG_GDBSCRIPTS_DIR "/valgrind-monitor.py" -+#endif -+ ); - invoker_restrictions_msg(); - } - --- -2.31.1 - diff --git a/valgrind-3.21.0-callgrind_control-no-strict.patch b/valgrind-3.21.0-callgrind_control-no-strict.patch deleted file mode 100644 index 2aaecd4..0000000 --- a/valgrind-3.21.0-callgrind_control-no-strict.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/callgrind/callgrind_control.in b/callgrind/callgrind_control.in -index 083ffa29f..eb50c16ad 100644 ---- a/callgrind/callgrind_control.in -+++ b/callgrind/callgrind_control.in -@@ -22,7 +22,6 @@ - # You should have received a copy of the GNU General Public License - # along with this program; if not, see . - --use strict; - use warnings; - - use File::Basename; diff --git a/valgrind-3.21.0-no-memcpy-replace-check.patch b/valgrind-3.21.0-no-memcpy-replace-check.patch deleted file mode 100644 index 6e26e04..0000000 --- a/valgrind-3.21.0-no-memcpy-replace-check.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c -index b32f13f76..464e8d4ca 100644 ---- a/shared/vg_replace_strmem.c -+++ b/shared/vg_replace_strmem.c -@@ -1128,7 +1128,7 @@ static inline void my_exit ( int x ) - MEMMOVE_OR_MEMCPY(20181, soname, fnname, 0) - - #define MEMCPY(soname, fnname) \ -- MEMMOVE_OR_MEMCPY(20180, soname, fnname, 1) -+ MEMMOVE_OR_MEMCPY(20180, soname, fnname, 0) /* See KDE bug #402833 */ - - #if defined(VGO_linux) - /* For older memcpy we have to use memmove-like semantics and skip -@@ -1714,8 +1714,6 @@ static inline void my_exit ( int x ) - RECORD_COPY(len); \ - if (len == 0) \ - return dst; \ -- if (is_overlap(dst, src, len, len)) \ -- RECORD_OVERLAP_ERROR("memcpy_chk", dst, src, len); \ - if ( dst > src ) { \ - d = (HChar *)dst + len - 1; \ - s = (const HChar *)src + len - 1; \ diff --git a/valgrind-3.21.0-pgste.patch b/valgrind-3.21.0-pgste.patch deleted file mode 100644 index 4646aa2..0000000 --- a/valgrind-3.21.0-pgste.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 56f1bd12c92806fd18337ba4cd3c0a8d714d0e94 Mon Sep 17 00:00:00 2001 -From: Andreas Arnez -Date: Thu, 15 Jun 2023 17:24:53 +0200 -Subject: [PATCH] Bug 470978 - s390x: Link the tools with -Wl,--s390-pgste - -Programs that require the PGSTE mode to be enabled may currently fail -under Valgrind. In particular this affects qemu-kvm. - -While it is also possible to enable the PGSTE mode globally with - - sysctl vm.allocate_psgte=1 - -the problem can more easily be prevented by linking the Valgrind tools -with -Wl,--s390-pgste. Add a configure check if the linker supports this, -and activate the flag if it does. - -To verify the intended result, the following shell command can be used to -list the executables having this flag set: - - find . -type f -perm -u+x -execdir \ - /bin/sh -c 'readelf -lW $0 2>/dev/null | grep PGSTE' {} \; -print ---- - Makefile.tool.am | 2 +- - configure.ac | 20 ++++++++++++++++++++ - 2 files changed, 21 insertions(+), 1 deletion(-) - -diff --git a/Makefile.tool.am b/Makefile.tool.am -index df9502913..4ce6d5ab0 100644 ---- a/Makefile.tool.am -+++ b/Makefile.tool.am -@@ -78,7 +78,7 @@ TOOL_LDFLAGS_ARM64_LINUX = \ - $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ - - TOOL_LDFLAGS_S390X_LINUX = \ -- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ -+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ @FLAG_S390_PGSTE@ - - TOOL_LDFLAGS_X86_DARWIN = \ - $(TOOL_LDFLAGS_COMMON_DARWIN) -arch i386 -diff --git a/configure.ac b/configure.ac -index 0cf84a1c0..1d4164a7d 100755 ---- a/configure.ac -+++ b/configure.ac -@@ -3096,6 +3096,26 @@ AC_SUBST([FLAG_NO_BUILD_ID], [""]) - fi - CFLAGS=$safe_CFLAGS - -+# On s390x, if the linker supports -Wl,--s390-pgste, then we build the -+# tools with that flag. This enables running programs that need it, such -+# as qemu-kvm. -+if test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX; then -+AC_MSG_CHECKING([if the linker accepts -Wl,--s390-pgste]) -+safe_CFLAGS=$CFLAGS -+CFLAGS="-Wl,--s390-pgste" -+ -+AC_LINK_IFELSE( -+[AC_LANG_PROGRAM([ ], [return 0;])], -+[ -+ AC_SUBST([FLAG_S390_PGSTE], ["-Wl,--s390-pgste"]) -+ AC_MSG_RESULT([yes]) -+], [ -+ AC_SUBST([FLAG_S390_PGSTE], [""]) -+ AC_MSG_RESULT([no]) -+]) -+CFLAGS=$safe_CFLAGS -+fi -+ - # does the ppc assembler support "mtocrf" et al? - AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf]) - --- -2.40.1 - diff --git a/valgrind-3.21.0-realloc-again.patch b/valgrind-3.21.0-realloc-again.patch deleted file mode 100644 index 7501cd2..0000000 --- a/valgrind-3.21.0-realloc-again.patch +++ /dev/null @@ -1,167 +0,0 @@ -From b904112d7084227f8d6fab322bc360a8a6240a51 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Thu, 1 Jun 2023 16:10:56 +0200 -Subject: [PATCH] memcheck: Handle Err_ReallocSizeZero in MC_(eq_Error) - -When an realloc size zero error is emitted MC_(eq_Error) is called to -see if the errors can be deduplicated. This crashed since -Err_ReallocSizeZero wasn't handled. Handle it like Err_Free. - -Also add a testcase for this case and test with both ---realloc-zero-bytes-frees=yes and ---realloc-zero-bytes-frees=no. -Which will report a different number of errors. - -https://bugs.kde.org/show_bug.cgi?id=470520 ---- - memcheck/mc_errors.c | 1 + - memcheck/tests/Makefile.am | 7 +++++++ - memcheck/tests/realloc_size_zero_again.c | 15 +++++++++++++++ - .../realloc_size_zero_again_no.stderr.exp | 18 ++++++++++++++++++ - .../realloc_size_zero_again_no.stdout.exp | 0 - .../tests/realloc_size_zero_again_no.vgtest | 2 ++ - .../realloc_size_zero_again_yes.stderr.exp | 18 ++++++++++++++++++ - .../realloc_size_zero_again_yes.stdout.exp | 0 - .../tests/realloc_size_zero_again_yes.vgtest | 2 ++ - 9 files changed, 63 insertions(+) - create mode 100644 memcheck/tests/realloc_size_zero_again.c - create mode 100644 memcheck/tests/realloc_size_zero_again_no.stderr.exp - create mode 100644 memcheck/tests/realloc_size_zero_again_no.stdout.exp - create mode 100644 memcheck/tests/realloc_size_zero_again_no.vgtest - create mode 100644 memcheck/tests/realloc_size_zero_again_yes.stderr.exp - create mode 100644 memcheck/tests/realloc_size_zero_again_yes.stdout.exp - create mode 100644 memcheck/tests/realloc_size_zero_again_yes.vgtest - -diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c -index 00d6ec301..65210a220 100644 ---- a/memcheck/mc_errors.c -+++ b/memcheck/mc_errors.c -@@ -1041,6 +1041,7 @@ Bool MC_(eq_Error) ( VgRes res, const Error* e1, const Error* e2 ) - case Err_IllegalMempool: - case Err_Overlap: - case Err_Cond: -+ case Err_ReallocSizeZero: - return True; - - case Err_FishyValue: -diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am -index 71c38acba..5a17fd35d 100644 ---- a/memcheck/tests/Makefile.am -+++ b/memcheck/tests/Makefile.am -@@ -291,8 +291,14 @@ EXTRA_DIST = \ - realloc_size_zero.vgtest \ - realloc_size_zero_yes.stderr.exp realloc_size_zero_yes.stdout.exp \ - realloc_size_zero_yes.vgtest \ -+ realloc_size_zero_again_yes.stderr.exp \ -+ realloc_size_zero_again_yes.stdout.exp \ -+ realloc_size_zero_again_yes.vgtest \ - realloc_size_zero_no.stderr.exp realloc_size_zero_no.stdout.exp \ - realloc_size_zero_no.vgtest \ -+ realloc_size_zero_again_no.stderr.exp \ -+ realloc_size_zero_again_no.stdout.exp \ -+ realloc_size_zero_again_no.vgtest \ - realloc_size_zero_off.stderr.exp realloc_size_zero_off.stdout.exp \ - realloc_size_zero_off.vgtest \ - realloc_size_zero_mismatch.stderr.exp \ -@@ -459,6 +465,7 @@ check_PROGRAMS = \ - posix_memalign \ - post-syscall \ - realloc_size_zero realloc_size_zero_mismatch \ -+ realloc_size_zero_again \ - realloc1 realloc2 realloc3 \ - recursive-merge \ - resvn_stack \ -diff --git a/memcheck/tests/realloc_size_zero_again.c b/memcheck/tests/realloc_size_zero_again.c -new file mode 100644 -index 000000000..782d4bde5 ---- /dev/null -+++ b/memcheck/tests/realloc_size_zero_again.c -@@ -0,0 +1,15 @@ -+#include -+ -+int -+main () -+{ -+ char *p = malloc (1024); -+ for (int i = 3; i >= 0; i--) -+ for (int j = 0; j <= 3; j++) -+ { -+ char *q = realloc (p, i * j * 512); -+ p = q; -+ } -+ -+ free (p); -+} -diff --git a/memcheck/tests/realloc_size_zero_again_no.stderr.exp b/memcheck/tests/realloc_size_zero_again_no.stderr.exp -new file mode 100644 -index 000000000..b9c061d1a ---- /dev/null -+++ b/memcheck/tests/realloc_size_zero_again_no.stderr.exp -@@ -0,0 +1,18 @@ -+realloc() with size 0 -+ at 0x........: realloc (vg_replace_malloc.c:...) -+ ... -+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd -+ at 0x........: malloc (vg_replace_malloc.c:...) -+ ... -+ -+ERROR SUMMARY: 7 errors from 1 contexts (suppressed: 0 from 0) -+ -+7 errors in context 1 of 1: -+realloc() with size 0 -+ at 0x........: realloc (vg_replace_malloc.c:...) -+ ... -+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd -+ at 0x........: malloc (vg_replace_malloc.c:...) -+ ... -+ -+ERROR SUMMARY: 7 errors from 1 contexts (suppressed: 0 from 0) -diff --git a/memcheck/tests/realloc_size_zero_again_no.stdout.exp b/memcheck/tests/realloc_size_zero_again_no.stdout.exp -new file mode 100644 -index 000000000..e69de29bb -diff --git a/memcheck/tests/realloc_size_zero_again_no.vgtest b/memcheck/tests/realloc_size_zero_again_no.vgtest -new file mode 100644 -index 000000000..f1757b6c1 ---- /dev/null -+++ b/memcheck/tests/realloc_size_zero_again_no.vgtest -@@ -0,0 +1,2 @@ -+prog: realloc_size_zero_again -+vgopts: -q -s --realloc-zero-bytes-frees=no -diff --git a/memcheck/tests/realloc_size_zero_again_yes.stderr.exp b/memcheck/tests/realloc_size_zero_again_yes.stderr.exp -new file mode 100644 -index 000000000..d40aa2455 ---- /dev/null -+++ b/memcheck/tests/realloc_size_zero_again_yes.stderr.exp -@@ -0,0 +1,18 @@ -+realloc() with size 0 -+ at 0x........: realloc (vg_replace_malloc.c:...) -+ ... -+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd -+ at 0x........: malloc (vg_replace_malloc.c:...) -+ ... -+ -+ERROR SUMMARY: 5 errors from 1 contexts (suppressed: 0 from 0) -+ -+5 errors in context 1 of 1: -+realloc() with size 0 -+ at 0x........: realloc (vg_replace_malloc.c:...) -+ ... -+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd -+ at 0x........: malloc (vg_replace_malloc.c:...) -+ ... -+ -+ERROR SUMMARY: 5 errors from 1 contexts (suppressed: 0 from 0) -diff --git a/memcheck/tests/realloc_size_zero_again_yes.stdout.exp b/memcheck/tests/realloc_size_zero_again_yes.stdout.exp -new file mode 100644 -index 000000000..e69de29bb -diff --git a/memcheck/tests/realloc_size_zero_again_yes.vgtest b/memcheck/tests/realloc_size_zero_again_yes.vgtest -new file mode 100644 -index 000000000..215392ed6 ---- /dev/null -+++ b/memcheck/tests/realloc_size_zero_again_yes.vgtest -@@ -0,0 +1,2 @@ -+prog: realloc_size_zero_again -+vgopts: -q -s --realloc-zero-bytes-frees=yes --- -2.40.1 - diff --git a/valgrind-3.21.0-vgm-tests.patch b/valgrind-3.21.0-vgm-tests.patch deleted file mode 100644 index 8fa7712..0000000 --- a/valgrind-3.21.0-vgm-tests.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 21f7a2af2805a02a144c81f12895c134f4a171a3 Mon Sep 17 00:00:00 2001 -From: Andreas Arnez -Date: Mon, 22 May 2023 19:49:08 +0200 -Subject: [PATCH 2/2] Bug 470132 - s390x: Increase test coverage for VGM - -Add more tests for the VGM instruction, to verify the fix for the VGM -wrap-around case. Also test setting unused bits in the I2 and I3 fields, -to check that Valgrind ignores them as it should. ---- - none/tests/s390x/vec2.c | 44 ++++++++++++++++++++++++++++++++ - none/tests/s390x/vec2.stdout.exp | 20 +++++++++++++++ - 2 files changed, 64 insertions(+) - -diff --git a/none/tests/s390x/vec2.c b/none/tests/s390x/vec2.c -index 73b04dee4..c473a2a9a 100644 ---- a/none/tests/s390x/vec2.c -+++ b/none/tests/s390x/vec2.c -@@ -301,6 +301,49 @@ static void test_all_fp_int_conversions() - #undef TEST_EXEC - #undef TEST_GENERATE - -+/* -- Vector generate mask -- */ -+ -+#define TEST_GENERATE(insn, i2, i3, m4) \ -+ static void test_vgm_##i2##_##i3##_##m4(void) \ -+ { \ -+ ulong_v out = vec_ini; \ -+ __asm__("vgm %[out]," #i2 "," #i3 "," #m4 : [out] "+v"(out) : :); \ -+ printf("\t%016lx %016lx\n", out[0], out[1]); \ -+ } -+ -+#define TEST_EXEC(insn, i2, i3, m4) \ -+ do { \ -+ puts(#insn " " #i2 "," #i3 "," #m4); \ -+ test_vgm_##i2##_##i3##_##m4(); \ -+ } while (0) -+ -+#define INSNS \ -+ XTEST(vgmb, 2, 1, 0); \ -+ XTEST(vgmb, 0xf7, 0x30, 0); \ -+ XTEST(vgmb, 0, 0, 0); \ -+ XTEST(vgmh, 3, 2, 1); \ -+ XTEST(vgmh, 15, 15, 1); \ -+ XTEST(vgmf, 4, 3, 2); \ -+ XTEST(vgmf, 16, 17, 2); \ -+ XTEST(vgmg, 55, 63, 3); \ -+ XTEST(vgmg, 43, 55, 3); \ -+ XTEST(vgmg, 63, 2, 3); -+ -+#define XTEST TEST_GENERATE -+INSNS -+#undef XTEST -+ -+static void test_all_generate_mask() -+{ -+#define XTEST TEST_EXEC -+ INSNS -+#undef XTEST -+} -+ -+#undef INSNS -+#undef TEST_EXEC -+#undef TEST_GENERATE -+ - - int main() - { -@@ -310,5 +353,6 @@ int main() - test_all_double_bitshifts(); - test_all_int_fp_conversions(); - test_all_fp_int_conversions(); -+ test_all_generate_mask(); - return 0; - } -diff --git a/none/tests/s390x/vec2.stdout.exp b/none/tests/s390x/vec2.stdout.exp -index b32cbe1bc..2c9ac21c1 100644 ---- a/none/tests/s390x/vec2.stdout.exp -+++ b/none/tests/s390x/vec2.stdout.exp -@@ -166,3 +166,23 @@ vcsfp 0 - vcsfp 8 - 00ffffff - - - - 00000004 - - - -+vgmb 2,1,0 -+ ffffffffffffffff ffffffffffffffff -+vgmb 0xf7,0x30,0 -+ 8181818181818181 8181818181818181 -+vgmb 0,0,0 -+ 8080808080808080 8080808080808080 -+vgmh 3,2,1 -+ ffffffffffffffff ffffffffffffffff -+vgmh 15,15,1 -+ 0001000100010001 0001000100010001 -+vgmf 4,3,2 -+ ffffffffffffffff ffffffffffffffff -+vgmf 16,17,2 -+ 0000c0000000c000 0000c0000000c000 -+vgmg 55,63,3 -+ 00000000000001ff 00000000000001ff -+vgmg 43,55,3 -+ 00000000001fff00 00000000001fff00 -+vgmg 63,2,3 -+ e000000000000001 e000000000000001 --- -2.40.1 - diff --git a/valgrind-3.21.0-vgm.patch b/valgrind-3.21.0-vgm.patch deleted file mode 100644 index 422035f..0000000 --- a/valgrind-3.21.0-vgm.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 70ef4417837b690755feede0088331a28b102c65 Mon Sep 17 00:00:00 2001 -From: Andreas Arnez -Date: Mon, 22 May 2023 18:57:35 +0200 -Subject: [PATCH 1/2] Bug 470132 - s390x: Fix the wrap-around case in VGM - -Valgrind's implementation of VGM is incomplete: - -* It doesn't support generating a wrap-around bit mask. Such a mask - should result when the ending bit position is smaller than the starting - bit position. Valgrind runs into an assertion failure instead. - -* It doesn't ignore unused bits in the I2 and I3 fields of the - instruction, as it should. - -Fix this by re-implementing the main logic in s390_irgen_VGM(). ---- - VEX/priv/guest_s390_toIR.c | 57 +++++++++++++++----------------------- - 1 file changed, 22 insertions(+), 35 deletions(-) - -diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c -index 11dda41ef..d9d746c38 100644 ---- a/VEX/priv/guest_s390_toIR.c -+++ b/VEX/priv/guest_s390_toIR.c -@@ -16388,50 +16388,37 @@ s390_irgen_VGBM(UChar v1, UShort i2, UChar m3 __attribute__((unused))) - static const HChar * - s390_irgen_VGM(UChar v1, UShort i2, UChar m3) - { -- UChar from = (i2 & 0xff00) >> 8; -- UChar to = (i2 & 0x00ff); -- ULong value = 0UL; -- IRType type = s390_vr_get_type(m3); -- vassert(from <= to); -- -- UChar maxIndex = 0; -- switch (type) { -- case Ity_I8: -- maxIndex = 7; -- break; -- case Ity_I16: -- maxIndex = 15; -- break; -- case Ity_I32: -- maxIndex = 31; -- break; -- case Ity_I64: -- maxIndex = 63; -- break; -- default: -- vpanic("s390_irgen_VGM: unknown type"); -- } -- -- for(UChar index = from; index <= to; index++) { -- value |= (1ULL << (maxIndex - index)); -- } -- -- IRExpr *fillValue; -- switch (type) { -- case Ity_I8: -+ s390_insn_assert("vgm", m3 <= 3); -+ -+ UChar max_idx = (8 << m3) - 1; -+ UChar from = max_idx & (i2 >> 8); -+ UChar to = max_idx & i2; -+ ULong all_one = (1ULL << max_idx << 1) - 1; -+ ULong value = (all_one >> from) ^ (all_one >> to >> 1); -+ -+ /* In case of wrap-around we now have a value that needs inverting: -+ to from -+ V V -+ 00000111111111110000000000000000 */ -+ if (to < from) -+ value ^= all_one; -+ -+ IRExpr* fillValue; -+ switch (m3) { -+ case 0: - fillValue = mkU8(value); - break; -- case Ity_I16: -+ case 1: - fillValue = mkU16(value); - break; -- case Ity_I32: -+ case 2: - fillValue = mkU32(value); - break; -- case Ity_I64: -+ case 3: - fillValue = mkU64(value); - break; - default: -- vpanic("s390_irgen_VGM: unknown type"); -+ vpanic("s390_irgen_VGM: unknown element size"); - } - - s390_vr_fill(v1, fillValue); --- -2.40.1 - diff --git a/valgrind.spec b/valgrind.spec index 89b9d7f..5516805 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -2,8 +2,8 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind -Version: 3.21.0 -Release: 8%{?dist} +Version: 3.22.0 +Release: 1%{?dist} Epoch: 1 License: GPLv2+ URL: https://www.valgrind.org/ @@ -16,11 +16,16 @@ Group: Development/Debuggers # We never want the openmpi subpackage when building a software collecton. # We always want it for fedora. # We only want it for older rhel. But not s390x for too old rhel. +# And on fedora > 39 i386 dropped openmpi. %if %{is_scl} %global build_openmpi 0 %else %if 0%{?fedora} - %global build_openmpi 1 + %ifarch %{ix86} + %global build_openmpi (%{?fedora} < 40) + %else + %global build_openmpi 1 + %endif %endif %if 0%{?rhel} %if 0%{?rhel} > 7 @@ -84,31 +89,6 @@ Patch3: valgrind-3.16.0-some-stack-protector.patch # Add some -Wl,z,now. Patch4: valgrind-3.16.0-some-Wl-z-now.patch -# Workaround https://bugs.kde.org/show_bug.cgi?id=402833 -# by disabling overlap checking for memcpy -Patch5: valgrind-3.21.0-no-memcpy-replace-check.patch - -# Add --with-gdbscripts-dir=PATH configure option -# https://bugs.kde.org/show_bug.cgi?id=469768 -Patch6: valgrind-3.21.0-Add-with-gdbscripts-dir.patch - -# Can't run callgrind_control with valgrind 3.21.0 because of perl errors -# https://bugs.kde.org/show_bug.cgi?id=470121 -Patch8: valgrind-3.21.0-callgrind_control-no-strict.patch - -# Multiple realloc zero errors crash in MC_(eq_Error) -# https://bugs.kde.org/show_bug.cgi?id=470520 -Patch9: valgrind-3.21.0-realloc-again.patch - -# s390x: Assertion failure on VGM instruction -# https://bugs.kde.org/show_bug.cgi?id=470132 -Patch10: valgrind-3.21.0-vgm.patch -Patch11: valgrind-3.21.0-vgm-tests.patch - -# s390x: Valgrind cannot start qemu-kvm when "sysctl vm.allocate_pgste=0" -# https://bugs.kde.org/show_bug.cgi?id=470978 -Patch12: valgrind-3.21.0-pgste.patch - BuildRequires: make BuildRequires: glibc-devel @@ -141,6 +121,7 @@ BuildRequires: docbook-dtds # For testing debuginfod-find %if 0%{?fedora} > 29 || 0%{?rhel} > 7 +BuildRequires: elfutils-debuginfod BuildRequires: elfutils-debuginfod-client # For using debuginfod at runtime Recommends: elfutils-debuginfod-client @@ -244,25 +225,15 @@ Valgrind User Manual for details. %prep %setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version} -%patch1 -p1 -%patch2 -p1 +%patch -P1 -p1 +%patch -P2 -p1 # Old rhel gcc doesn't have -fstack-protector-strong. %if 0%{?fedora} || 0%{?rhel} >= 7 -%patch3 -p1 -%patch4 -p1 +%patch -P3 -p1 +%patch -P4 -p1 %endif -%patch5 -p1 -%patch6 -p1 - -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 - - %build # Some patches (might) touch Makefile.am or configure.ac files. @@ -450,6 +421,7 @@ echo ===============END TESTING=============== %files devel %dir %{_includedir}/valgrind %{_includedir}/valgrind/valgrind.h +%{_includedir}/valgrind/cachegrind.h %{_includedir}/valgrind/callgrind.h %{_includedir}/valgrind/drd.h %{_includedir}/valgrind/helgrind.h @@ -488,6 +460,15 @@ fi %endif %changelog +* Fri Nov 3 2023 Mark Wielaard - 3.22.0-1 +- Upstream 3.22.0 final +- BuildRequires elfutils-debuginfod for testing +- Remove all upstreamed patches +- Adjust valgrind-3.16.0-some-stack-protector.patch +- Adjust valgrind-3.16.0-some-Wl-z-now.patch +- Add cachegrind.h to valgrind-devel package +- Use %%patch -Pn instead of deprecated %%patchn + * Tue Jun 27 2023 Mark Wielaard - 3.21.0-8 - BuildRequire python3.11