From ebe46e89adc4bb872d366a3e276bc935382522b7 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 14 Jan 2025 23:52:41 +0100 Subject: [PATCH 01/30] Add more VALGRIND_3_24_BRANCH patches - 0012-Recognize-new-DWARF5-DW_LANG-constants.patch - 0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch - 0014-linux-support-EVIOCGRAB-ioctl.patch --- ...cognize-new-DWARF5-DW_LANG-constants.patch | 144 +++++++++++++++++ ...Use-is-not-a-valid-CoreError-type-in.patch | 147 ++++++++++++++++++ 0014-linux-support-EVIOCGRAB-ioctl.patch | 60 +++++++ valgrind.spec | 11 ++ 4 files changed, 362 insertions(+) create mode 100644 0012-Recognize-new-DWARF5-DW_LANG-constants.patch create mode 100644 0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch create mode 100644 0014-linux-support-EVIOCGRAB-ioctl.patch diff --git a/0012-Recognize-new-DWARF5-DW_LANG-constants.patch b/0012-Recognize-new-DWARF5-DW_LANG-constants.patch new file mode 100644 index 0000000..ef89578 --- /dev/null +++ b/0012-Recognize-new-DWARF5-DW_LANG-constants.patch @@ -0,0 +1,144 @@ +From a2c30f44ac39eb36baa4e831b041fe7cdf25e481 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Fri, 6 Dec 2024 15:39:25 +0100 +Subject: [PATCH 12/14] Recognize new DWARF5 DW_LANG constants + +When using --read-var-info=yes readdwarf3 will try to read and +interpret the CU DW_AT_langauge attribute. Since DWARF5 was released a +number if new language constants have been introduced. See +https://dwarfstd.org/languages.html + +GCC15 might start emitting some of these when switching to C23 by +default. + +When valgrind --read-var-info=yes encounters an unknown DW_LANG +constant it will produce an error and stop processing any further +DWARF. + +Recognize all currently known language constants. In particular +recognize DW_LANG_C17, DW_LANG_C23, DW_LANG_C_plus_plus_17, +DW_LANG_C_plus_plus_20, DW_LANG_C_plus_plus_23, DW_LANG_Fortran18, +DW_LANG_Fortran23, DW_LANG_Ada2005, DW_LANG_Ada2012 and DW_LANG_Rust. + +https://bugs.kde.org/show_bug.cgi?id=497130 + +(cherry picked from commit 7136316123c54aba37fdab166e1bf860e452a4ae) +--- + NEWS | 1 + + coregrind/m_debuginfo/priv_d3basics.h | 31 +++++++++++++++++++++++++++ + coregrind/m_debuginfo/readdwarf3.c | 27 +++++++++++++++++++++-- + 3 files changed, 57 insertions(+), 2 deletions(-) + +diff --git a/NEWS b/NEWS +index 7f1334aa0f07..a25f9b663098 100644 +--- a/NEWS ++++ b/NEWS +@@ -7,6 +7,7 @@ The following bugs have been fixed or resolved on this branch. + + 489913 WARNING: unhandled amd64-linux syscall: 444 (landlock_create_ruleset) + 494246 syscall fsopen not wrapped ++497130 Recognize new DWARF5 DW_LANG constants + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/coregrind/m_debuginfo/priv_d3basics.h b/coregrind/m_debuginfo/priv_d3basics.h +index 3f6e5c72c9e4..34c98728711c 100644 +--- a/coregrind/m_debuginfo/priv_d3basics.h ++++ b/coregrind/m_debuginfo/priv_d3basics.h +@@ -179,6 +179,7 @@ typedef enum dwarf_source_language + /* DWARF 4. */ + DW_LANG_Python = 0x0014, + /* DWARF 5. */ ++ DW_LANG_OpenCL = 0x0015, + DW_LANG_Go = 0x0016, + DW_LANG_Modula3 = 0x0017, + DW_LANG_Haskell = 0x0018, +@@ -195,6 +196,36 @@ typedef enum dwarf_source_language + DW_LANG_Fortran08 = 0x0023, + DW_LANG_RenderScript = 0x0024, + DW_LANG_BLISS = 0x0025, ++ /* Language codes added since DWARF 5. ++ https://dwarfstd.org/languages.html */ ++ DW_LANG_Kotlin = 0x0026, ++ DW_LANG_Zig = 0x0027, ++ DW_LANG_Crystal = 0x0028, ++ DW_LANG_C_plus_plus_17 = 0x002a, ++ DW_LANG_C_plus_plus_20 = 0x002b, ++ DW_LANG_C17 = 0x002c, ++ DW_LANG_Fortran18 = 0x002d, ++ DW_LANG_Ada2005 = 0x002e, ++ DW_LANG_Ada2012 = 0x002f, ++ DW_LANG_HIP = 0x0030, ++ DW_LANG_Assembly = 0x0031, ++ DW_LANG_C_sharp = 0x0032, ++ DW_LANG_Mojo = 0x0033, ++ DW_LANG_GLSL = 0x0034, ++ DW_LANG_GLSL_ES = 0x0035, ++ DW_LANG_HLSL = 0x0036, ++ DW_LANG_OpenCL_CPP = 0x0037, ++ DW_LANG_CPP_for_OpenCL = 0x0038, ++ DW_LANG_SYCL = 0x0039, ++ DW_LANG_C_plus_plus_23 = 0x003a, ++ DW_LANG_Odin = 0x003b, ++ DW_LANG_P4 = 0x003c, ++ DW_LANG_Metal = 0x003d, ++ DW_LANG_C23 = 0x003e, ++ DW_LANG_Fortran23 = 0x003f, ++ DW_LANG_Ruby = 0x0040, ++ DW_LANG_Move = 0x0041, ++ DW_LANG_Hylo = 0x0042, + /* MIPS. */ + DW_LANG_Mips_Assembler = 0x8001, + /* UPC. */ +diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c +index a4b75a8c532b..735896f7c0d3 100644 +--- a/coregrind/m_debuginfo/readdwarf3.c ++++ b/coregrind/m_debuginfo/readdwarf3.c +@@ -3972,19 +3972,42 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, + case DW_LANG_C_plus_plus: case DW_LANG_ObjC: + case DW_LANG_ObjC_plus_plus: case DW_LANG_UPC: + case DW_LANG_Upc: case DW_LANG_C99: case DW_LANG_C11: ++ case DW_LANG_C17: case DW_LANG_C23: + case DW_LANG_C_plus_plus_11: case DW_LANG_C_plus_plus_14: ++ case DW_LANG_C_plus_plus_17: case DW_LANG_C_plus_plus_20: ++ case DW_LANG_C_plus_plus_23: + parser->language = 'C'; break; + case DW_LANG_Fortran77: case DW_LANG_Fortran90: + case DW_LANG_Fortran95: case DW_LANG_Fortran03: +- case DW_LANG_Fortran08: ++ case DW_LANG_Fortran08: case DW_LANG_Fortran18: ++ case DW_LANG_Fortran23: + parser->language = 'F'; break; + case DW_LANG_Ada83: case DW_LANG_Ada95: ++ case DW_LANG_Ada2005: case DW_LANG_Ada2012: + parser->language = 'A'; break; + case DW_LANG_Cobol74: + case DW_LANG_Cobol85: case DW_LANG_Pascal83: + case DW_LANG_Modula2: case DW_LANG_Java: + case DW_LANG_PLI: +- case DW_LANG_D: case DW_LANG_Python: case DW_LANG_Go: ++ case DW_LANG_D: case DW_LANG_Python: ++ case DW_LANG_OpenCL: case DW_LANG_Go: ++ case DW_LANG_Modula3: case DW_LANG_Haskell: ++ case DW_LANG_OCaml: case DW_LANG_Rust: case DW_LANG_Swift: ++ case DW_LANG_Julia: case DW_LANG_Dylan: ++ case DW_LANG_RenderScript: case DW_LANG_BLISS: ++ case DW_LANG_Kotlin: case DW_LANG_Zig: ++ case DW_LANG_Crystal: case DW_LANG_HIP: ++ case DW_LANG_Assembly: case DW_LANG_C_sharp: ++ case DW_LANG_Mojo: case DW_LANG_GLSL: ++ case DW_LANG_GLSL_ES: case DW_LANG_HLSL: ++ case DW_LANG_OpenCL_CPP: case DW_LANG_CPP_for_OpenCL: ++ case DW_LANG_SYCL: ++ case DW_LANG_Odin: ++ case DW_LANG_P4: ++ case DW_LANG_Metal: ++ case DW_LANG_Ruby: ++ case DW_LANG_Move: ++ case DW_LANG_Hylo: + case DW_LANG_Mips_Assembler: + parser->language = '?'; break; + default: +-- +2.47.1 + diff --git a/0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch b/0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch new file mode 100644 index 0000000..6c8c3f7 --- /dev/null +++ b/0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch @@ -0,0 +1,147 @@ +From febe1ccef09f70777b086f938c03f3e71989a7c8 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Tue, 7 Jan 2025 08:05:20 +0100 +Subject: [PATCH 13/14] Bug 498317 - FdBadUse is not a valid CoreError type in + a suppression even though it's generated by --gen-suppressions=yes + +https://bugs.kde.org/show_bug.cgi?id=498317 + +(cherry picked from commit 47bdc4a6f3de8e2071561d349fdd5f830388c489) +--- + NEWS | 2 ++ + coregrind/m_errormgr.c | 7 +++++-- + coregrind/m_syswrap/syswrap-freebsd.c | 4 ++++ + none/tests/freebsd/Makefile.am | 4 +++- + none/tests/freebsd/bug498317.c | 7 +++++++ + none/tests/freebsd/bug498317.stderr.exp | 0 + none/tests/freebsd/bug498317.supp | 8 ++++++++ + none/tests/freebsd/bug498317.vgtest | 2 ++ + 9 files changed, 32 insertions(+), 3 deletions(-) + create mode 100644 none/tests/freebsd/bug498317.c + create mode 100644 none/tests/freebsd/bug498317.stderr.exp + create mode 100644 none/tests/freebsd/bug498317.supp + create mode 100644 none/tests/freebsd/bug498317.vgtest + +diff --git a/NEWS b/NEWS +index a25f9b663098..2fb8ce5c724b 100644 +--- a/NEWS ++++ b/NEWS +@@ -8,6 +8,8 @@ The following bugs have been fixed or resolved on this branch. + 489913 WARNING: unhandled amd64-linux syscall: 444 (landlock_create_ruleset) + 494246 syscall fsopen not wrapped + 497130 Recognize new DWARF5 DW_LANG constants ++498317 FdBadUse is not a valid CoreError type in a suppression ++ even though it's generated by --gen-suppressions=yes + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c +index 4bbcea02474c..2ce919482f77 100644 +--- a/coregrind/m_errormgr.c ++++ b/coregrind/m_errormgr.c +@@ -206,7 +206,8 @@ typedef + // example should new core errors ever be added. + ThreadSupp = -1, /* Matches ThreadErr */ + FdBadCloseSupp = -2, +- FdNotClosedSupp = -3 ++ FdNotClosedSupp = -3, ++ FdBadUseSupp = -4 + } + CoreSuppKind; + +@@ -1033,7 +1034,7 @@ static Bool core_error_matches_suppression(const Error* err, const Supp* su) + return err->ekind == FdBadClose; + case FdNotClosedSupp: + return err->ekind == FdNotClosed; +- case FdBadUse: ++ case FdBadUseSupp: + return err->ekind == FdBadUse; + default: + VG_(umsg)("FATAL: unknown core suppression kind: %d\n", su->skind ); +@@ -1522,6 +1523,8 @@ static void load_one_suppressions_file ( Int clo_suppressions_i ) + supp->skind = FdBadCloseSupp; + else if (VG_STREQ(supp_name, "FdNotClosed")) + supp->skind = FdNotClosedSupp; ++ else if (VG_STREQ(supp_name, "FdBadUse")) ++ supp->skind = FdBadUseSupp; + else + BOMB("unknown core suppression type"); + } +diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c +index 685eb6be076c..a2b79545594e 100644 +--- a/coregrind/m_syswrap/syswrap-freebsd.c ++++ b/coregrind/m_syswrap/syswrap-freebsd.c +@@ -1400,6 +1400,10 @@ PRE(sys_fcntl) + PRINT("sys_fcntl[UNKNOWN] ( %lu, %lu, %lu )", ARG1,ARG2,ARG3); + I_die_here; + } ++ ++ if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False)) { ++ SET_STATUS_Failure (VKI_EBADF); ++ } + } + + POST(sys_fcntl) +diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am +index fe4f8db69824..1ccfefb57fe2 100644 +--- a/none/tests/freebsd/Makefile.am ++++ b/none/tests/freebsd/Makefile.am +@@ -11,6 +11,8 @@ EXTRA_DIST = \ + auxv.stderr.exp-freebsd131 \ + auxv.stderr.exp-freebsd14 \ + auxv.stderr.exp-arm64 \ ++ bug498317.vgtest bug498317.stderr.exp \ ++ bug498317.supp \ + cp.vgtest \ + cp.stderr.exp \ + osrel.vgtest \ +@@ -61,7 +63,7 @@ EXTRA_DIST = \ + usrstack.stdout.exp + + check_PROGRAMS = \ +- auxv osrel swapcontext hello_world fexecve 452275 usrstack \ ++ auxv bug498317 osrel swapcontext hello_world fexecve 452275 usrstack \ + proc_pid_file sanity_level_thread umtx_shm_creat + + AM_CFLAGS += $(AM_FLAG_M3264_PRI) +diff --git a/none/tests/freebsd/bug498317.c b/none/tests/freebsd/bug498317.c +new file mode 100644 +index 000000000000..36a1a5a1365e +--- /dev/null ++++ b/none/tests/freebsd/bug498317.c +@@ -0,0 +1,7 @@ ++#include ++ ++int main(void) { ++ fcntl(-1, F_GETFD); ++ return 0; ++} ++ +diff --git a/none/tests/freebsd/bug498317.stderr.exp b/none/tests/freebsd/bug498317.stderr.exp +new file mode 100644 +index 000000000000..e69de29bb2d1 +diff --git a/none/tests/freebsd/bug498317.supp b/none/tests/freebsd/bug498317.supp +new file mode 100644 +index 000000000000..b3a99447c2a4 +--- /dev/null ++++ b/none/tests/freebsd/bug498317.supp +@@ -0,0 +1,8 @@ ++{ ++ test suppression of FdBadUse ++ CoreError:FdBadUse ++ fun:_fcntl ++ fun:fcntl ++ fun:main ++} ++ +diff --git a/none/tests/freebsd/bug498317.vgtest b/none/tests/freebsd/bug498317.vgtest +new file mode 100644 +index 000000000000..6579ebce8c56 +--- /dev/null ++++ b/none/tests/freebsd/bug498317.vgtest +@@ -0,0 +1,2 @@ ++prog: bug498317 ++vgopts: -q +-- +2.47.1 + diff --git a/0014-linux-support-EVIOCGRAB-ioctl.patch b/0014-linux-support-EVIOCGRAB-ioctl.patch new file mode 100644 index 0000000..8213dc0 --- /dev/null +++ b/0014-linux-support-EVIOCGRAB-ioctl.patch @@ -0,0 +1,60 @@ +From b732f86998e39ca8714330f487804428b54c481c Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 8 Jan 2025 16:52:03 +0100 +Subject: [PATCH 14/14] linux: support EVIOCGRAB ioctl + +EVIOCGRAB just takes an int argument. + +https://bugs.kde.org/show_bug.cgi?id=498143 + +(cherry picked from commit 59eb5a4af60d4beb2c6910a1fa6cdf8d1f3a56f2) +--- + NEWS | 1 + + coregrind/m_syswrap/syswrap-linux.c | 4 ++++ + include/vki/vki-linux.h | 3 +++ + 3 files changed, 8 insertions(+) + +diff --git a/NEWS b/NEWS +index 2fb8ce5c724b..7f9e005c59f4 100644 +--- a/NEWS ++++ b/NEWS +@@ -10,6 +10,7 @@ The following bugs have been fixed or resolved on this branch. + 497130 Recognize new DWARF5 DW_LANG constants + 498317 FdBadUse is not a valid CoreError type in a suppression + even though it's generated by --gen-suppressions=yes ++498143 False positive on EVIOCGRAB ioctl + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c +index 57672f167126..87ab82e6e342 100644 +--- a/coregrind/m_syswrap/syswrap-linux.c ++++ b/coregrind/m_syswrap/syswrap-linux.c +@@ -10397,6 +10397,10 @@ PRE(sys_ioctl) + break; + } + ++ case VKI_EVIOCGRAB: ++ /* This just takes an int argument. */ ++ break; ++ + default: + /* EVIOC* are variable length and return size written on success */ + switch (ARG2 & ~(_VKI_IOC_SIZEMASK << _VKI_IOC_SIZESHIFT)) { +diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h +index 006f16d92201..d4e1908e1e9c 100644 +--- a/include/vki/vki-linux.h ++++ b/include/vki/vki-linux.h +@@ -3226,6 +3226,9 @@ struct vki_getcpu_cache { + + #define VKI_EVIOCGBIT(ev,len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ + ++#define VKI_EVIOCGRAB _VKI_IOW('E', 0x90, int) ++/* grab device */ ++ + /* + * Event types + */ +-- +2.47.1 + diff --git a/valgrind.spec b/valgrind.spec index a8b8c5d..f2be545 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -97,6 +97,9 @@ Patch12: 0008-helgrind-tests-tc17_sembar.c-Remove-bool-typedef.patch Patch13: 0009-drd-tests-swapcontext.c-Rename-typedef-struct-thread.patch Patch14: 0010-none-tests-bug234814.c-sa_handler-take-an-int-as-arg.patch Patch15: 0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch +Patch16: 0012-Recognize-new-DWARF5-DW_LANG-constants.patch +Patch17: 0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch +Patch18: 0014-linux-support-EVIOCGRAB-ioctl.patch BuildRequires: make BuildRequires: glibc-devel @@ -247,6 +250,9 @@ Valgrind User Manual for details. %patch -P13 -p1 %patch -P14 -p1 %patch -P15 -p1 +%patch -P16 -p1 +%patch -P17 -p1 +%patch -P18 -p1 %build # LTO triggers undefined symbols in valgrind. But valgrind has a @@ -463,6 +469,11 @@ echo ===============END TESTING=============== %endif %changelog +* Tue Jan 14 2025 Mark Wielaard +- Add more VALGRIND_3_24_BRANCH patches + 0012-Recognize-new-DWARF5-DW_LANG-constants.patch + 0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch + 0014-linux-support-EVIOCGRAB-ioctl.patch * Tue Nov 26 2024 Mark Wielaard - 3.24.0-2 - Add VALGRIND_3_24_BRANCH patches 0001-Prepare-NEWS-for-branch-3.24-fixes.patch From ed1a9528e3bc010e6122fb567980319befea2a81 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 10 Jan 2025 16:54:42 +0100 Subject: [PATCH 02/30] 3.24.0-3 split valgrind in subpackages valgrind-{scripts,gdb,docs} - valgrind now contains just the core tools. - valgrind-scripts contains the post-processing scripts for callgrind, cachegrind, massif and dhat which depend on perl and python. - valgrind-gdb contains the debuginfo client/server and (v)gdb support. - valgrind-docs contains the man pages, html and pdf manual. --- valgrind.spec | 76 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 10 deletions(-) diff --git a/valgrind.spec b/valgrind.spec index f2be545..eeb755c 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.24.0 -Release: 2%{?dist} +Release: 3%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -139,6 +139,11 @@ BuildRequires: elfutils-debuginfod-client Recommends: elfutils-debuginfod-client %endif +# Optional subpackages +Recommends: %{?scl_prefix}valgrind-docs = %{epoch}:%{version}-%{release} +Recommends: %{?scl_prefix}valgrind-scripts = %{epoch}:%{version}-%{release} +Recommends: %{?scl_prefix}valgrind-gdb = %{epoch}:%{version}-%{release} + # For running the testsuite. # Some of the python scripts require python 3.9+ BuildRequires: python3-devel @@ -208,6 +213,28 @@ Requires: %{?scl_prefix}valgrind = %{epoch}:%{version}-%{release} %description devel Header files and libraries for development of valgrind aware programs. +%package docs +Summary: Documentation for valgrind tools, scripts and gdb integration +License: GFDL-1.2-or-later + +%description docs +Documentation in html and pdf, plus man pages for valgrind tools and scripts. + +%package scripts +Summary: Scripts for post-processing valgrind tool output +License: GPL-2.0-or-later + +%description scripts +Perl and Python scripts for post-processing valgrind tool output. + +%package gdb +Summary: Tools for integrating valgrind and gdb +License: GPL-2.0-or-later +Requires: %{?scl_prefix}valgrind-devel = %{epoch}:%{version}-%{release} + +%description gdb +Tools and support files for integrating valgrind and gdb. + %if %{build_tools_devel} %package tools-devel Summary: Development files for building valgrind tools. @@ -424,18 +451,41 @@ echo ===============END TESTING=============== %{!?_licensedir:%global license %%doc} %files -%license COPYING COPYING.DOCS -%doc NEWS README_* -%doc docs/installed/html docs/installed/*.pdf -%{_bindir}/* +%license COPYING +%{_bindir}/valgrind %dir %{_libexecdir}/valgrind -# Install everything in the libdir except the .so. -# The vgpreload so files might need file mode adjustment. -%{_libexecdir}/valgrind/*[^o] +# Install just the core tools, default suppression and vgpreload libraries. +%{_libexecdir}/valgrind/default.supp +%{_libexecdir}/valgrind/*-*-linux # Turn on executable bit again for vgpreload libraries. # Was disabled in %%install to prevent debuginfo stripping. -%attr(0755,root,root) %{_libexecdir}/valgrind/vgpreload*-%{valarch}-*so +%attr(0755,root,root) %{_libexecdir}/valgrind/vgpreload_*-%{valarch}-linux.so + +%files docs +%license COPYING.DOCS +%doc NEWS README_* +%doc docs/installed/html docs/installed/*.pdf %{_mandir}/man1/* + +%files scripts +%license COPYING +%{_bindir}/callgrind_annotate +%{_bindir}/callgrind_control +%{_bindir}/cg_annotate +%{_bindir}/cg_diff +%{_bindir}/cg_merge +%{_bindir}/ms_print +%{_libexecdir}/valgrind/dh_view.css +%{_libexecdir}/valgrind/dh_view.html +%{_libexecdir}/valgrind/dh_view.js + +%files gdb +%license COPYING +%{_bindir}/valgrind-di-server +%{_bindir}/valgrind-listener +%{_bindir}/vgdb +# gdb register descriptions +%{_libexecdir}/valgrind/*.xml %{_datadir}/gdb/auto-load/valgrind-monitor.py %{_datadir}/gdb/auto-load/valgrind-monitor-def.py @@ -469,11 +519,17 @@ echo ===============END TESTING=============== %endif %changelog -* Tue Jan 14 2025 Mark Wielaard +* Tue Jan 14 2025 Mark Wielaard - 3.24.0-3 - Add more VALGRIND_3_24_BRANCH patches 0012-Recognize-new-DWARF5-DW_LANG-constants.patch 0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch 0014-linux-support-EVIOCGRAB-ioctl.patch +- Split main valgrind package into several subpackages: + - valgrind now contains just the core tools. + - valgrind-scripts contains the post-processing scripts for callgrind, + cachegrind, massif and dhat which depend on perl and python. + - valgrind-gdb contains the debuginfo client/server and (v)gdb support. + - valgrind-docs contains the man pages, html and pdf manual. * Tue Nov 26 2024 Mark Wielaard - 3.24.0-2 - Add VALGRIND_3_24_BRANCH patches 0001-Prepare-NEWS-for-branch-3.24-fixes.patch From 601fe6b14de257c073cbf5069ea81f3ffca11b59 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 15 Jan 2025 17:58:46 +0100 Subject: [PATCH 03/30] 3.24.0-4 - Add 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch --- 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch | 70 +++++++++++++++++++ valgrind.spec | 7 +- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch diff --git a/0015-ppc-test_dfp2-build-fix-for-GCC-15.patch b/0015-ppc-test_dfp2-build-fix-for-GCC-15.patch new file mode 100644 index 0000000..a1de6f0 --- /dev/null +++ b/0015-ppc-test_dfp2-build-fix-for-GCC-15.patch @@ -0,0 +1,70 @@ +From 9e4b5f1cc9f09f61fd3fb0e5687d0fc5ef39f15d Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 15 Jan 2025 16:27:12 +0100 +Subject: [PATCH] ppc test_dfp2 build fix for GCC 15 + +GCC 15 defaults to C23 which changes the meaning of unprototyped +functions, those declaring no arguments with (). Causing some errors: + +test_dfp2.c:412:26: error: initialization of 'void (*)(void)' from incompatible pointer type 'void (*)(int)' [-Wincompatible-pointer-types] + 412 | { &_test_dscri, "dscri", dfp_2args_x1, 20, LONG_TEST, ">>", True}, + | ^ +test_dfp2.c:412:26: note: (near initialization for 'dfp_two_arg_tests[0].test_func') +test_dfp2.c:110:13: note: '_test_dscri' declared here + 110 | static void _test_dscri (int shift) + | ^~~~~~~~~~~ + +test_dfp2.c:664:17: error: assignment to 'test_func_t' {aka 'void (*)(void)'} from incompatible pointer type 'test_func_main_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types] + 664 | while ((func = all_tests[i].test_category)) { + | ^ +test_dfp2.c:237:16: note: 'test_func_t' declared here + 237 | typedef void (*test_func_t)(); + | ^~~~~~~~~~~ +test_dfp2.c:238:16: note: 'test_func_main_t' declared here + 238 | typedef void (*test_func_main_t)(int); + | ^~~~~~~~~~~~~~~~ +test_dfp2.c:667:8: error: too many arguments to function 'func'; expected 0, have 1 + 667 | (*func)(has_vsx); + | ~^~~~~~ ~~~~~~~ + +Fix this by just explicitly compiling that code with -std=gnu99. +--- + none/tests/ppc32/Makefile.am | 4 +++- + none/tests/ppc64/Makefile.am | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/none/tests/ppc32/Makefile.am b/none/tests/ppc32/Makefile.am +index 187cab74f763..7727876fdf66 100644 +--- a/none/tests/ppc32/Makefile.am ++++ b/none/tests/ppc32/Makefile.am +@@ -129,8 +129,10 @@ test_isa_2_06_part3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_ + + test_dfp1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ + @FLAG_M32@ $(BUILD_FLAGS_DFP) ++# Explicitly use -std=gnu99 because the meaning of void (*test_func_t)() ++# changed in c23, causing incompatible-pointer-types errors. + test_dfp2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ +- @FLAG_M32@ $(BUILD_FLAGS_DFP) ++ @FLAG_M32@ $(BUILD_FLAGS_DFP) -std=gnu99 + test_dfp3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ + @FLAG_M32@ $(BUILD_FLAGS_DFP) + test_dfp4_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ +diff --git a/none/tests/ppc64/Makefile.am b/none/tests/ppc64/Makefile.am +index f8eab9fc00b2..98a14b434bc4 100644 +--- a/none/tests/ppc64/Makefile.am ++++ b/none/tests/ppc64/Makefile.am +@@ -190,8 +190,10 @@ test_isa_2_06_part3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_ + + test_dfp1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ + @FLAG_M64@ $(BUILD_FLAGS_DFP) ++# Explicitly use -std=gnu99 because the meaning of void (*test_func_t)() ++# changed in c23, causing incompatible-pointer-types errors. + test_dfp2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ +- @FLAG_M64@ $(BUILD_FLAGS_DFP) ++ @FLAG_M64@ $(BUILD_FLAGS_DFP) -std=gnu99 + test_dfp3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ + @FLAG_M64@ $(BUILD_FLAGS_DFP) + test_dfp4_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ +-- +2.47.1 + diff --git a/valgrind.spec b/valgrind.spec index eeb755c..ff248e6 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.24.0 -Release: 3%{?dist} +Release: 4%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -100,6 +100,7 @@ Patch15: 0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch Patch16: 0012-Recognize-new-DWARF5-DW_LANG-constants.patch Patch17: 0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch Patch18: 0014-linux-support-EVIOCGRAB-ioctl.patch +Patch19: 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch BuildRequires: make BuildRequires: glibc-devel @@ -280,6 +281,7 @@ Valgrind User Manual for details. %patch -P16 -p1 %patch -P17 -p1 %patch -P18 -p1 +%patch -P19 -p1 %build # LTO triggers undefined symbols in valgrind. But valgrind has a @@ -519,6 +521,9 @@ echo ===============END TESTING=============== %endif %changelog +* Wed Jan 15 2025 Mark Wielaard - 3.24.0-4 +- Add 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch + * Tue Jan 14 2025 Mark Wielaard - 3.24.0-3 - Add more VALGRIND_3_24_BRANCH patches 0012-Recognize-new-DWARF5-DW_LANG-constants.patch From f8e8a8e29d11a79e1508b2f0bb1baacf03c12ac7 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 17 Jan 2025 16:53:47 +0100 Subject: [PATCH 04/30] 3.24.0-5 - update split package Recommends/Requires - valgrind-devel now Recommends, instead of Requires, valgrind. - valgrind-gdb now Requires valgrind, instead of valgrind-devel. - valgrind-scripts Recommends valgrind-gdb - valgrind-gdb Recommends gdb --- valgrind.spec | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/valgrind.spec b/valgrind.spec index ff248e6..57b5049 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.24.0 -Release: 4%{?dist} +Release: 5%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -209,7 +209,11 @@ Summary: Development files for valgrind aware programs # But that doesnt have a SPDX identifier yet # https://gitlab.com/fedora/legal/fedora-license-data/-/issues/422 License: bzip2-1.0.6 -Requires: %{?scl_prefix}valgrind = %{epoch}:%{version}-%{release} +# These are just the header files, so strictly speaking you don't +# need valgrind itself unless you are testing your builds. This used +# to be a Requires, so people might depend on the package pulling in +# the core valgrind package, so make it at least a weak dependency. +Recommends: %{?scl_prefix}valgrind = %{epoch}:%{version}-%{release} %description devel Header files and libraries for development of valgrind aware programs. @@ -224,6 +228,9 @@ Documentation in html and pdf, plus man pages for valgrind tools and scripts. %package scripts Summary: Scripts for post-processing valgrind tool output License: GPL-2.0-or-later +# Most scripts can be used as is for post-processing a valgrind tool run. +# But callgrind_control uses vgdb. +Recommends: %{?scl_prefix}valgrind-gdb = %{epoch}:%{version}-%{release} %description scripts Perl and Python scripts for post-processing valgrind tool output. @@ -231,7 +238,10 @@ Perl and Python scripts for post-processing valgrind tool output. %package gdb Summary: Tools for integrating valgrind and gdb License: GPL-2.0-or-later -Requires: %{?scl_prefix}valgrind-devel = %{epoch}:%{version}-%{release} +Requires: %{?scl_prefix}valgrind = %{epoch}:%{version}-%{release} +# vgdb can be used without gdb, just to control valgrind. +# But normally you use it together with both valgrind and gdb. +Recommends: gdb %description gdb Tools and support files for integrating valgrind and gdb. @@ -521,6 +531,12 @@ echo ===============END TESTING=============== %endif %changelog +* Fri Jan 17 2025 Mark Wielaard - 3.24.0-5 +- valgrind-devel now Recommends, instead of Requires, valgrind. +- valgrind-gdb now Requires valgrind, instead of valgrind-devel. +- valgrind-scripts now Recommends valgrind-gdb +- valgrind-gdb now Recommends gdb + * Wed Jan 15 2025 Mark Wielaard - 3.24.0-4 - Add 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch From 121dff8e1ff101e1172ef4cdd89b279e4de18baa Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 12 Mar 2025 14:51:18 +0100 Subject: [PATCH 05/30] 3.24.0-6 - More VALGRIND_3_24_BRANCH patches - 0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch - 0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch - 0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch --- ...Emit-pp_ExeContext-after-the-file-de.patch | 57 ++++++++++ ...spec-for-ld-linux-x86-64.so.2-memcmp.patch | 101 ++++++++++++++++++ ...-filter-out-new-Missing-rpms-message.patch | 45 ++++++++ valgrind.spec | 15 ++- 4 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch create mode 100644 0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch create mode 100644 0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch diff --git a/0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch b/0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch new file mode 100644 index 0000000..bdcd5b7 --- /dev/null +++ b/0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch @@ -0,0 +1,57 @@ +From ec7335142384ec9da66871036803b96319b590eb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= +Date: Mon, 3 Mar 2025 06:14:08 -0500 +Subject: [PATCH 16/18] syswrap-generic: Emit pp_ExeContext after the file + descriptor backtrace + +Adjust use_after_close test for the change. + +(cherry picked from commit 838dc01d2c42f7f22785c771bd74bc4e595da444) +--- + coregrind/m_syswrap/syswrap-generic.c | 2 +- + none/tests/use_after_close.stderr.exp | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c +index 1d80d09288ed..5222bcefe11b 100644 +--- a/coregrind/m_syswrap/syswrap-generic.c ++++ b/coregrind/m_syswrap/syswrap-generic.c +@@ -1179,6 +1179,7 @@ void fd_pp_Error (const Error *err) + } + VG_(emit)("%sFile descriptor %d %s%s\n", whatpre, nce->fd, + error_string, whatpost); ++ VG_(pp_ExeContext)(where); + /* If the file descriptor was never created we won't have + where_closed and where_opened. Only print them in a + use after close case. */ +@@ -1190,7 +1191,6 @@ void fd_pp_Error (const Error *err) + VG_(emit)("%sOriginally opened%s\n", auxpre, auxpost); + VG_(pp_ExeContext)(nce->where_opened); + } +- VG_(pp_ExeContext)(where); + } else { + vg_assert2 (False, "Unknown error kind: %d", + VG_(get_error_kind)(err)); +diff --git a/none/tests/use_after_close.stderr.exp b/none/tests/use_after_close.stderr.exp +index 1ef31c6551eb..75a8d6672949 100644 +--- a/none/tests/use_after_close.stderr.exp ++++ b/none/tests/use_after_close.stderr.exp +@@ -1,13 +1,13 @@ + bad + File descriptor 3 was closed already ++ at 0x........: write (in /...libc...) ++ by 0x........: main + Previously closed + at 0x........: close (in /...libc...) + by 0x........: main + Originally opened + at 0x........: dup (in /...libc...) + by 0x........: main +- at 0x........: write (in /...libc...) +- by 0x........: main + File descriptor 7 was never created + at 0x........: write (in /...libc...) + by 0x........: main +-- +2.48.1 + diff --git a/0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch b/0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch new file mode 100644 index 0000000..24b424b --- /dev/null +++ b/0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch @@ -0,0 +1,101 @@ +From 2c17a8a3e865816ee48e7f78148bbc7240c2a38c Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 12 Mar 2025 13:57:19 +0100 +Subject: [PATCH 17/18] add_hardwired_spec for ld-linux-x86-64.so.2 memcmp + +With RPATH processing ld.so compiled for x86-64-v3 uses an optimized +avx2 memcmp (bcmp) which causes (false postive) memcheck invalid reads +of size 32 warnings. + +Fix this my adding a hardwire spec with a simpler memcmp for +ld-linux-x86-64.so.2. + +https://bugs.kde.org/show_bug.cgi?id=501348 + +Authored-by: Florian Weimer + +(cherry picked from commit 9ffdeb4927b8505cc5a9ea54f608f4972166bb0e) +--- + NEWS | 1 + + coregrind/m_redir.c | 9 +++++++++ + coregrind/m_trampoline.S | 19 +++++++++++++++++++ + coregrind/pub_core_trampoline.h | 1 + + 4 files changed, 30 insertions(+) + +diff --git a/NEWS b/NEWS +index 7f9e005c59f4..fe225c666c77 100644 +--- a/NEWS ++++ b/NEWS +@@ -11,6 +11,7 @@ The following bugs have been fixed or resolved on this branch. + 498317 FdBadUse is not a valid CoreError type in a suppression + even though it's generated by --gen-suppressions=yes + 498143 False positive on EVIOCGRAB ioctl ++501348 glibc built with -march=x86-64-v3 does not work due to ld.so memcmp + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c +index f9e8d8801a19..64ebea3b6304 100644 +--- a/coregrind/m_redir.c ++++ b/coregrind/m_redir.c +@@ -1425,6 +1425,15 @@ void VG_(redir_initialise) ( void ) + NULL + # else + complain_about_stripped_glibc_ldso ++# endif ++ ); ++ add_hardwired_spec( ++ "ld-linux-x86-64.so.2", "memcmp", ++ (Addr)&VG_(amd64_linux_REDIR_FOR_memcmp), ++# ifndef GLIBC_MANDATORY_STRLEN_REDIRECT ++ NULL ++# else ++ complain_about_stripped_glibc_ldso + # endif + ); + } +diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S +index e897963be21a..27f1b35d2b08 100644 +--- a/coregrind/m_trampoline.S ++++ b/coregrind/m_trampoline.S +@@ -241,6 +241,25 @@ VG_(amd64_linux_REDIR_FOR_strcmp): + ret + .size VG_(amd64_linux_REDIR_FOR_strcmp), .-VG_(amd64_linux_REDIR_FOR_strcmp) + ++.global VG_(amd64_linux_REDIR_FOR_memcmp) ++.type VG_(amd64_linux_REDIR_FOR_memcmp), @function ++VG_(amd64_linux_REDIR_FOR_memcmp): ++ xorl %ecx, %ecx ++ jmp 2f ++1: ++ movzbl (%rdi, %rcx), %eax ++ movzbl (%rsi, %rcx), %r8d ++ addq $1, %rcx ++ subl %r8d, %eax ++ jne 3f ++2: ++ cmpq %rcx, %rdx ++ jne 1b ++ xorl %eax, %eax ++3: ++ ret ++.size VG_(amd64_linux_REDIR_FOR_memcmp), .-VG_(amd64_linux_REDIR_FOR_memcmp) ++ + .global VG_(amd64_linux_REDIR_FOR_index) + .type VG_(amd64_linux_REDIR_FOR_index), @function + VG_(amd64_linux_REDIR_FOR_index): +diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h +index d0bd6b859742..3d2f7e9f32b7 100644 +--- a/coregrind/pub_core_trampoline.h ++++ b/coregrind/pub_core_trampoline.h +@@ -82,6 +82,7 @@ extern Addr VG_(amd64_linux_REDIR_FOR_vtime); + extern Addr VG_(amd64_linux_REDIR_FOR_vgetcpu); + extern UInt VG_(amd64_linux_REDIR_FOR_strlen)( void* ); + extern Int VG_(amd64_linux_REDIR_FOR_strcmp)( void*, void* ); ++extern Int VG_(amd64_linux_REDIR_FOR_memcmp)( void*, void*, SizeT ); + extern Char* VG_(amd64_linux_REDIR_FOR_index) ( const Char*, Int ); + #endif + +-- +2.48.1 + diff --git a/0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch b/0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch new file mode 100644 index 0000000..cf0469b --- /dev/null +++ b/0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch @@ -0,0 +1,45 @@ +From 7b2806871f15977db3a64a59f70d48f55ba3228e Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Thu, 16 Jan 2025 17:30:37 +0100 +Subject: [PATCH 18/18] gdbserver_tests: filter out new Missing rpms message + +As seen on the fedora 40 s390x tester. GDB now might output something +like: + +Missing rpms, try: dnf --enablerepo='*debug*' install glibc-debuginfo-2.39-33.fc40.s390x + +Filter those messages out to get zero fail test results again. + +(cherry picked from commit 090f8ce59b5f3d3ec39e032ee5e9524ce4f51a44) +--- + gdbserver_tests/filter_gdb.in | 1 + + gdbserver_tests/filter_memcheck_monitor.in | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in +index 094ea933ec51..2bef9f3ee57b 100755 +--- a/gdbserver_tests/filter_gdb.in ++++ b/gdbserver_tests/filter_gdb.in +@@ -265,6 +265,7 @@ s/^0x........ in \(\w\+ (\)/\1/ + + # delete any missing debuginfo messages + /^Missing debuginfo.*/d ++/^Missing rpms.*/d + + EOF + +diff --git a/gdbserver_tests/filter_memcheck_monitor.in b/gdbserver_tests/filter_memcheck_monitor.in +index 6e8a49a303ba..e407e7b92158 100755 +--- a/gdbserver_tests/filter_memcheck_monitor.in ++++ b/gdbserver_tests/filter_memcheck_monitor.in +@@ -31,6 +31,7 @@ $dir/filter_vgdb | + $SED -e '/Cannot access memory at address 0x......../d' \ + -e '/^[1-9][0-9]* \.\.\/sysdeps\/powerpc\/powerpc32\/dl-start\.S: No such file or directory\./d' \ + -e '/^Missing separate debuginfo/d' \ ++ -e '/^Missing rpms/d' \ + -e '/^Try: zypper install -C/d' \ + -e 's/Test 3: FAIL: expected si_code==2, not 128/Test 3: PASS/' \ + -e 's/in use at exit: [0-9][0-9,]* bytes in [0-9][0-9]* blocks/in use at exit: ... bytes in ... blocks/' \ +-- +2.48.1 + diff --git a/valgrind.spec b/valgrind.spec index 57b5049..63db0ad 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.24.0 -Release: 5%{?dist} +Release: 6%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -101,6 +101,10 @@ Patch16: 0012-Recognize-new-DWARF5-DW_LANG-constants.patch Patch17: 0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch Patch18: 0014-linux-support-EVIOCGRAB-ioctl.patch Patch19: 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch +Patch20: 0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch +Patch21: 0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch +Patch22: 0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch + BuildRequires: make BuildRequires: glibc-devel @@ -292,6 +296,9 @@ Valgrind User Manual for details. %patch -P17 -p1 %patch -P18 -p1 %patch -P19 -p1 +%patch -P20 -p1 +%patch -P21 -p1 +%patch -P22 -p1 %build # LTO triggers undefined symbols in valgrind. But valgrind has a @@ -531,6 +538,12 @@ echo ===============END TESTING=============== %endif %changelog +* Wed Mar 12 2025 Mark Wielaard - 3.24.0-6 +- More VALGRIND_3_24_BRANCH patches + 0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch + 0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch + 0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch + * Fri Jan 17 2025 Mark Wielaard - 3.24.0-5 - valgrind-devel now Recommends, instead of Requires, valgrind. - valgrind-gdb now Requires valgrind, instead of valgrind-devel. From e9491d178bdf3cbe5006516e85d2ef083e62316f Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 28 Mar 2025 16:55:55 +0100 Subject: [PATCH 06/30] 3.24.0-7 - Add valgrind-3.24.0-syscall-cancel.patch --- valgrind-3.24.0-syscall-cancel.patch | 90 ++++++++++++++++++++++++++++ valgrind.spec | 8 ++- 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 valgrind-3.24.0-syscall-cancel.patch diff --git a/valgrind-3.24.0-syscall-cancel.patch b/valgrind-3.24.0-syscall-cancel.patch new file mode 100644 index 0000000..92ce171 --- /dev/null +++ b/valgrind-3.24.0-syscall-cancel.patch @@ -0,0 +1,90 @@ +diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c +index cbeaab9db1de..3e86cf605f18 100644 +--- a/coregrind/m_stacktrace.c ++++ b/coregrind/m_stacktrace.c +@@ -9,6 +9,8 @@ + + Copyright (C) 2000-2017 Julian Seward + jseward@acm.org ++ Copyright (C) 2025 Mark J. Wielaard ++ mark@klomp.org + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as +@@ -1693,10 +1695,48 @@ UInt VG_(get_StackTrace_with_deltas)( + tid, stack_highest_byte, + startRegs.r_pc, startRegs.r_sp); + +- return VG_(get_StackTrace_wrk)(tid, ips, n_ips, ++ Int found = VG_(get_StackTrace_wrk)(tid, ips, n_ips, + sps, fps, + &startRegs, + stack_highest_byte); ++ ++#if defined(VGO_linux) ++ /* glibc might insert some extra frames before doing a syscall to support ++ thread cancellation. This breaks various suppressions and regtests ++ involving checking syscall arguments. So when processing a syscall just ++ remove those extra frames from the top of the call stack. */ ++ if (VG_(is_in_syscall)(tid)) { ++ Int i; ++ Int start = 0; ++ DiEpoch ep = VG_(current_DiEpoch)(); ++ for (i = 0; i < found; i++) { ++ const HChar *buf; ++ if (VG_(get_fnname_raw)(ep, ips[i], &buf)) { // raw, don't demangle ++ if (VG_STREQ("__syscall_cancel_arch", buf) || ++ VG_STREQ("__internal_syscall_cancel", buf) || ++ VG_STREQ("__syscall_cancel", buf)) { ++ start++; ++ continue; // Maybe the next one is special too? ++ } else { ++ break; // Not special, only skip top stack names. ++ } ++ } else { ++ break; // No name, not special, don't skip. ++ } ++ } ++ ++ if (start > 0) { ++ for (i = 0; i < (found - start); i++) { ++ ips[i] = ips[i + start]; ++ if (sps) sps[i] = sps[i + start]; ++ if (fps) fps[i] = fps[i + start]; ++ } ++ return found - start; ++ } ++ } ++#endif ++ ++ return found; + } + + UInt VG_(get_StackTrace) ( ThreadId tid, +commit f3f30becff5851b0d0b2caa7e96e661c7889f7d1 +Author: Mark Wielaard +Date: Fri Mar 28 13:44:35 2025 +0100 + + filter_gdb.in: __syscall_cancel_arch is just in a syscall + + Since glibc 2.41 some extra syscall_cancel frames are inserted before + that actual syscall is made. Just filter out __syscall_cancel_arch + from the gdb output and replace it with "in syscall ..." to make the + regtest .exp match. + + https://bugs.kde.org/show_bug.cgi?id=502126 + +diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in +index 2bef9f3ee57b..e2b329a60483 100755 +--- a/gdbserver_tests/filter_gdb.in ++++ b/gdbserver_tests/filter_gdb.in +@@ -134,6 +134,9 @@ s/^>[> ]*// + # anonymise a 'general' system calls stack trace part + s/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../ + ++# in __syscall_cancel_arch is just in a syscall ++s/in __syscall_cancel_arch .*/in syscall .../ ++ + # anonymise kill syscall. + s/in kill ().*$/in syscall .../ + diff --git a/valgrind.spec b/valgrind.spec index 63db0ad..b459e8b 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.24.0 -Release: 6%{?dist} +Release: 7%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -105,6 +105,7 @@ Patch20: 0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch Patch21: 0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch Patch22: 0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch +Patch50: valgrind-3.24.0-syscall-cancel.patch BuildRequires: make BuildRequires: glibc-devel @@ -300,6 +301,8 @@ Valgrind User Manual for details. %patch -P21 -p1 %patch -P22 -p1 +%patch -P50 -p1 + %build # LTO triggers undefined symbols in valgrind. But valgrind has a # --enable-lto configure time option that we will use instead. @@ -538,6 +541,9 @@ echo ===============END TESTING=============== %endif %changelog +* Fri Mar 28 2025 Mark Wielaard - 3.24.0-7 +- Add valgrind-3.24.0-syscall-cancel.patch + * Wed Mar 12 2025 Mark Wielaard - 3.24.0-6 - More VALGRIND_3_24_BRANCH patches 0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch From f62b81aaa2944ce415203ea931d90969d07687d1 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 30 Mar 2025 22:11:59 +0200 Subject: [PATCH 07/30] 3.24.0-8 - Add new VALGRIND_3_24_BRANCH patches - 0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch - 0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch - 0021-filter_gdb.in-filter-out-__libc_do_syscall.patch - 0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch - Remove valgrind-3.24.0-syscall-cancel.patch (replaced by 0022) --- ...syscall_cancel_arch-is-just-in-a-sys.patch | 35 ++++ ...ng-suppression-for-__wcscat_avx2-str.patch | 177 ++++++++++++++++++ ..._gdb.in-filter-out-__libc_do_syscall.patch | 37 ++++ ...call_cancel-frames-when-getting-stac.patch | 75 +++++--- valgrind.spec | 22 ++- 5 files changed, 313 insertions(+), 33 deletions(-) create mode 100644 0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch create mode 100644 0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch create mode 100644 0021-filter_gdb.in-filter-out-__libc_do_syscall.patch rename valgrind-3.24.0-syscall-cancel.patch => 0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch (52%) diff --git a/0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch b/0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch new file mode 100644 index 0000000..8e2e138 --- /dev/null +++ b/0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch @@ -0,0 +1,35 @@ +From 275b98d60cee65acee7dd5793210aea7a0921bd2 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Fri, 28 Mar 2025 13:44:35 +0100 +Subject: [PATCH 19/22] filter_gdb.in: __syscall_cancel_arch is just in a + syscall + +Since glibc 2.41 some extra syscall_cancel frames are inserted before +that actual syscall is made. Just filter out __syscall_cancel_arch +from the gdb output and replace it with "in syscall ..." to make the +regtest .exp match. + +https://bugs.kde.org/show_bug.cgi?id=502126 + +(cherry picked from commit f3f30becff5851b0d0b2caa7e96e661c7889f7d1) +--- + gdbserver_tests/filter_gdb.in | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in +index 2bef9f3ee57b..e2b329a60483 100755 +--- a/gdbserver_tests/filter_gdb.in ++++ b/gdbserver_tests/filter_gdb.in +@@ -134,6 +134,9 @@ s/^>[> ]*// + # anonymise a 'general' system calls stack trace part + s/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../ + ++# in __syscall_cancel_arch is just in a syscall ++s/in __syscall_cancel_arch .*/in syscall .../ ++ + # anonymise kill syscall. + s/in kill ().*$/in syscall .../ + +-- +2.48.1 + diff --git a/0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch b/0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch new file mode 100644 index 0000000..59d951a --- /dev/null +++ b/0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch @@ -0,0 +1,177 @@ +From f206268ad56899f935d420770088076671a6b014 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Sun, 23 Mar 2025 10:21:29 +0100 +Subject: [PATCH 20/22] Bug 501893 - Missing suppression for __wcscat_avx2 + (strcat-strlen-avx2.h.S:68)? + +(cherry picked from commit f87c58e89c4a0e85c59f39a7ae01027686bfff73) +--- + .gitignore | 1 + + NEWS | 1 + + memcheck/tests/Makefile.am | 2 ++ + memcheck/tests/wcpncpy.stderr.exp | 8 ++++---- + memcheck/tests/wcscat.c | 20 ++++++++++++++++++++ + memcheck/tests/wcscat.stderr.exp | 0 + memcheck/tests/wcscat.stdout.exp | 1 + + memcheck/tests/wcscat.vgtest | 2 ++ + shared/vg_replace_strmem.c | 29 +++++++++++++++++++++++++++++ + 9 files changed, 60 insertions(+), 4 deletions(-) + create mode 100644 memcheck/tests/wcscat.c + create mode 100644 memcheck/tests/wcscat.stderr.exp + create mode 100644 memcheck/tests/wcscat.stdout.exp + create mode 100644 memcheck/tests/wcscat.vgtest + +diff --git a/NEWS b/NEWS +index fe225c666c77..23cf88c505f0 100644 +--- a/NEWS ++++ b/NEWS +@@ -12,6 +12,7 @@ The following bugs have been fixed or resolved on this branch. + even though it's generated by --gen-suppressions=yes + 498143 False positive on EVIOCGRAB ioctl + 501348 glibc built with -march=x86-64-v3 does not work due to ld.so memcmp ++501893 Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)? + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am +index c3b5fdbe9443..2bcffbf5ced9 100644 +--- a/memcheck/tests/Makefile.am ++++ b/memcheck/tests/Makefile.am +@@ -445,6 +445,7 @@ EXTRA_DIST = \ + vcpu_fnfns.stderr.exp vcpu_fnfns.vgtest \ + wcpncpy.stderr.exp wcpncpy.vgtest \ + wcs.vgtest wcs.stderr.exp wcs.stdout.exp \ ++ wcscat.vgtest wcscat.stderr.exp wcscat.stdout.exp \ + wcsncpy.vgtest wcsncpy.stderr.exp \ + wmemcmp.vgtest wmemcmp.stderr.exp \ + wrap1.vgtest wrap1.stdout.exp wrap1.stderr.exp \ +@@ -551,6 +552,7 @@ check_PROGRAMS = \ + varinforestrict \ + vcpu_fbench vcpu_fnfns \ + wcs \ ++ wcscat \ + xml1 \ + wmemcmp \ + wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \ +diff --git a/memcheck/tests/wcpncpy.stderr.exp b/memcheck/tests/wcpncpy.stderr.exp +index abe23b7730e1..0ff9e5c7417c 100644 +--- a/memcheck/tests/wcpncpy.stderr.exp ++++ b/memcheck/tests/wcpncpy.stderr.exp +@@ -1,19 +1,19 @@ + Conditional jump or move depends on uninitialised value(s) +- at 0x........: wcpncpy (vg_replace_strmem.c:2426) ++ at 0x........: wcpncpy (vg_replace_strmem.c:2427) + by 0x........: main (wcpncpy.c:14) + + Invalid write of size 4 +- at 0x........: wcpncpy (vg_replace_strmem.c:2426) ++ at 0x........: wcpncpy (vg_replace_strmem.c:2427) + by 0x........: main (wcpncpy.c:27) + Address 0x........ is 20 bytes inside a block of size 22 alloc'd + at 0x........: malloc (vg_replace_malloc.c:...) + by 0x........: main (wcpncpy.c:10) + + Source and destination overlap in wcpncpy(0x........, 0x........) +- at 0x........: wcpncpy (vg_replace_strmem.c:2426) ++ at 0x........: wcpncpy (vg_replace_strmem.c:2427) + by 0x........: main (wcpncpy.c:35) + + Source and destination overlap in wcpncpy(0x........, 0x........) +- at 0x........: wcpncpy (vg_replace_strmem.c:2426) ++ at 0x........: wcpncpy (vg_replace_strmem.c:2427) + by 0x........: main (wcpncpy.c:43) + +diff --git a/memcheck/tests/wcscat.c b/memcheck/tests/wcscat.c +new file mode 100644 +index 000000000000..bf3ec70c6d2d +--- /dev/null ++++ b/memcheck/tests/wcscat.c +@@ -0,0 +1,20 @@ ++// See https://bugs.kde.org/show_bug.cgi?id=501893 ++#include ++#include ++#include ++#include ++ ++int main(void) ++{ ++ wchar_t* str = malloc(sizeof(L"/usr/lib/python310.zip:/usr/lib/python3.10:")); ++ wchar_t* add1 = wcsdup(L"/usr/lib/python310.zip:/usr/lib/python3.10"); ++ wchar_t* add2 = wcsdup(L":"); ++ str[0] = 0; ++ wcscat(str, add1); ++ wcscat(str, add2); ++ setlocale(LC_ALL, "en_US.utf8"); ++ printf("%ls\n", str); ++ free(str); ++ free(add1); ++ free(add2); ++} +diff --git a/memcheck/tests/wcscat.stderr.exp b/memcheck/tests/wcscat.stderr.exp +new file mode 100644 +index 000000000000..e69de29bb2d1 +diff --git a/memcheck/tests/wcscat.stdout.exp b/memcheck/tests/wcscat.stdout.exp +new file mode 100644 +index 000000000000..b5b8c09e5393 +--- /dev/null ++++ b/memcheck/tests/wcscat.stdout.exp +@@ -0,0 +1 @@ ++/usr/lib/python310.zip:/usr/lib/python3.10: +diff --git a/memcheck/tests/wcscat.vgtest b/memcheck/tests/wcscat.vgtest +new file mode 100644 +index 000000000000..30b25d0efc89 +--- /dev/null ++++ b/memcheck/tests/wcscat.vgtest +@@ -0,0 +1,2 @@ ++prog: wcscat ++vgopts: -q +diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c +index ae13a2a5f87a..71f15c85fb71 100644 +--- a/shared/vg_replace_strmem.c ++++ b/shared/vg_replace_strmem.c +@@ -108,6 +108,7 @@ + 20480 WCSNCPY + 20490 MEMCCPY + 20500 WCPNCPY ++ 20510 WCSCAT + */ + + #if defined(VGO_solaris) +@@ -2426,6 +2427,34 @@ static inline void my_exit ( int x ) + WCPNCPY(VG_Z_LIBC_SONAME, wcpncpy) + #endif + ++/*----------------------- wcscat ----------------------*/ ++ ++#define WCSCAT(soname, fnname) \ ++ Int* VG_REPLACE_FUNCTION_EZU(20510,soname,fnname) \ ++ ( Int *restrict dest, const Int *restrict src ); \ ++ Int* VG_REPLACE_FUNCTION_EZU(20510,soname,fnname) \ ++ ( Int *restrict dest, const Int *restrict src ) \ ++ { \ ++ const Int* src_orig = src; \ ++ Int* dest_orig = dest; \ ++ while (*dest) dest++; \ ++ while (*src) *dest++ = *src++; \ ++ *dest = 0; \ ++ \ ++ /* This is a bit redundant, I think; any overlap and the wcscat will */ \ ++ /* go forever... or until a seg fault occurs. */ \ ++ if (is_overlap(dest_orig, \ ++ src_orig, \ ++ (Addr)dest-(Addr)dest_orig+1, \ ++ (Addr)src-(Addr)src_orig+1)) \ ++ RECORD_OVERLAP_ERROR("wcscat", dest_orig, src_orig, 0); \ ++ \ ++ return dest_orig; \ ++ } ++ ++#if defined(VGO_linux) ++ WCSCAT(VG_Z_LIBC_SONAME, __wcscat_avx2) ++#endif + + /*------------------------------------------------------------*/ + /*--- Improve definedness checking of process environment ---*/ +-- +2.48.1 + diff --git a/0021-filter_gdb.in-filter-out-__libc_do_syscall.patch b/0021-filter_gdb.in-filter-out-__libc_do_syscall.patch new file mode 100644 index 0000000..0e5d628 --- /dev/null +++ b/0021-filter_gdb.in-filter-out-__libc_do_syscall.patch @@ -0,0 +1,37 @@ +From e4d9cc414d13fa0685da8f1c7ac6bf027cadd730 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sun, 30 Mar 2025 13:08:55 +0200 +Subject: [PATCH 21/22] filter_gdb.in: filter out __libc_do_syscall + +On i386 and armhf __libc_do_syscall might be used to invoke a syscall. +Replace __libc_do_syscall with "in syscall ..." and filter out +possible extra (assembly) source file lines containing +libc-do-syscall.S from the gdb output. + +https://bugs.kde.org/show_bug.cgi?id=502126 + +(cherry picked from commit ddcb3aa3ed3188cd28c193225245a76e928b850b) +--- + gdbserver_tests/filter_gdb.in | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in +index e2b329a60483..d7b1bb11c64c 100755 +--- a/gdbserver_tests/filter_gdb.in ++++ b/gdbserver_tests/filter_gdb.in +@@ -137,6 +137,12 @@ s/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../ + # in __syscall_cancel_arch is just in a syscall + s/in __syscall_cancel_arch .*/in syscall .../ + ++# do_syscall is in syscall ++s/__libc_do_syscall ().*/0x........ in syscall .../ ++ ++# extra source code line ++/libc-do-syscall.S/d ++ + # anonymise kill syscall. + s/in kill ().*$/in syscall .../ + +-- +2.48.1 + diff --git a/valgrind-3.24.0-syscall-cancel.patch b/0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch similarity index 52% rename from valgrind-3.24.0-syscall-cancel.patch rename to 0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch index 92ce171..58ee4a5 100644 --- a/valgrind-3.24.0-syscall-cancel.patch +++ b/0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch @@ -1,5 +1,37 @@ +From f18977fe271fc7dbfbf5d1657366cf69ec1361b8 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sun, 30 Mar 2025 17:38:21 +0200 +Subject: [PATCH 22/22] Handle top __syscall_cancel frames when getting stack + traces + +Since glibc 2.41 there are extra frames inserted before doing a +syscall to support proper thread cancellation. This breaks various +suppressions and regtests involving checking syscall arguments. + +Solve this by removing those extra frames from the top of the call +stack when we are processing a linux system call. + +https://bugs.kde.org/show_bug.cgi?id=502126 +(cherry picked from commit 41441379baa63b5471385361d08c8df317705b69) +--- + NEWS | 1 + + coregrind/m_stacktrace.c | 53 +++++++++++++++++++++++++++++++++++++++- + 2 files changed, 53 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index 23cf88c505f0..8b43361eb255 100644 +--- a/NEWS ++++ b/NEWS +@@ -13,6 +13,7 @@ The following bugs have been fixed or resolved on this branch. + 498143 False positive on EVIOCGRAB ioctl + 501348 glibc built with -march=x86-64-v3 does not work due to ld.so memcmp + 501893 Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)? ++502126 glibc 2.41 extra syscall_cancel frames + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c -index cbeaab9db1de..3e86cf605f18 100644 +index 630b5b87524c..0ddd3639cd8a 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -9,6 +9,8 @@ @@ -11,7 +43,7 @@ index cbeaab9db1de..3e86cf605f18 100644 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as -@@ -1693,10 +1695,48 @@ UInt VG_(get_StackTrace_with_deltas)( +@@ -1598,10 +1600,59 @@ UInt VG_(get_StackTrace_with_deltas)( tid, stack_highest_byte, startRegs.r_pc, startRegs.r_sp); @@ -31,10 +63,21 @@ index cbeaab9db1de..3e86cf605f18 100644 + Int start = 0; + DiEpoch ep = VG_(current_DiEpoch)(); + for (i = 0; i < found; i++) { ++ /* This could be made a little more efficient by doing the lookups ++ for the symbols at glibc load time and check the address falls ++ inside the function symbol address range here. But given this ++ is only called during syscall processing, this is probably fine ++ for now. */ + const HChar *buf; + if (VG_(get_fnname_raw)(ep, ips[i], &buf)) { // raw, don't demangle + if (VG_STREQ("__syscall_cancel_arch", buf) || + VG_STREQ("__internal_syscall_cancel", buf) || ++#if defined(VGP_x86_linux) || defined(VGP_arm_linux) ++ VG_STREQ("__libc_do_syscall", buf) || ++#endif ++#if defined(VGP_x86_linux) ++ VG_STREQ("_dl_sysinfo_int80", buf) || ++#endif + VG_STREQ("__syscall_cancel", buf)) { + start++; + continue; // Maybe the next one is special too? @@ -61,30 +104,6 @@ index cbeaab9db1de..3e86cf605f18 100644 } UInt VG_(get_StackTrace) ( ThreadId tid, -commit f3f30becff5851b0d0b2caa7e96e661c7889f7d1 -Author: Mark Wielaard -Date: Fri Mar 28 13:44:35 2025 +0100 +-- +2.48.1 - filter_gdb.in: __syscall_cancel_arch is just in a syscall - - Since glibc 2.41 some extra syscall_cancel frames are inserted before - that actual syscall is made. Just filter out __syscall_cancel_arch - from the gdb output and replace it with "in syscall ..." to make the - regtest .exp match. - - https://bugs.kde.org/show_bug.cgi?id=502126 - -diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in -index 2bef9f3ee57b..e2b329a60483 100755 ---- a/gdbserver_tests/filter_gdb.in -+++ b/gdbserver_tests/filter_gdb.in -@@ -134,6 +134,9 @@ s/^>[> ]*// - # anonymise a 'general' system calls stack trace part - s/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../ - -+# in __syscall_cancel_arch is just in a syscall -+s/in __syscall_cancel_arch .*/in syscall .../ -+ - # anonymise kill syscall. - s/in kill ().*$/in syscall .../ - diff --git a/valgrind.spec b/valgrind.spec index b459e8b..63a682e 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.24.0 -Release: 7%{?dist} +Release: 8%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -104,8 +104,10 @@ Patch19: 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch Patch20: 0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch Patch21: 0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch Patch22: 0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch - -Patch50: valgrind-3.24.0-syscall-cancel.patch +Patch23: 0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch +Patch24: 0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch +Patch25: 0021-filter_gdb.in-filter-out-__libc_do_syscall.patch +Patch26: 0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch BuildRequires: make BuildRequires: glibc-devel @@ -300,8 +302,10 @@ Valgrind User Manual for details. %patch -P20 -p1 %patch -P21 -p1 %patch -P22 -p1 - -%patch -P50 -p1 +%patch -P23 -p1 +%patch -P24 -p1 +%patch -P25 -p1 +%patch -P26 -p1 %build # LTO triggers undefined symbols in valgrind. But valgrind has a @@ -541,6 +545,14 @@ echo ===============END TESTING=============== %endif %changelog +* Sun Mar 30 2025 Mark Wielaard - 3.24.0-8 +- Add new VALGRIND_3_24_BRANCH patches + - 0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch + - 0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch + - 0021-filter_gdb.in-filter-out-__libc_do_syscall.patch + - 0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch +- Remove valgrind-3.24.0-syscall-cancel.patch (replaced by 0022). + * Fri Mar 28 2025 Mark Wielaard - 3.24.0-7 - Add valgrind-3.24.0-syscall-cancel.patch From 4a3e3417858e70d02653faba6a8101b80dd08444 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 18 Apr 2025 15:33:08 +0200 Subject: [PATCH 08/30] 3.25.0-0.1.RC1 - Upstream 3.25.0-RC1 - Remove all VALGRIND_3_24_BRANCH patches - Enable riscv64 arch support --- .gitignore | 1 + 0001-Prepare-NEWS-for-branch-3.24-fixes.patch | 31 -- ...exec_valgrind-Fix-off-by-one-error-w.patch | 37 -- ...exec_valgrind-Fix-another-off-by-one.patch | 36 -- ...leak-filter-for-write-on-write-on-li.patch | 27 - ...-patterns-for-missing-main-frame-for.patch | 491 ------------------ ...onal-exp-ppc64le-files-to-EXTRA_DIST.patch | 41 -- ...landlock_create_ruleset-444-landlock.patch | 358 ------------- ...ts-tc17_sembar.c-Remove-bool-typedef.patch | 35 -- ...ntext.c-Rename-typedef-struct-thread.patch | 38 -- ...4814.c-sa_handler-take-an-int-as-arg.patch | 34 -- ...ve_mount-fsopen-fsconfig-fsmount-fsp.patch | 398 -------------- ...cognize-new-DWARF5-DW_LANG-constants.patch | 144 ----- ...Use-is-not-a-valid-CoreError-type-in.patch | 147 ------ 0014-linux-support-EVIOCGRAB-ioctl.patch | 60 --- 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch | 70 --- ...Emit-pp_ExeContext-after-the-file-de.patch | 57 -- ...spec-for-ld-linux-x86-64.so.2-memcmp.patch | 101 ---- ...-filter-out-new-Missing-rpms-message.patch | 45 -- ...syscall_cancel_arch-is-just-in-a-sys.patch | 35 -- ...ng-suppression-for-__wcscat_avx2-str.patch | 177 ------- ..._gdb.in-filter-out-__libc_do_syscall.patch | 37 -- ...call_cancel-frames-when-getting-stac.patch | 109 ---- sources | 2 +- valgrind.spec | 66 +-- 25 files changed, 16 insertions(+), 2561 deletions(-) delete mode 100644 0001-Prepare-NEWS-for-branch-3.24-fixes.patch delete mode 100644 0002-vgdb.c-fork_and_exec_valgrind-Fix-off-by-one-error-w.patch delete mode 100644 0003-vgdb.c-fork_and_exec_valgrind-Fix-another-off-by-one.patch delete mode 100644 0004-regtest-add-a-fdleak-filter-for-write-on-write-on-li.patch delete mode 100644 0005-Add-exp-and-supp-patterns-for-missing-main-frame-for.patch delete mode 100644 0006-Add-additional-exp-ppc64le-files-to-EXTRA_DIST.patch delete mode 100644 0007-Add-support-for-landlock_create_ruleset-444-landlock.patch delete mode 100644 0008-helgrind-tests-tc17_sembar.c-Remove-bool-typedef.patch delete mode 100644 0009-drd-tests-swapcontext.c-Rename-typedef-struct-thread.patch delete mode 100644 0010-none-tests-bug234814.c-sa_handler-take-an-int-as-arg.patch delete mode 100644 0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch delete mode 100644 0012-Recognize-new-DWARF5-DW_LANG-constants.patch delete mode 100644 0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch delete mode 100644 0014-linux-support-EVIOCGRAB-ioctl.patch delete mode 100644 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch delete mode 100644 0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch delete mode 100644 0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch delete mode 100644 0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch delete mode 100644 0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch delete mode 100644 0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch delete mode 100644 0021-filter_gdb.in-filter-out-__libc_do_syscall.patch delete mode 100644 0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch diff --git a/.gitignore b/.gitignore index 1062ea6..f54faf4 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ /valgrind-3.23.0.RC2.tar.bz2 /valgrind-3.23.0.tar.bz2 /valgrind-3.24.0.tar.bz2 +/valgrind-3.25.0.RC1.tar.bz2 diff --git a/0001-Prepare-NEWS-for-branch-3.24-fixes.patch b/0001-Prepare-NEWS-for-branch-3.24-fixes.patch deleted file mode 100644 index 12402a0..0000000 --- a/0001-Prepare-NEWS-for-branch-3.24-fixes.patch +++ /dev/null @@ -1,31 +0,0 @@ -From cc09f61e56e90c9d3a0e7231cc69b2a499d1205f Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Sat, 23 Nov 2024 02:09:27 +0100 -Subject: [PATCH 01/11] Prepare NEWS for branch 3.24 fixes - ---- - NEWS | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/NEWS b/NEWS -index 49b4647d4295..8362e1d2df41 100644 ---- a/NEWS -+++ b/NEWS -@@ -1,3 +1,14 @@ -+Branch 3.24 -+~~~~~~~~~~~ -+ -+* ==================== FIXED BUGS ==================== -+ -+The following bugs have been fixed or resolved on this branch. -+ -+To see details of a given bug, visit -+ https://bugs.kde.org/show_bug.cgi?id=XXXXXX -+where XXXXXX is the bug number as listed above. -+ - Release 3.24.0 (31 Oct 2024) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - --- -2.47.0 - diff --git a/0002-vgdb.c-fork_and_exec_valgrind-Fix-off-by-one-error-w.patch b/0002-vgdb.c-fork_and_exec_valgrind-Fix-off-by-one-error-w.patch deleted file mode 100644 index 30fd79d..0000000 --- a/0002-vgdb.c-fork_and_exec_valgrind-Fix-off-by-one-error-w.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 2cb0bee2d7722b57956f66a0795b5b9106f88afc Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Tue, 12 Nov 2024 13:23:03 +0100 -Subject: [PATCH 02/11] vgdb.c (fork_and_exec_valgrind): Fix off-by-one error - write - -commit 646978d9adc5 ("vgdb: Handle EINTR and EAGAIN more -consistently") introduced an off-by-one issue trying to write back the -error from child to parent. - -Instead of +1 it should have been +written (which initially is zero). - -This is in an "should never happen" path, so hopefully didn't really -cause issues. But if it did happen the parent would have gotten the -wrong error code. - -(cherry picked from commit f4fe5faf3d0f45b3824bbb9070232682df52a582) ---- - coregrind/vgdb.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c -index 786ead160d34..112f23fe6ba1 100644 ---- a/coregrind/vgdb.c -+++ b/coregrind/vgdb.c -@@ -1368,7 +1368,7 @@ int fork_and_exec_valgrind (int argc, char **argv, const char *working_dir, - // We try to write the result to the parent, but always exit. - size_t written = 0; - while (written < sizeof (int)) { -- ssize_t nrw = write (pipefd[1], ((char *) &err) + 1, -+ ssize_t nrw = write (pipefd[1], ((char *) &err) + written, - sizeof (int) - written); - if (nrw == -1) { - if (errno == EINTR || errno == EAGAIN) --- -2.47.0 - diff --git a/0003-vgdb.c-fork_and_exec_valgrind-Fix-another-off-by-one.patch b/0003-vgdb.c-fork_and_exec_valgrind-Fix-another-off-by-one.patch deleted file mode 100644 index d04870f..0000000 --- a/0003-vgdb.c-fork_and_exec_valgrind-Fix-another-off-by-one.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 8b08da73cf3d72439c4f750c96ed2f088ef1bbec Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Tue, 12 Nov 2024 13:34:09 +0100 -Subject: [PATCH 03/11] vgdb.c (fork_and_exec_valgrind): Fix another off-by-one - error write - -commit 646978d9adc5 ("vgdb: Handle EINTR and EAGAIN more -consistently") introduced another off-by-one issue trying to write -back the error from child to parent. - -Instead of +1 it should have been +written (which initially is zero). - -This is when the child needs to do a chdir and that chdir fails. If -that happens the parent would have gotten the wrong error code. - -(cherry picked from commit 747ca4eb5fed5dd58a14391a997bb9e658e3b1c8) ---- - coregrind/vgdb.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c -index 112f23fe6ba1..cc945c8dfafa 100644 ---- a/coregrind/vgdb.c -+++ b/coregrind/vgdb.c -@@ -1289,7 +1289,7 @@ int fork_and_exec_valgrind (int argc, char **argv, const char *working_dir, - // We try to write the result to the parent, but always exit. - size_t written = 0; - while (written < sizeof (int)) { -- int nrw = write (pipefd[1], ((char *)&err) + 1, -+ int nrw = write (pipefd[1], ((char *)&err) + written, - sizeof (int) - written); - if (nrw == -1) { - if (errno == EINTR || errno == EAGAIN) --- -2.47.0 - diff --git a/0004-regtest-add-a-fdleak-filter-for-write-on-write-on-li.patch b/0004-regtest-add-a-fdleak-filter-for-write-on-write-on-li.patch deleted file mode 100644 index 2a8838a..0000000 --- a/0004-regtest-add-a-fdleak-filter-for-write-on-write-on-li.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7e79bb6e6b80eb43138cbbb64737433f9e036cd4 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Thu, 21 Nov 2024 08:44:04 +0100 -Subject: [PATCH 04/11] regtest: add a fdleak filter for write on write on - linux arm64 - -(cherry picked from commit 9150b3c7cfad2fdbeb7cf707175c359ee12d8f75) ---- - none/tests/filter_fdleak | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/none/tests/filter_fdleak b/none/tests/filter_fdleak -index d26937bccd38..72923aa730c8 100755 ---- a/none/tests/filter_fdleak -+++ b/none/tests/filter_fdleak -@@ -19,6 +19,8 @@ perl -p -e 's/socket\.c:[1-9][0-9]*/in \/...libc.../' | - # arm systems substitute open for creat - perl -p -e 's/open \(open64\.c:[1-9][0-9]*\)/creat (in \/...libc...)/' | - perl -p -e "s/: open \(/: creat (/" | -+# arm64 write resolved to file:line with debuginfo -+perl -p -e "s/write\.c:[1-9][0-9]*/in \/...libc.../" | - - # FreeBSD specific fdleak filters - perl -p -e 's/ _close / close /;s/ _openat / creat /;s/internet/AF_INET socket 4: 127.0.0.1:... <-> 127.0.0.1:.../' | --- -2.47.0 - diff --git a/0005-Add-exp-and-supp-patterns-for-missing-main-frame-for.patch b/0005-Add-exp-and-supp-patterns-for-missing-main-frame-for.patch deleted file mode 100644 index 22efd08..0000000 --- a/0005-Add-exp-and-supp-patterns-for-missing-main-frame-for.patch +++ /dev/null @@ -1,491 +0,0 @@ -From ba15b8fe7d6fabfb73424a616de18a752a56430a Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Sat, 23 Nov 2024 21:28:13 +0100 -Subject: [PATCH 05/11] Add exp and supp patterns for missing main frame for - ppc64le - -In some cases on ppc64le we are missing the main frame. -Add alternative .exp-ppc64le variants for socket_close_xml, -fdleak_cmsg_xml and fdleak_ipv4_xml. And extra suppressions -without a main frame for fdleak_cmsg_supp. - -See also commit 04d30049b "Filter away "main" differences in filter_fdleak" - -(cherry picked from commit e6960c2e41b103ab8d393cbe13dc6473fb89bffc) ---- - none/tests/fdleak_cmsg_supp.supp | 47 ++++++ - none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le | 147 ++++++++++++++++++ - none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le | 139 +++++++++++++++++ - .../tests/socket_close_xml.stderr.exp-ppc64le | 98 ++++++++++++ - 4 files changed, 431 insertions(+) - create mode 100644 none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le - create mode 100644 none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le - create mode 100644 none/tests/socket_close_xml.stderr.exp-ppc64le - -diff --git a/none/tests/fdleak_cmsg_supp.supp b/none/tests/fdleak_cmsg_supp.supp -index 92fbacabdb78..a169fd888bcc 100644 ---- a/none/tests/fdleak_cmsg_supp.supp -+++ b/none/tests/fdleak_cmsg_supp.supp -@@ -12,6 +12,13 @@ - fun:server - fun:main - } -+{ -+ sup2-ppc64le -+ CoreError:FdNotClosed -+ fun:socket -+ fun:server -+ #fun:main -+} - { - sup3 - CoreError:FdNotClosed -@@ -42,3 +49,43 @@ - fun:client - fun:main - } -+{ -+ sup6-ppc64le -+ CoreError:FdNotClosed -+ fun:socket -+ fun:client -+ #fun:main -+} -+{ -+ sup7 -+ CoreError:FdNotClosed -+ fun:_so_socket -+ fun:__xnet_socket -+ fun:client -+ fun:main -+} -+{ -+ sup8 -+ CoreError:FdNotClosed -+ fun:__so_recvmsg -+ fun:__xnet_recvmsg -+ fun:client -+ fun:main -+} -+{ -+ sup9 -+ CoreError:FdNotClosed -+ fun:_so_socket -+ fun:__xnet_socket -+ fun:server -+ fun:main -+} -+{ -+ sup10 -+ CoreError:FdNotClosed -+ fun:__so_accept -+ fun:accept -+ fun:server -+ fun:main -+} -+ -diff --git a/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le b/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le -new file mode 100644 -index 000000000000..6294094eb92e ---- /dev/null -+++ b/none/tests/fdleak_cmsg_xml.stderr.exp-ppc64le -@@ -0,0 +1,147 @@ -+ -+ -+ -+ -+5 -+none -+ -+ -+ Nulgrind, the minimal Valgrind tool -+ Copyright... -+ Using Valgrind... -+ Command: ./fdleak_cmsg -+ -+ -+... -+... -+none -+ -+ -+ -+ ... -+ --command-line-only=yes -+ --memcheck:leak-check=no -+ --tool=none -+ --track-fds=all -+ --xml=yes -+ --xml-fd=2 -+ --child-silent-after-fork=yes -+ -+ -+ ... -+ -+ -+ -+ -+ RUNNING -+ -+ -+ -+ -+ -+ FINISHED -+ -+ -+ -+ -+ 0x........ -+ ... -+ FdNotClosed -+ 5 -+ ... -+ ... -+ -+ -+ 0x........ -+ ... -+ client -+ ... -+ fdleak_cmsg.c -+ 133 -+ -+ -+ 0x........ -+ ... -+ main -+ ... -+ fdleak_cmsg.c -+ 174 -+ -+ -+ -+ -+ -+ 0x........ -+ ... -+ FdNotClosed -+ 4 -+ ... -+ ... -+ -+ -+ 0x........ -+ ... -+ client -+ ... -+ fdleak_cmsg.c -+ 133 -+ -+ -+ 0x........ -+ ... -+ main -+ ... -+ fdleak_cmsg.c -+ 174 -+ -+ -+ -+ -+ -+ 0x........ -+ ... -+ FdNotClosed -+ 3 -+ ... -+ -+ -+ 0x........ -+ ... -+ client -+ ... -+ fdleak_cmsg.c -+ 112 -+ -+ -+ -+ -+ -+ 0x........ -+ ... -+ FdNotClosed -+ 2 -+ ... -+ ... -+ -+ -+ -+ 0x........ -+ ... -+ FdNotClosed -+ 1 -+ ... -+ ... -+ -+ -+ -+ 0x........ -+ ... -+ FdNotClosed -+ 0 -+ ... -+ ... -+ -+ -+ -+ -+ -diff --git a/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le -new file mode 100644 -index 000000000000..df413b62895c ---- /dev/null -+++ b/none/tests/fdleak_ipv4_xml.stderr.exp-ppc64le -@@ -0,0 +1,139 @@ -+ -+ -+ -+ -+5 -+none -+ -+ -+ Nulgrind, the minimal Valgrind tool -+ Copyright... -+ Using Valgrind... -+ Command: ./fdleak_ipv4 -+ -+ -+... -+... -+none -+ -+ -+ -+ ... -+ --command-line-only=yes -+ --memcheck:leak-check=no -+ --tool=none -+ --track-fds=yes -+ --xml=yes -+ --xml-fd=2 -+ --child-silent-after-fork=yes -+ -+ -+ ... -+ -+ -+ -+ -+ RUNNING -+ -+ -+ -+ -+ 0x........ -+ ... -+ FdBadClose -+ 4 -+ ... -+ -+ -+ 0x........ -+ ... -+ client -+ ... -+ fdleak_ipv4.c -+ 70 -+ -+ -+ 0x........ -+ ... -+ main -+ ... -+ fdleak_ipv4.c -+ 90 -+ -+ -+ Previously closed -+ -+ -+ 0x........ -+ ... -+ client -+ ... -+ fdleak_ipv4.c -+ 69 -+ -+ -+ 0x........ -+ ... -+ main -+ ... -+ fdleak_ipv4.c -+ 90 -+ -+ -+ Originally opened -+ -+ -+ 0x........ -+ ... -+ client -+ ... -+ fdleak_ipv4.c -+ 68 -+ -+ -+ 0x........ -+ ... -+ main -+ ... -+ fdleak_ipv4.c -+ 90 -+ -+ -+ -+ -+ -+ -+ FINISHED -+ -+ -+ -+ -+ 0x........ -+ ... -+ FdNotClosed -+ 3 -+ ... -+ -+ -+ 0x........ -+ ... -+ client -+ ... -+ fdleak_ipv4.c -+ 51 -+ -+ -+ -+ -+ -+ -+ 1 -+ 0x........ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/none/tests/socket_close_xml.stderr.exp-ppc64le b/none/tests/socket_close_xml.stderr.exp-ppc64le -new file mode 100644 -index 000000000000..2f2bc9831e79 ---- /dev/null -+++ b/none/tests/socket_close_xml.stderr.exp-ppc64le -@@ -0,0 +1,98 @@ -+ -+ -+ -+ -+5 -+none -+ -+ -+ Nulgrind, the minimal Valgrind tool -+ Copyright... -+ Using Valgrind... -+ Command: ./socket_close -+ -+ -+... -+... -+none -+ -+ -+ -+ ... -+ --command-line-only=yes -+ --memcheck:leak-check=no -+ --tool=none -+ -q -+ --track-fds=yes -+ --xml=yes -+ --xml-fd=2 -+ -+ -+ ... -+ -+ -+ -+ -+ RUNNING -+ -+ -+ -+Open socket 3 -+close socket_fd 3 -+and close the socket again 3 -+ -+ 0x........ -+ ... -+ FdBadClose -+ 3 -+ ... -+ -+ -+ 0x........ -+ ... -+ main -+ ... -+ socket_close.c -+ 40 -+ -+ -+ Previously closed -+ -+ -+ 0x........ -+ ... -+ main -+ ... -+ socket_close.c -+ 36 -+ -+ -+ Originally opened -+ -+ -+ 0x........ -+ ... -+ open_socket -+ ... -+ socket_close.c -+ 17 -+ -+ -+ -+ -+ -+ -+ FINISHED -+ -+ -+ -+ -+ -+ 1 -+ 0x........ -+ -+ -+ -+ -+ -+ --- -2.47.0 - diff --git a/0006-Add-additional-exp-ppc64le-files-to-EXTRA_DIST.patch b/0006-Add-additional-exp-ppc64le-files-to-EXTRA_DIST.patch deleted file mode 100644 index 2a483ba..0000000 --- a/0006-Add-additional-exp-ppc64le-files-to-EXTRA_DIST.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 42f196574aebea451c7e4138b476e042ba302745 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Sun, 24 Nov 2024 08:10:51 +0100 -Subject: [PATCH 06/11] Add additional exp-ppc64le files to EXTRA_DIST - -(cherry picked from commit 7241959ebb88a588eebe5a9fd35d1642db71474b) ---- - none/tests/Makefile.am | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am -index 59be79e57920..53a6e1f6bc95 100644 ---- a/none/tests/Makefile.am -+++ b/none/tests/Makefile.am -@@ -135,6 +135,7 @@ EXTRA_DIST = \ - faultstatus.vgtest faultstatus.stderr.exp faultstatus.stderr.exp-s390x \ - fcntl_setown.vgtest fcntl_setown.stdout.exp fcntl_setown.stderr.exp \ - fdleak_cmsg.stderr.exp fdleak_cmsg.vgtest \ -+ fdleak_cmsg_xml.stderr.exp-ppc64le \ - fdleak_cmsg_xml.stderr.exp fdleak_cmsg_xml.vgtest \ - fdleak_cmsg_supp.stderr.exp fdleak_cmsg_supp.supp \ - fdleak_cmsg_supp.vgtest \ -@@ -149,6 +150,7 @@ EXTRA_DIST = \ - fdleak_fcntl.stderr.exp fdleak_fcntl.vgtest \ - fdleak_fcntl_xml.stderr.exp fdleak_fcntl_xml.vgtest \ - fdleak_ipv4.stderr.exp fdleak_ipv4.stdout.exp fdleak_ipv4.vgtest \ -+ fdleak_ipv4_xml.stderr.exp-ppc64le \ - fdleak_ipv4_xml.stderr.exp fdleak_ipv4_xml.stdout.exp \ - fdleak_ipv4_xml.vgtest fdleak_ipv4_xml.stderr.exp-nomain \ - fdleak_open.stderr.exp fdleak_open.vgtest \ -@@ -248,6 +250,7 @@ EXTRA_DIST = \ - process_vm_readv_writev.stderr.exp process_vm_readv_writev.vgtest \ - sigprocmask.stderr.exp sigprocmask.vgtest \ - socket_close.stderr.exp socket_close.vgtest \ -+ socket_close_xml.stderr.exp-ppc64le \ - socket_close_xml.stderr.exp socket_close_xml.vgtest \ - file_dclose.stderr.exp file_dclose.vgtest \ - file_dclose_xml.stderr.exp file_dclose_xml.vgtest \ --- -2.47.0 - diff --git a/0007-Add-support-for-landlock_create_ruleset-444-landlock.patch b/0007-Add-support-for-landlock_create_ruleset-444-landlock.patch deleted file mode 100644 index 28377de..0000000 --- a/0007-Add-support-for-landlock_create_ruleset-444-landlock.patch +++ /dev/null @@ -1,358 +0,0 @@ -From 3d72dd780be97bd19331403da60908f295712fc7 Mon Sep 17 00:00:00 2001 -From: Peter Seiderer -Date: Mon, 8 Jul 2024 11:05:47 +0200 -Subject: [PATCH 07/11] Add support for landlock_create_ruleset (444), - landlock_add_rule (445) and landlock_restrict_self (446) syscalls - -- add support for landlock_create_ruleset (444) syscall -- add support for landlock_add_rule (445) syscall -- add support for landlock_restrict_self (446) syscall - -https://bugs.kde.org/show_bug.cgi?id=489913 - -Signed-off-by: Peter Seiderer - -(cherry picked from commit b1453546fe7396e7d4b4b2fc8ec7e64b71d18611) ---- - NEWS | 2 + - coregrind/m_syswrap/priv_syswrap-linux.h | 5 ++ - coregrind/m_syswrap/syswrap-amd64-linux.c | 4 ++ - coregrind/m_syswrap/syswrap-arm-linux.c | 4 ++ - coregrind/m_syswrap/syswrap-arm64-linux.c | 4 ++ - coregrind/m_syswrap/syswrap-linux.c | 48 ++++++++++++++++++++ - coregrind/m_syswrap/syswrap-mips32-linux.c | 4 ++ - coregrind/m_syswrap/syswrap-mips64-linux.c | 5 +- - coregrind/m_syswrap/syswrap-nanomips-linux.c | 3 ++ - coregrind/m_syswrap/syswrap-ppc32-linux.c | 4 ++ - coregrind/m_syswrap/syswrap-ppc64-linux.c | 4 ++ - coregrind/m_syswrap/syswrap-s390x-linux.c | 4 ++ - coregrind/m_syswrap/syswrap-x86-linux.c | 4 ++ - include/Makefile.am | 3 +- - include/pub_tool_vki.h | 1 + - include/vki/vki-linux-landlock.h | 37 +++++++++++++++ - include/vki/vki-scnums-shared-linux.h | 4 ++ - 17 files changed, 138 insertions(+), 2 deletions(-) - create mode 100644 include/vki/vki-linux-landlock.h - -diff --git a/NEWS b/NEWS -index 8362e1d2df41..68cd0c6fa603 100644 ---- a/NEWS -+++ b/NEWS -@@ -5,6 +5,8 @@ Branch 3.24 - - The following bugs have been fixed or resolved on this branch. - -+489913 WARNING: unhandled amd64-linux syscall: 444 (landlock_create_ruleset) -+ - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX - where XXXXXX is the bug number as listed above. -diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h -index d50cdcc981b9..221439a0ec33 100644 ---- a/coregrind/m_syswrap/priv_syswrap-linux.h -+++ b/coregrind/m_syswrap/priv_syswrap-linux.h -@@ -328,6 +328,11 @@ DECL_TEMPLATE(linux, sys_pidfd_open); - DECL_TEMPLATE(linux, sys_close_range); - DECL_TEMPLATE(linux, sys_openat2); - -+// Linux-specific (new in Linux 5.13) -+DECL_TEMPLATE(linux, sys_landlock_create_ruleset) -+DECL_TEMPLATE(linux, sys_landlock_add_rule) -+DECL_TEMPLATE(linux, sys_landlock_restrict_self) -+ - // Linux-specific (new in Linux 5.14) - DECL_TEMPLATE(linux, sys_memfd_secret); - -diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c -index 2230baf772b0..9488d3090e80 100644 ---- a/coregrind/m_syswrap/syswrap-amd64-linux.c -+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c -@@ -887,6 +887,10 @@ static SyscallTableEntry syscall_table[] = { - - LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 - -+ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 -+ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 -+ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 -+ - LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 - - LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 -diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c -index d326fdb9eeda..65f64af99bb7 100644 ---- a/coregrind/m_syswrap/syswrap-arm-linux.c -+++ b/coregrind/m_syswrap/syswrap-arm-linux.c -@@ -1062,6 +1062,10 @@ static SyscallTableEntry syscall_main_table[] = { - - LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 - -+ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 -+ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 -+ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 -+ - LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 - }; - -diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c -index 05e0e421fa6c..151ae0640b10 100644 ---- a/coregrind/m_syswrap/syswrap-arm64-linux.c -+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c -@@ -840,6 +840,10 @@ static SyscallTableEntry syscall_main_table[] = { - - LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 - -+ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 -+ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 -+ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 -+ - LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 - - LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index eec8388224ba..70ae837a9454 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -4163,6 +4163,54 @@ POST(sys_memfd_create) - } - } - -+PRE(sys_landlock_create_ruleset) -+{ -+ PRINT("sys_landlock_create_ruleset ( %#" FMT_REGWORD "x, %lu, %lu )", -+ ARG1, ARG2, ARG3); -+ PRE_REG_READ3(long, "landlock_create_ruleset", -+ const struct vki_landlock_ruleset_attr*, attr, -+ vki_size_t, size, vki_uint32_t, flags); -+ PRE_MEM_READ( "landlock_create_ruleset(value)", ARG1, ARG2 ); -+ -+ /* XXX Alternatively we could always fail with EOPNOTSUPP -+ since the rules might interfere with valgrind itself. */ -+} -+ -+POST(sys_landlock_create_ruleset) -+{ -+ /* Returns either the abi version or a file descriptor. */ -+ if (ARG3 != VKI_LANDLOCK_CREATE_RULESET_VERSION) { -+ if (!ML_(fd_allowed)(RES, "landlock_create_ruleset", tid, True)) { -+ VG_(close)(RES); -+ SET_STATUS_Failure( VKI_EMFILE ); -+ } else { -+ if (VG_(clo_track_fds)) -+ ML_(record_fd_open_nameless)(tid, RES); -+ } -+ } -+} -+ -+PRE(sys_landlock_add_rule) -+{ -+ PRINT("sys_landlock_add_rule ( %ld, %lu, %#" FMT_REGWORD "x, %lu )", -+ SARG1, ARG2, ARG3, ARG4); -+ PRE_REG_READ4(long, "landlock_add_rule", -+ int, ruleset_fd, enum vki_landlock_rule_type, rule_type, -+ const void*, rule_attr, vki_uint32_t, flags); -+ if (!ML_(fd_allowed)(ARG1, "landlock_add_rule", tid, False)) -+ SET_STATUS_Failure(VKI_EBADF); -+ /* XXX Depending on rule_type we should also check the given rule_attr. */ -+} -+ -+PRE(sys_landlock_restrict_self) -+{ -+ PRINT("sys_landlock_restrict_self ( %ld, %lu )", SARG1, ARG2); -+ PRE_REG_READ2(long, "landlock_create_ruleset", -+ int, ruleset_fd, vki_uint32_t, flags); -+ if (!ML_(fd_allowed)(ARG1, "landlock_restrict_self", tid, False)) -+ SET_STATUS_Failure(VKI_EBADF); -+} -+ - PRE(sys_memfd_secret) - { - PRINT("sys_memfd_secret ( %#" FMT_REGWORD "x )", ARG1); -diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c -index 421344213676..757b637ba986 100644 ---- a/coregrind/m_syswrap/syswrap-mips32-linux.c -+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c -@@ -1147,6 +1147,10 @@ static SyscallTableEntry syscall_main_table[] = { - - LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 - -+ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 -+ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 -+ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 -+ - LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 - }; - -diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c -index e9bb5c54c59c..f0c5f7e04f4e 100644 ---- a/coregrind/m_syswrap/syswrap-mips64-linux.c -+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c -@@ -824,7 +824,10 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY (__NR_openat2, sys_openat2), - LINXY (__NR_pidfd_getfd, sys_pidfd_getfd), - LINX_ (__NR_faccessat2, sys_faccessat2), -- LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), -+ LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), -+ LINXY (__NR_landlock_create_ruleset, sys_landlock_create_ruleset), -+ LINX_ (__NR_landlock_add_rule, sys_landlock_add_rule), -+ LINX_ (__NR_landlock_restrict_self, sys_landlock_restrict_self), - LINX_ (__NR_fchmodat2, sys_fchmodat2), - }; - -diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c -index 36a5c0ca002d..f466aca147e0 100644 ---- a/coregrind/m_syswrap/syswrap-nanomips-linux.c -+++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c -@@ -831,6 +831,9 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY(__NR_pidfd_getfd, sys_pidfd_getfd), - LINX_ (__NR_faccessat2, sys_faccessat2), - LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), -+ LINXY (__NR_landlock_create_ruleset,sys_landlock_create_ruleset), -+ LINX_ (__NR_landlock_add_rule, sys_landlock_add_rule), -+ LINX_ (__NR_landlock_restrict_self, sys_landlock_restrict_self), - LINX_ (__NR_fchmodat2, sys_fchmodat2), - }; - -diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c -index f7a90c753060..634f288ce0d1 100644 ---- a/coregrind/m_syswrap/syswrap-ppc32-linux.c -+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c -@@ -1069,6 +1069,10 @@ static SyscallTableEntry syscall_table[] = { - - LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441 - -+ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 -+ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 -+ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 -+ - LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 - }; - -diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c -index 8de95624fa7c..2c2def330ad7 100644 ---- a/coregrind/m_syswrap/syswrap-ppc64-linux.c -+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c -@@ -1035,6 +1035,10 @@ static SyscallTableEntry syscall_table[] = { - - LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441 - -+ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 -+ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 -+ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 -+ - LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 - }; - -diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c -index 8a1be8cbef54..ca571f0f1a7c 100644 ---- a/coregrind/m_syswrap/syswrap-s390x-linux.c -+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c -@@ -875,6 +875,10 @@ static SyscallTableEntry syscall_table[] = { - - LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 - -+ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 -+ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 -+ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 -+ - LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 - - LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452 -diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c -index 31243a0db373..a23743743abe 100644 ---- a/coregrind/m_syswrap/syswrap-x86-linux.c -+++ b/coregrind/m_syswrap/syswrap-x86-linux.c -@@ -1656,6 +1656,10 @@ static SyscallTableEntry syscall_table[] = { - - LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 - -+ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 -+ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 -+ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 -+ - LINXY(__NR_memfd_secret, sys_memfd_secret), // 447 - - LINX_(__NR_fchmodat2, sys_fchmodat2), // 452 -diff --git a/include/Makefile.am b/include/Makefile.am -index 8012d73749b3..5d5162a46eb6 100644 ---- a/include/Makefile.am -+++ b/include/Makefile.am -@@ -107,4 +107,5 @@ nobase_pkginclude_HEADERS = \ - vki/vki-xen-xsm.h \ - vki/vki-xen-x86.h \ - vki/vki-linux-drm.h \ -- vki/vki-linux-io_uring.h -+ vki/vki-linux-io_uring.h \ -+ vki/vki-linux-landlock.h -diff --git a/include/pub_tool_vki.h b/include/pub_tool_vki.h -index 24f99cc09f16..7b6e71e11eb4 100644 ---- a/include/pub_tool_vki.h -+++ b/include/pub_tool_vki.h -@@ -47,6 +47,7 @@ - # include "vki/vki-linux.h" - # include "vki/vki-linux-drm.h" - # include "vki/vki-linux-io_uring.h" -+# include "vki/vki-linux-landlock.h" - #elif defined(VGO_darwin) - # include "vki/vki-darwin.h" - #elif defined(VGO_solaris) -diff --git a/include/vki/vki-linux-landlock.h b/include/vki/vki-linux-landlock.h -new file mode 100644 -index 000000000000..e549ae93eff9 ---- /dev/null -+++ b/include/vki/vki-linux-landlock.h -@@ -0,0 +1,37 @@ -+/* -+ This file is part of Valgrind, a dynamic binary instrumentation framework. -+ -+ Copyright (C) 2024 Peter Seiderer -+ -+ This program is free software; you can redistribute it and/or -+ modify it under the terms of the GNU General Public License as -+ published by the Free Software Foundation; either version 2 of the -+ License, or (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, but -+ WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, see . -+ -+ The GNU General Public License is contained in the file COPYING. -+*/ -+#ifndef __VKI_LANDLOCK_H -+#define __VKI_LANDLOCK_H -+ -+// Derived from linux-6.9.7/include/uapi/linux/landlock.h -+struct vki_landlock_ruleset_attr { -+ __vki_u64 handled_access_fs; -+ __vki_u64 handled_access_net; -+}; -+ -+enum vki_landlock_rule_type { -+ VKI_LANDLOCK_RULE_PATH_BENEATH = 1, -+ VKI_LANDLOCK_RULE_NET_PORT, -+}; -+ -+#define VKI_LANDLOCK_CREATE_RULESET_VERSION 1 -+ -+#endif -diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h -index 068a2cd12bd6..20346ca71678 100644 ---- a/include/vki/vki-scnums-shared-linux.h -+++ b/include/vki/vki-scnums-shared-linux.h -@@ -48,6 +48,10 @@ - - #define __NR_epoll_pwait2 441 - -+#define __NR_landlock_create_ruleset 444 -+#define __NR_landlock_add_rule 445 -+#define __NR_landlock_restrict_self 446 -+ - #define __NR_memfd_secret 447 - - #define __NR_fchmodat2 452 --- -2.47.0 - diff --git a/0008-helgrind-tests-tc17_sembar.c-Remove-bool-typedef.patch b/0008-helgrind-tests-tc17_sembar.c-Remove-bool-typedef.patch deleted file mode 100644 index 5a02dda..0000000 --- a/0008-helgrind-tests-tc17_sembar.c-Remove-bool-typedef.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 459fa5b82df0d07cf871fc7359a060410052b82e Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Sat, 23 Nov 2024 22:37:14 +0100 -Subject: [PATCH 08/11] helgrind/tests/tc17_sembar.c: Remove bool typedef - -Since C23 bool is a keyword. Also bool wasn't actually used. - -tc17_sembar.c:45:14: error: both 'long' and '_Bool' in declaration specifiers - 45 | typedef long bool; - | ^~~~ -tc17_sembar.c:45:1: warning: useless type name in empty declaration - 45 | typedef long bool; - | ^~~~~~~ - -(cherry picked from commit 932bf2c027579c8d933b57ed80bb5842b390bdb3) ---- - helgrind/tests/tc17_sembar.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/helgrind/tests/tc17_sembar.c b/helgrind/tests/tc17_sembar.c -index 36412a07e206..ee40160b082d 100644 ---- a/helgrind/tests/tc17_sembar.c -+++ b/helgrind/tests/tc17_sembar.c -@@ -42,7 +42,7 @@ typedef struct - sem_t* xxx; - } gomp_barrier_t; - --typedef long bool; -+ - - void - gomp_barrier_init (gomp_barrier_t *bar, unsigned count) --- -2.47.0 - diff --git a/0009-drd-tests-swapcontext.c-Rename-typedef-struct-thread.patch b/0009-drd-tests-swapcontext.c-Rename-typedef-struct-thread.patch deleted file mode 100644 index b940eba..0000000 --- a/0009-drd-tests-swapcontext.c-Rename-typedef-struct-thread.patch +++ /dev/null @@ -1,38 +0,0 @@ -From c08e155fdf6641a569053b3a70c52bfae09dd34c Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Sat, 23 Nov 2024 22:48:03 +0100 -Subject: [PATCH 09/11] drd/tests/swapcontext.c: Rename typedef struct - thread_local to threadlocal - -Since C23 thread_local is a keyword (thread storage duration). - -swapcontext.c:23:16: error: expected '{' before 'thread_local' - 23 | typedef struct thread_local { - | ^~~~~~~~~~~~ -swapcontext.c:23:16: warning: 'thread_local' is not at beginning of declaration [-Wold-style-declaration] -swapcontext.c:23:16: error: 'thread_local' used with 'typedef' -swapcontext.c:26:3: warning: data definition has no type or storage class - 26 | } thread_local_t; - | ^~~~~~~~~~~~~~ - -(cherry picked from commit 907b985725805f1537396a6d76539bf490cc6c7e) ---- - drd/tests/swapcontext.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drd/tests/swapcontext.c b/drd/tests/swapcontext.c -index 2cb969a5eafa..ec191968cab1 100644 ---- a/drd/tests/swapcontext.c -+++ b/drd/tests/swapcontext.c -@@ -20,7 +20,7 @@ - - #define STACKSIZE (PTHREAD_STACK_MIN + 4096) - --typedef struct thread_local { -+typedef struct threadlocal { - ucontext_t uc[3]; - size_t nrsw; - } thread_local_t; --- -2.47.0 - diff --git a/0010-none-tests-bug234814.c-sa_handler-take-an-int-as-arg.patch b/0010-none-tests-bug234814.c-sa_handler-take-an-int-as-arg.patch deleted file mode 100644 index 5ae9012..0000000 --- a/0010-none-tests-bug234814.c-sa_handler-take-an-int-as-arg.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 53d667789d369042b1fe45f72102ecb5c16e5d12 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Sat, 23 Nov 2024 22:59:21 +0100 -Subject: [PATCH 10/11] none/tests/bug234814.c: sa_handler take an int as - argument - -GCC15 will turn this warning into an error: - -bug234814.c: In function 'main': -bug234814.c:20:18: error: assignment to '__sighandler_t' {aka 'void (*)(int)'} from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types] - 20 | sa.sa_handler = mysigbus; - | ^ - -(cherry picked from commit 8f6cef269b91739f6a2e7f3b4b1e0a429db3e748) ---- - none/tests/bug234814.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/none/tests/bug234814.c b/none/tests/bug234814.c -index 16b561fde6b0..11e0f6779162 100644 ---- a/none/tests/bug234814.c -+++ b/none/tests/bug234814.c -@@ -9,7 +9,7 @@ const char kSigbus[] = "I caught the SIGBUS signal!\n"; - - int GLOB = 3; - --void mysigbus() { -+void mysigbus(int signum) { - write(1, kSigbus, sizeof(kSigbus)-1); - GLOB--; - return; --- -2.47.0 - diff --git a/0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch b/0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch deleted file mode 100644 index a1be881..0000000 --- a/0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch +++ /dev/null @@ -1,398 +0,0 @@ -From 349b57d3a8c8d2df23128d4b03eca91b629629e1 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Tue, 26 Nov 2024 19:00:34 +0100 -Subject: [PATCH 11/11] Add open_tree, move_mount, fsopen, fsconfig, fsmount, - fspick linux syswraps - -Shared linux syscalls implementing various file system mount tasks. -Since linux kernel version 5.2. - -Check arguments and track file descriptors. - -https://bugs.kde.org/show_bug.cgi?id=494246 - -(cherry picked from commit 4044bcea0427853fc44a3d02a0fc0b2a81935452) ---- - NEWS | 1 + - coregrind/m_syswrap/priv_syswrap-linux.h | 8 + - coregrind/m_syswrap/syswrap-amd64-linux.c | 6 + - coregrind/m_syswrap/syswrap-arm-linux.c | 7 +- - coregrind/m_syswrap/syswrap-arm64-linux.c | 7 +- - coregrind/m_syswrap/syswrap-linux.c | 146 +++++++++++++++++++ - coregrind/m_syswrap/syswrap-mips32-linux.c | 7 +- - coregrind/m_syswrap/syswrap-mips64-linux.c | 6 + - coregrind/m_syswrap/syswrap-nanomips-linux.c | 6 + - coregrind/m_syswrap/syswrap-ppc32-linux.c | 7 +- - coregrind/m_syswrap/syswrap-ppc64-linux.c | 7 +- - coregrind/m_syswrap/syswrap-s390x-linux.c | 7 +- - coregrind/m_syswrap/syswrap-x86-linux.c | 7 +- - 13 files changed, 215 insertions(+), 7 deletions(-) - -diff --git a/NEWS b/NEWS -index 68cd0c6fa603..7f1334aa0f07 100644 ---- a/NEWS -+++ b/NEWS -@@ -6,6 +6,7 @@ Branch 3.24 - The following bugs have been fixed or resolved on this branch. - - 489913 WARNING: unhandled amd64-linux syscall: 444 (landlock_create_ruleset) -+494246 syscall fsopen not wrapped - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h -index 221439a0ec33..1bdd9a94ec19 100644 ---- a/coregrind/m_syswrap/priv_syswrap-linux.h -+++ b/coregrind/m_syswrap/priv_syswrap-linux.h -@@ -321,6 +321,14 @@ DECL_TEMPLATE(linux, sys_io_uring_setup); - DECL_TEMPLATE(linux, sys_io_uring_enter); - DECL_TEMPLATE(linux, sys_io_uring_register); - -+// open_tree and friends (shared linux syscalls) -+DECL_TEMPLATE(linux, sys_open_tree); -+DECL_TEMPLATE(linux, sys_move_mount); -+DECL_TEMPLATE(linux, sys_fsopen); -+DECL_TEMPLATE(linux, sys_fsconfig); -+DECL_TEMPLATE(linux, sys_fsmount); -+DECL_TEMPLATE(linux, sys_fspick); -+ - // Linux-specific (new in Linux 5.3) - DECL_TEMPLATE(linux, sys_pidfd_open); - -diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c -index 9488d3090e80..bdba41826ad8 100644 ---- a/coregrind/m_syswrap/syswrap-amd64-linux.c -+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c -@@ -877,6 +877,12 @@ static SyscallTableEntry syscall_table[] = { - LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 - LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 - LINXY(__NR_io_uring_register, sys_io_uring_register), // 427 -+ LINXY(__NR_open_tree, sys_open_tree), // 428 -+ LINX_(__NR_move_mount, sys_move_mount), // 429 -+ LINXY(__NR_fsopen, sys_fsopen), // 430 -+ LINX_(__NR_fsconfig, sys_fsconfig), // 431 -+ LINXY(__NR_fsmount, sys_fsmount), // 432 -+ LINXY(__NR_fspick, sys_fspick), // 433 - - LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 - GENX_(__NR_clone3, sys_ni_syscall), // 435 -diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c -index 65f64af99bb7..108e1f91e5e9 100644 ---- a/coregrind/m_syswrap/syswrap-arm-linux.c -+++ b/coregrind/m_syswrap/syswrap-arm-linux.c -@@ -1052,7 +1052,12 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 - LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 - LINXY(__NR_io_uring_register, sys_io_uring_register), // 427 -- -+ LINXY(__NR_open_tree, sys_open_tree), // 428 -+ LINX_(__NR_move_mount, sys_move_mount), // 429 -+ LINXY(__NR_fsopen, sys_fsopen), // 430 -+ LINX_(__NR_fsconfig, sys_fsconfig), // 431 -+ LINXY(__NR_fsmount, sys_fsmount), // 432 -+ LINXY(__NR_fspick, sys_fspick), // 433 - LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 - GENX_(__NR_clone3, sys_ni_syscall), // 435 - LINXY(__NR_close_range, sys_close_range), // 436 -diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c -index 151ae0640b10..23b0b6b51c10 100644 ---- a/coregrind/m_syswrap/syswrap-arm64-linux.c -+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c -@@ -830,7 +830,12 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 - LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 - LINXY(__NR_io_uring_register, sys_io_uring_register), // 427 -- -+ LINXY(__NR_open_tree, sys_open_tree), // 428 -+ LINX_(__NR_move_mount, sys_move_mount), // 429 -+ LINXY(__NR_fsopen, sys_fsopen), // 430 -+ LINX_(__NR_fsconfig, sys_fsconfig), // 431 -+ LINXY(__NR_fsmount, sys_fsmount), // 432 -+ LINXY(__NR_fspick, sys_fspick), // 433 - LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 - GENX_(__NR_clone3, sys_ni_syscall), // 435 - LINXY(__NR_close_range, sys_close_range), // 436 -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index 70ae837a9454..57672f167126 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -13836,6 +13836,152 @@ POST(sys_pidfd_getfd) - } - } - -+/* int open_tree (int dfd, const char *filename, unsigned int flags) */ -+PRE(sys_open_tree) -+{ -+ PRINT("sys_open_tree ( %ld, %#" FMT_REGWORD "x(%s), %ld", -+ SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3); -+ PRE_REG_READ3(long, "open_tree", -+ int, dfd, const char *, filename, int, flags); -+ PRE_MEM_RASCIIZ( "open_tree(filename)", ARG2); -+ /* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD, -+ filename is relative to cwd. When comparing dfd against AT_FDCWD, -+ be sure only to compare the bottom 32 bits. */ -+ if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) -+ && *(Char *)(Addr)ARG2 != '/' -+ && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) -+ && !ML_(fd_allowed)(ARG1, "open_tree", tid, False)) -+ SET_STATUS_Failure( VKI_EBADF ); -+} -+ -+POST(sys_open_tree) -+{ -+ if (!ML_(fd_allowed)(RES, "open_tree", tid, True)) { -+ VG_(close)(RES); -+ SET_STATUS_Failure( VKI_EMFILE ); -+ } else { -+ if (VG_(clo_track_fds)) -+ ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)(Addr)ARG2); -+ } -+} -+ -+/* int move_mount (int from_dfd, const char *from_pathname, -+ int to_dfd, const char *to_pathname, -+ unsigned int flags) */ -+PRE(sys_move_mount) -+{ -+ PRINT("sys_move_mount ( %ld, %#" FMT_REGWORD "x(%s), " -+ "%ld, %#" FMT_REGWORD "x(%s), %ld", -+ SARG1, ARG2, (HChar*)(Addr)ARG2, -+ SARG3, ARG4, (HChar*)(Addr)ARG4, SARG5); -+ PRE_REG_READ5(long, "mount_move", -+ int, from_dfd, const char *, from_pathname, -+ int, to_dfd, const char*, to_pathname, int, flags); -+ PRE_MEM_RASCIIZ( "mount_move(from_pathname)", ARG2); -+ /* For absolute filenames, from_dfd is ignored. If from_dfd is AT_FDCWD, -+ from_pathname is relative to cwd. When comparing from_dfd against -+ AT_FDCWD, be sure only to compare the bottom 32 bits. */ -+ if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) -+ && *(Char *)(Addr)ARG2 != '/' -+ && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) -+ && !ML_(fd_allowed)(ARG1, "mount_move", tid, False)) -+ SET_STATUS_Failure( VKI_EBADF ); -+ PRE_MEM_RASCIIZ( "mount_move(from_pathname)", ARG4); -+ /* For absolute filenames, to_dfd is ignored. If to_dfd is AT_FDCWD, -+ to_pathname is relative to cwd. When comparing to_dfd against -+ AT_FDCWD, be sure only to compare the bottom 32 bits. */ -+ if (ML_(safe_to_deref)( (void*)(Addr)ARG4, 1 ) -+ && *(Char *)(Addr)ARG4 != '/' -+ && ((Int)ARG4) != ((Int)VKI_AT_FDCWD) -+ && !ML_(fd_allowed)(ARG3, "mount_move", tid, False)) -+ SET_STATUS_Failure( VKI_EBADF ); -+} -+ -+/* int fsopen (const char *fs_name, unsigned int flags) */ -+PRE(sys_fsopen) -+{ -+ PRINT("sys_fsopen ( %#" FMT_REGWORD "x(%s), %ld", -+ ARG1, (HChar*)(Addr)ARG1, SARG2); -+ PRE_REG_READ2(long, "fsopen", const char *, fs_name, int, flags); -+ PRE_MEM_RASCIIZ( "fsopen(filename)", ARG1); -+} -+ -+POST(sys_fsopen) -+{ -+ if (!ML_(fd_allowed)(RES, "fsopen", tid, True)) { -+ VG_(close)(RES); -+ SET_STATUS_Failure( VKI_EMFILE ); -+ } else { -+ if (VG_(clo_track_fds)) -+ ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)(Addr)ARG1); -+ } -+} -+ -+/* int fsmount (int fd, unsigned int flags, unsigned int ms_flags) */ -+PRE(sys_fsmount) -+{ -+ PRINT("sys_fsmount ( %ld, %ld, %ld", SARG1, SARG2, SARG3); -+ PRE_REG_READ3(long, "fsmount", int, fd, int, flags, int, ms_flags); -+ if (!ML_(fd_allowed)(ARG1, "fsmount", tid, False)) -+ SET_STATUS_Failure( VKI_EBADF ); -+} -+ -+POST(sys_fsmount) -+{ -+ if (!ML_(fd_allowed)(RES, "fsmount", tid, True)) { -+ VG_(close)(RES); -+ SET_STATUS_Failure( VKI_EMFILE ); -+ } else { -+ if (VG_(clo_track_fds)) -+ ML_(record_fd_open_nameless)(tid, RES); -+ } -+} -+ -+/* int fsconfig (int fd, unsigned int cmd, const char *key, -+ const void *value, int aux) */ -+PRE(sys_fsconfig) -+{ -+ PRINT("sys_fsconfig ( %ld, %ld, %#" FMT_REGWORD "x(%s), " -+ "%#" FMT_REGWORD "x, %ld )", -+ SARG1, SARG2, ARG3, (HChar*)(Addr)ARG3, ARG4, SARG6); -+ PRE_REG_READ5(long, "fsconfig", int, fd, int, cmd, -+ const char *, key, const void *, value, int, aux); -+ if (ARG3) -+ PRE_MEM_RASCIIZ( "fsconfig(key)", ARG3); -+ if (!ML_(fd_allowed)(ARG1, "fsconfig", tid, False)) -+ SET_STATUS_Failure( VKI_EBADF ); -+ /* XXX we could also check the value based on the cmd FSCONFIG_... */ -+} -+ -+/* int fspick (int dfd, const char *path, unsigned int flags) */ -+PRE(sys_fspick) -+{ -+ PRINT("sys_fspick ( %ld, %#" FMT_REGWORD "x(%s), %ld", -+ SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3); -+ PRE_REG_READ3(long, "fspick", -+ int, dfd, const char *, filename, int, flags); -+ PRE_MEM_RASCIIZ( "fspick(path)", ARG2); -+ /* For absolute filenames, dfd is ignored. If dfd is AT_FDCWD, -+ path is relative to cwd. When comparing dfd against AT_FDCWD, -+ be sure only to compare the bottom 32 bits. */ -+ if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) -+ && *(Char *)(Addr)ARG2 != '/' -+ && ((Int)ARG1) != ((Int)VKI_AT_FDCWD) -+ && !ML_(fd_allowed)(ARG1, "fspick", tid, False)) -+ SET_STATUS_Failure( VKI_EBADF ); -+} -+ -+POST(sys_fspick) -+{ -+ if (!ML_(fd_allowed)(RES, "fspick", tid, True)) { -+ VG_(close)(RES); -+ SET_STATUS_Failure( VKI_EMFILE ); -+ } else { -+ if (VG_(clo_track_fds)) -+ ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)(Addr)ARG2); -+ } -+} -+ - #undef PRE - #undef POST - -diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c -index 757b637ba986..39ba911aa5e4 100644 ---- a/coregrind/m_syswrap/syswrap-mips32-linux.c -+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c -@@ -1137,7 +1137,12 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 - LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 - LINXY(__NR_io_uring_register, sys_io_uring_register), // 427 -- -+ LINXY(__NR_open_tree, sys_open_tree), // 428 -+ LINX_(__NR_move_mount, sys_move_mount), // 429 -+ LINXY(__NR_fsopen, sys_fsopen), // 430 -+ LINX_(__NR_fsconfig, sys_fsconfig), // 431 -+ LINXY(__NR_fsmount, sys_fsmount), // 432 -+ LINXY(__NR_fspick, sys_fspick), // 433 - LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 - GENX_(__NR_clone3, sys_ni_syscall), // 435 - LINXY(__NR_close_range, sys_close_range), // 436 -diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c -index f0c5f7e04f4e..d603924c5566 100644 ---- a/coregrind/m_syswrap/syswrap-mips64-linux.c -+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c -@@ -818,6 +818,12 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY (__NR_io_uring_setup, sys_io_uring_setup), - LINXY (__NR_io_uring_enter, sys_io_uring_enter), - LINXY (__NR_io_uring_register, sys_io_uring_register), -+ LINXY (__NR_open_tree, sys_open_tree), -+ LINX_ (__NR_move_mount, sys_move_mount), -+ LINXY (__NR_fsopen, sys_fsopen), -+ LINX_ (__NR_fsconfig, sys_fsconfig), -+ LINXY (__NR_fsmount, sys_fsmount), -+ LINXY (__NR_fspick, sys_fspick), - LINXY (__NR_pidfd_open, sys_pidfd_open), - GENX_ (__NR_clone3, sys_ni_syscall), - LINXY (__NR_close_range, sys_close_range), -diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c -index f466aca147e0..853495e981b1 100644 ---- a/coregrind/m_syswrap/syswrap-nanomips-linux.c -+++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c -@@ -824,6 +824,12 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY (__NR_io_uring_setup, sys_io_uring_setup), - LINXY (__NR_io_uring_enter, sys_io_uring_enter), - LINXY (__NR_io_uring_register, sys_io_uring_register), -+ LINXY (__NR_open_tree, sys_open_tree), -+ LINX_ (__NR_move_mount, sys_move_mount), -+ LINXY (__NR_fsopen, sys_fsopen), -+ LINX_ (__NR_fsconfig, sys_fsconfig), -+ LINXY (__NR_fsmount, sys_fsmount), -+ LINXY (__NR_fspick, sys_fspick), - LINXY (__NR_pidfd_open, sys_pidfd_open), - GENX_ (__NR_clone3, sys_ni_syscall), - LINXY (__NR_close_range, sys_close_range), -diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c -index 634f288ce0d1..24d8eb213190 100644 ---- a/coregrind/m_syswrap/syswrap-ppc32-linux.c -+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c -@@ -1059,7 +1059,12 @@ static SyscallTableEntry syscall_table[] = { - LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 - LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 - LINXY(__NR_io_uring_register, sys_io_uring_register), // 427 -- -+ LINXY(__NR_open_tree, sys_open_tree), // 428 -+ LINX_(__NR_move_mount, sys_move_mount), // 429 -+ LINXY(__NR_fsopen, sys_fsopen), // 430 -+ LINX_(__NR_fsconfig, sys_fsconfig), // 431 -+ LINXY(__NR_fsmount, sys_fsmount), // 432 -+ LINXY(__NR_fspick, sys_fspick), // 433 - LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 - GENX_(__NR_clone3, sys_ni_syscall), // 435 - LINXY(__NR_close_range, sys_close_range), // 436 -diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c -index 2c2def330ad7..2a3ed8b92481 100644 ---- a/coregrind/m_syswrap/syswrap-ppc64-linux.c -+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c -@@ -1025,7 +1025,12 @@ static SyscallTableEntry syscall_table[] = { - LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 - LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 - LINXY(__NR_io_uring_register, sys_io_uring_register), // 427 -- -+ LINXY(__NR_open_tree, sys_open_tree), // 428 -+ LINX_(__NR_move_mount, sys_move_mount), // 429 -+ LINXY(__NR_fsopen, sys_fsopen), // 430 -+ LINX_(__NR_fsconfig, sys_fsconfig), // 431 -+ LINXY(__NR_fsmount, sys_fsmount), // 432 -+ LINXY(__NR_fspick, sys_fspick), // 433 - LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 - GENX_(__NR_clone3, sys_ni_syscall), // 435 - LINXY(__NR_close_range, sys_close_range), // 436 -diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c -index ca571f0f1a7c..893306bbdae3 100644 ---- a/coregrind/m_syswrap/syswrap-s390x-linux.c -+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c -@@ -865,7 +865,12 @@ static SyscallTableEntry syscall_table[] = { - LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 - LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 - LINXY(__NR_io_uring_register, sys_io_uring_register), // 427 -- -+ LINXY(__NR_open_tree, sys_open_tree), // 428 -+ LINX_(__NR_move_mount, sys_move_mount), // 429 -+ LINXY(__NR_fsopen, sys_fsopen), // 430 -+ LINX_(__NR_fsconfig, sys_fsconfig), // 431 -+ LINXY(__NR_fsmount, sys_fsmount), // 432 -+ LINXY(__NR_fspick, sys_fspick), // 433 - LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 - GENX_(__NR_clone3, sys_ni_syscall), // 435 - LINXY(__NR_close_range, sys_close_range), // 436 -diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c -index a23743743abe..50384817dbe5 100644 ---- a/coregrind/m_syswrap/syswrap-x86-linux.c -+++ b/coregrind/m_syswrap/syswrap-x86-linux.c -@@ -1646,7 +1646,12 @@ static SyscallTableEntry syscall_table[] = { - LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 - LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 - LINXY(__NR_io_uring_register, sys_io_uring_register),// 427 -- -+ LINXY(__NR_open_tree, sys_open_tree), // 428 -+ LINX_(__NR_move_mount, sys_move_mount), // 429 -+ LINXY(__NR_fsopen, sys_fsopen), // 430 -+ LINX_(__NR_fsconfig, sys_fsconfig), // 431 -+ LINXY(__NR_fsmount, sys_fsmount), // 432 -+ LINXY(__NR_fspick, sys_fspick), // 433 - LINXY(__NR_pidfd_open, sys_pidfd_open), // 434 - GENX_(__NR_clone3, sys_ni_syscall), // 435 - LINXY(__NR_close_range, sys_close_range), // 436 --- -2.47.0 - diff --git a/0012-Recognize-new-DWARF5-DW_LANG-constants.patch b/0012-Recognize-new-DWARF5-DW_LANG-constants.patch deleted file mode 100644 index ef89578..0000000 --- a/0012-Recognize-new-DWARF5-DW_LANG-constants.patch +++ /dev/null @@ -1,144 +0,0 @@ -From a2c30f44ac39eb36baa4e831b041fe7cdf25e481 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Fri, 6 Dec 2024 15:39:25 +0100 -Subject: [PATCH 12/14] Recognize new DWARF5 DW_LANG constants - -When using --read-var-info=yes readdwarf3 will try to read and -interpret the CU DW_AT_langauge attribute. Since DWARF5 was released a -number if new language constants have been introduced. See -https://dwarfstd.org/languages.html - -GCC15 might start emitting some of these when switching to C23 by -default. - -When valgrind --read-var-info=yes encounters an unknown DW_LANG -constant it will produce an error and stop processing any further -DWARF. - -Recognize all currently known language constants. In particular -recognize DW_LANG_C17, DW_LANG_C23, DW_LANG_C_plus_plus_17, -DW_LANG_C_plus_plus_20, DW_LANG_C_plus_plus_23, DW_LANG_Fortran18, -DW_LANG_Fortran23, DW_LANG_Ada2005, DW_LANG_Ada2012 and DW_LANG_Rust. - -https://bugs.kde.org/show_bug.cgi?id=497130 - -(cherry picked from commit 7136316123c54aba37fdab166e1bf860e452a4ae) ---- - NEWS | 1 + - coregrind/m_debuginfo/priv_d3basics.h | 31 +++++++++++++++++++++++++++ - coregrind/m_debuginfo/readdwarf3.c | 27 +++++++++++++++++++++-- - 3 files changed, 57 insertions(+), 2 deletions(-) - -diff --git a/NEWS b/NEWS -index 7f1334aa0f07..a25f9b663098 100644 ---- a/NEWS -+++ b/NEWS -@@ -7,6 +7,7 @@ The following bugs have been fixed or resolved on this branch. - - 489913 WARNING: unhandled amd64-linux syscall: 444 (landlock_create_ruleset) - 494246 syscall fsopen not wrapped -+497130 Recognize new DWARF5 DW_LANG constants - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/coregrind/m_debuginfo/priv_d3basics.h b/coregrind/m_debuginfo/priv_d3basics.h -index 3f6e5c72c9e4..34c98728711c 100644 ---- a/coregrind/m_debuginfo/priv_d3basics.h -+++ b/coregrind/m_debuginfo/priv_d3basics.h -@@ -179,6 +179,7 @@ typedef enum dwarf_source_language - /* DWARF 4. */ - DW_LANG_Python = 0x0014, - /* DWARF 5. */ -+ DW_LANG_OpenCL = 0x0015, - DW_LANG_Go = 0x0016, - DW_LANG_Modula3 = 0x0017, - DW_LANG_Haskell = 0x0018, -@@ -195,6 +196,36 @@ typedef enum dwarf_source_language - DW_LANG_Fortran08 = 0x0023, - DW_LANG_RenderScript = 0x0024, - DW_LANG_BLISS = 0x0025, -+ /* Language codes added since DWARF 5. -+ https://dwarfstd.org/languages.html */ -+ DW_LANG_Kotlin = 0x0026, -+ DW_LANG_Zig = 0x0027, -+ DW_LANG_Crystal = 0x0028, -+ DW_LANG_C_plus_plus_17 = 0x002a, -+ DW_LANG_C_plus_plus_20 = 0x002b, -+ DW_LANG_C17 = 0x002c, -+ DW_LANG_Fortran18 = 0x002d, -+ DW_LANG_Ada2005 = 0x002e, -+ DW_LANG_Ada2012 = 0x002f, -+ DW_LANG_HIP = 0x0030, -+ DW_LANG_Assembly = 0x0031, -+ DW_LANG_C_sharp = 0x0032, -+ DW_LANG_Mojo = 0x0033, -+ DW_LANG_GLSL = 0x0034, -+ DW_LANG_GLSL_ES = 0x0035, -+ DW_LANG_HLSL = 0x0036, -+ DW_LANG_OpenCL_CPP = 0x0037, -+ DW_LANG_CPP_for_OpenCL = 0x0038, -+ DW_LANG_SYCL = 0x0039, -+ DW_LANG_C_plus_plus_23 = 0x003a, -+ DW_LANG_Odin = 0x003b, -+ DW_LANG_P4 = 0x003c, -+ DW_LANG_Metal = 0x003d, -+ DW_LANG_C23 = 0x003e, -+ DW_LANG_Fortran23 = 0x003f, -+ DW_LANG_Ruby = 0x0040, -+ DW_LANG_Move = 0x0041, -+ DW_LANG_Hylo = 0x0042, - /* MIPS. */ - DW_LANG_Mips_Assembler = 0x8001, - /* UPC. */ -diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c -index a4b75a8c532b..735896f7c0d3 100644 ---- a/coregrind/m_debuginfo/readdwarf3.c -+++ b/coregrind/m_debuginfo/readdwarf3.c -@@ -3972,19 +3972,42 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, - case DW_LANG_C_plus_plus: case DW_LANG_ObjC: - case DW_LANG_ObjC_plus_plus: case DW_LANG_UPC: - case DW_LANG_Upc: case DW_LANG_C99: case DW_LANG_C11: -+ case DW_LANG_C17: case DW_LANG_C23: - case DW_LANG_C_plus_plus_11: case DW_LANG_C_plus_plus_14: -+ case DW_LANG_C_plus_plus_17: case DW_LANG_C_plus_plus_20: -+ case DW_LANG_C_plus_plus_23: - parser->language = 'C'; break; - case DW_LANG_Fortran77: case DW_LANG_Fortran90: - case DW_LANG_Fortran95: case DW_LANG_Fortran03: -- case DW_LANG_Fortran08: -+ case DW_LANG_Fortran08: case DW_LANG_Fortran18: -+ case DW_LANG_Fortran23: - parser->language = 'F'; break; - case DW_LANG_Ada83: case DW_LANG_Ada95: -+ case DW_LANG_Ada2005: case DW_LANG_Ada2012: - parser->language = 'A'; break; - case DW_LANG_Cobol74: - case DW_LANG_Cobol85: case DW_LANG_Pascal83: - case DW_LANG_Modula2: case DW_LANG_Java: - case DW_LANG_PLI: -- case DW_LANG_D: case DW_LANG_Python: case DW_LANG_Go: -+ case DW_LANG_D: case DW_LANG_Python: -+ case DW_LANG_OpenCL: case DW_LANG_Go: -+ case DW_LANG_Modula3: case DW_LANG_Haskell: -+ case DW_LANG_OCaml: case DW_LANG_Rust: case DW_LANG_Swift: -+ case DW_LANG_Julia: case DW_LANG_Dylan: -+ case DW_LANG_RenderScript: case DW_LANG_BLISS: -+ case DW_LANG_Kotlin: case DW_LANG_Zig: -+ case DW_LANG_Crystal: case DW_LANG_HIP: -+ case DW_LANG_Assembly: case DW_LANG_C_sharp: -+ case DW_LANG_Mojo: case DW_LANG_GLSL: -+ case DW_LANG_GLSL_ES: case DW_LANG_HLSL: -+ case DW_LANG_OpenCL_CPP: case DW_LANG_CPP_for_OpenCL: -+ case DW_LANG_SYCL: -+ case DW_LANG_Odin: -+ case DW_LANG_P4: -+ case DW_LANG_Metal: -+ case DW_LANG_Ruby: -+ case DW_LANG_Move: -+ case DW_LANG_Hylo: - case DW_LANG_Mips_Assembler: - parser->language = '?'; break; - default: --- -2.47.1 - diff --git a/0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch b/0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch deleted file mode 100644 index 6c8c3f7..0000000 --- a/0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch +++ /dev/null @@ -1,147 +0,0 @@ -From febe1ccef09f70777b086f938c03f3e71989a7c8 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Tue, 7 Jan 2025 08:05:20 +0100 -Subject: [PATCH 13/14] Bug 498317 - FdBadUse is not a valid CoreError type in - a suppression even though it's generated by --gen-suppressions=yes - -https://bugs.kde.org/show_bug.cgi?id=498317 - -(cherry picked from commit 47bdc4a6f3de8e2071561d349fdd5f830388c489) ---- - NEWS | 2 ++ - coregrind/m_errormgr.c | 7 +++++-- - coregrind/m_syswrap/syswrap-freebsd.c | 4 ++++ - none/tests/freebsd/Makefile.am | 4 +++- - none/tests/freebsd/bug498317.c | 7 +++++++ - none/tests/freebsd/bug498317.stderr.exp | 0 - none/tests/freebsd/bug498317.supp | 8 ++++++++ - none/tests/freebsd/bug498317.vgtest | 2 ++ - 9 files changed, 32 insertions(+), 3 deletions(-) - create mode 100644 none/tests/freebsd/bug498317.c - create mode 100644 none/tests/freebsd/bug498317.stderr.exp - create mode 100644 none/tests/freebsd/bug498317.supp - create mode 100644 none/tests/freebsd/bug498317.vgtest - -diff --git a/NEWS b/NEWS -index a25f9b663098..2fb8ce5c724b 100644 ---- a/NEWS -+++ b/NEWS -@@ -8,6 +8,8 @@ The following bugs have been fixed or resolved on this branch. - 489913 WARNING: unhandled amd64-linux syscall: 444 (landlock_create_ruleset) - 494246 syscall fsopen not wrapped - 497130 Recognize new DWARF5 DW_LANG constants -+498317 FdBadUse is not a valid CoreError type in a suppression -+ even though it's generated by --gen-suppressions=yes - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c -index 4bbcea02474c..2ce919482f77 100644 ---- a/coregrind/m_errormgr.c -+++ b/coregrind/m_errormgr.c -@@ -206,7 +206,8 @@ typedef - // example should new core errors ever be added. - ThreadSupp = -1, /* Matches ThreadErr */ - FdBadCloseSupp = -2, -- FdNotClosedSupp = -3 -+ FdNotClosedSupp = -3, -+ FdBadUseSupp = -4 - } - CoreSuppKind; - -@@ -1033,7 +1034,7 @@ static Bool core_error_matches_suppression(const Error* err, const Supp* su) - return err->ekind == FdBadClose; - case FdNotClosedSupp: - return err->ekind == FdNotClosed; -- case FdBadUse: -+ case FdBadUseSupp: - return err->ekind == FdBadUse; - default: - VG_(umsg)("FATAL: unknown core suppression kind: %d\n", su->skind ); -@@ -1522,6 +1523,8 @@ static void load_one_suppressions_file ( Int clo_suppressions_i ) - supp->skind = FdBadCloseSupp; - else if (VG_STREQ(supp_name, "FdNotClosed")) - supp->skind = FdNotClosedSupp; -+ else if (VG_STREQ(supp_name, "FdBadUse")) -+ supp->skind = FdBadUseSupp; - else - BOMB("unknown core suppression type"); - } -diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c -index 685eb6be076c..a2b79545594e 100644 ---- a/coregrind/m_syswrap/syswrap-freebsd.c -+++ b/coregrind/m_syswrap/syswrap-freebsd.c -@@ -1400,6 +1400,10 @@ PRE(sys_fcntl) - PRINT("sys_fcntl[UNKNOWN] ( %lu, %lu, %lu )", ARG1,ARG2,ARG3); - I_die_here; - } -+ -+ if (!ML_(fd_allowed)(ARG1, "fcntl", tid, False)) { -+ SET_STATUS_Failure (VKI_EBADF); -+ } - } - - POST(sys_fcntl) -diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am -index fe4f8db69824..1ccfefb57fe2 100644 ---- a/none/tests/freebsd/Makefile.am -+++ b/none/tests/freebsd/Makefile.am -@@ -11,6 +11,8 @@ EXTRA_DIST = \ - auxv.stderr.exp-freebsd131 \ - auxv.stderr.exp-freebsd14 \ - auxv.stderr.exp-arm64 \ -+ bug498317.vgtest bug498317.stderr.exp \ -+ bug498317.supp \ - cp.vgtest \ - cp.stderr.exp \ - osrel.vgtest \ -@@ -61,7 +63,7 @@ EXTRA_DIST = \ - usrstack.stdout.exp - - check_PROGRAMS = \ -- auxv osrel swapcontext hello_world fexecve 452275 usrstack \ -+ auxv bug498317 osrel swapcontext hello_world fexecve 452275 usrstack \ - proc_pid_file sanity_level_thread umtx_shm_creat - - AM_CFLAGS += $(AM_FLAG_M3264_PRI) -diff --git a/none/tests/freebsd/bug498317.c b/none/tests/freebsd/bug498317.c -new file mode 100644 -index 000000000000..36a1a5a1365e ---- /dev/null -+++ b/none/tests/freebsd/bug498317.c -@@ -0,0 +1,7 @@ -+#include -+ -+int main(void) { -+ fcntl(-1, F_GETFD); -+ return 0; -+} -+ -diff --git a/none/tests/freebsd/bug498317.stderr.exp b/none/tests/freebsd/bug498317.stderr.exp -new file mode 100644 -index 000000000000..e69de29bb2d1 -diff --git a/none/tests/freebsd/bug498317.supp b/none/tests/freebsd/bug498317.supp -new file mode 100644 -index 000000000000..b3a99447c2a4 ---- /dev/null -+++ b/none/tests/freebsd/bug498317.supp -@@ -0,0 +1,8 @@ -+{ -+ test suppression of FdBadUse -+ CoreError:FdBadUse -+ fun:_fcntl -+ fun:fcntl -+ fun:main -+} -+ -diff --git a/none/tests/freebsd/bug498317.vgtest b/none/tests/freebsd/bug498317.vgtest -new file mode 100644 -index 000000000000..6579ebce8c56 ---- /dev/null -+++ b/none/tests/freebsd/bug498317.vgtest -@@ -0,0 +1,2 @@ -+prog: bug498317 -+vgopts: -q --- -2.47.1 - diff --git a/0014-linux-support-EVIOCGRAB-ioctl.patch b/0014-linux-support-EVIOCGRAB-ioctl.patch deleted file mode 100644 index 8213dc0..0000000 --- a/0014-linux-support-EVIOCGRAB-ioctl.patch +++ /dev/null @@ -1,60 +0,0 @@ -From b732f86998e39ca8714330f487804428b54c481c Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Wed, 8 Jan 2025 16:52:03 +0100 -Subject: [PATCH 14/14] linux: support EVIOCGRAB ioctl - -EVIOCGRAB just takes an int argument. - -https://bugs.kde.org/show_bug.cgi?id=498143 - -(cherry picked from commit 59eb5a4af60d4beb2c6910a1fa6cdf8d1f3a56f2) ---- - NEWS | 1 + - coregrind/m_syswrap/syswrap-linux.c | 4 ++++ - include/vki/vki-linux.h | 3 +++ - 3 files changed, 8 insertions(+) - -diff --git a/NEWS b/NEWS -index 2fb8ce5c724b..7f9e005c59f4 100644 ---- a/NEWS -+++ b/NEWS -@@ -10,6 +10,7 @@ The following bugs have been fixed or resolved on this branch. - 497130 Recognize new DWARF5 DW_LANG constants - 498317 FdBadUse is not a valid CoreError type in a suppression - even though it's generated by --gen-suppressions=yes -+498143 False positive on EVIOCGRAB ioctl - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index 57672f167126..87ab82e6e342 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -10397,6 +10397,10 @@ PRE(sys_ioctl) - break; - } - -+ case VKI_EVIOCGRAB: -+ /* This just takes an int argument. */ -+ break; -+ - default: - /* EVIOC* are variable length and return size written on success */ - switch (ARG2 & ~(_VKI_IOC_SIZEMASK << _VKI_IOC_SIZESHIFT)) { -diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h -index 006f16d92201..d4e1908e1e9c 100644 ---- a/include/vki/vki-linux.h -+++ b/include/vki/vki-linux.h -@@ -3226,6 +3226,9 @@ struct vki_getcpu_cache { - - #define VKI_EVIOCGBIT(ev,len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ - -+#define VKI_EVIOCGRAB _VKI_IOW('E', 0x90, int) -+/* grab device */ -+ - /* - * Event types - */ --- -2.47.1 - diff --git a/0015-ppc-test_dfp2-build-fix-for-GCC-15.patch b/0015-ppc-test_dfp2-build-fix-for-GCC-15.patch deleted file mode 100644 index a1de6f0..0000000 --- a/0015-ppc-test_dfp2-build-fix-for-GCC-15.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 9e4b5f1cc9f09f61fd3fb0e5687d0fc5ef39f15d Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Wed, 15 Jan 2025 16:27:12 +0100 -Subject: [PATCH] ppc test_dfp2 build fix for GCC 15 - -GCC 15 defaults to C23 which changes the meaning of unprototyped -functions, those declaring no arguments with (). Causing some errors: - -test_dfp2.c:412:26: error: initialization of 'void (*)(void)' from incompatible pointer type 'void (*)(int)' [-Wincompatible-pointer-types] - 412 | { &_test_dscri, "dscri", dfp_2args_x1, 20, LONG_TEST, ">>", True}, - | ^ -test_dfp2.c:412:26: note: (near initialization for 'dfp_two_arg_tests[0].test_func') -test_dfp2.c:110:13: note: '_test_dscri' declared here - 110 | static void _test_dscri (int shift) - | ^~~~~~~~~~~ - -test_dfp2.c:664:17: error: assignment to 'test_func_t' {aka 'void (*)(void)'} from incompatible pointer type 'test_func_main_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types] - 664 | while ((func = all_tests[i].test_category)) { - | ^ -test_dfp2.c:237:16: note: 'test_func_t' declared here - 237 | typedef void (*test_func_t)(); - | ^~~~~~~~~~~ -test_dfp2.c:238:16: note: 'test_func_main_t' declared here - 238 | typedef void (*test_func_main_t)(int); - | ^~~~~~~~~~~~~~~~ -test_dfp2.c:667:8: error: too many arguments to function 'func'; expected 0, have 1 - 667 | (*func)(has_vsx); - | ~^~~~~~ ~~~~~~~ - -Fix this by just explicitly compiling that code with -std=gnu99. ---- - none/tests/ppc32/Makefile.am | 4 +++- - none/tests/ppc64/Makefile.am | 4 +++- - 2 files changed, 6 insertions(+), 2 deletions(-) - -diff --git a/none/tests/ppc32/Makefile.am b/none/tests/ppc32/Makefile.am -index 187cab74f763..7727876fdf66 100644 ---- a/none/tests/ppc32/Makefile.am -+++ b/none/tests/ppc32/Makefile.am -@@ -129,8 +129,10 @@ test_isa_2_06_part3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_ - - test_dfp1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ - @FLAG_M32@ $(BUILD_FLAGS_DFP) -+# Explicitly use -std=gnu99 because the meaning of void (*test_func_t)() -+# changed in c23, causing incompatible-pointer-types errors. - test_dfp2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ -- @FLAG_M32@ $(BUILD_FLAGS_DFP) -+ @FLAG_M32@ $(BUILD_FLAGS_DFP) -std=gnu99 - test_dfp3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ - @FLAG_M32@ $(BUILD_FLAGS_DFP) - test_dfp4_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ -diff --git a/none/tests/ppc64/Makefile.am b/none/tests/ppc64/Makefile.am -index f8eab9fc00b2..98a14b434bc4 100644 ---- a/none/tests/ppc64/Makefile.am -+++ b/none/tests/ppc64/Makefile.am -@@ -190,8 +190,10 @@ test_isa_2_06_part3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_ - - test_dfp1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ - @FLAG_M64@ $(BUILD_FLAGS_DFP) -+# Explicitly use -std=gnu99 because the meaning of void (*test_func_t)() -+# changed in c23, causing incompatible-pointer-types errors. - test_dfp2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ -- @FLAG_M64@ $(BUILD_FLAGS_DFP) -+ @FLAG_M64@ $(BUILD_FLAGS_DFP) -std=gnu99 - test_dfp3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ - @FLAG_M64@ $(BUILD_FLAGS_DFP) - test_dfp4_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \ --- -2.47.1 - diff --git a/0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch b/0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch deleted file mode 100644 index bdcd5b7..0000000 --- a/0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch +++ /dev/null @@ -1,57 +0,0 @@ -From ec7335142384ec9da66871036803b96319b590eb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= -Date: Mon, 3 Mar 2025 06:14:08 -0500 -Subject: [PATCH 16/18] syswrap-generic: Emit pp_ExeContext after the file - descriptor backtrace - -Adjust use_after_close test for the change. - -(cherry picked from commit 838dc01d2c42f7f22785c771bd74bc4e595da444) ---- - coregrind/m_syswrap/syswrap-generic.c | 2 +- - none/tests/use_after_close.stderr.exp | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c -index 1d80d09288ed..5222bcefe11b 100644 ---- a/coregrind/m_syswrap/syswrap-generic.c -+++ b/coregrind/m_syswrap/syswrap-generic.c -@@ -1179,6 +1179,7 @@ void fd_pp_Error (const Error *err) - } - VG_(emit)("%sFile descriptor %d %s%s\n", whatpre, nce->fd, - error_string, whatpost); -+ VG_(pp_ExeContext)(where); - /* If the file descriptor was never created we won't have - where_closed and where_opened. Only print them in a - use after close case. */ -@@ -1190,7 +1191,6 @@ void fd_pp_Error (const Error *err) - VG_(emit)("%sOriginally opened%s\n", auxpre, auxpost); - VG_(pp_ExeContext)(nce->where_opened); - } -- VG_(pp_ExeContext)(where); - } else { - vg_assert2 (False, "Unknown error kind: %d", - VG_(get_error_kind)(err)); -diff --git a/none/tests/use_after_close.stderr.exp b/none/tests/use_after_close.stderr.exp -index 1ef31c6551eb..75a8d6672949 100644 ---- a/none/tests/use_after_close.stderr.exp -+++ b/none/tests/use_after_close.stderr.exp -@@ -1,13 +1,13 @@ - bad - File descriptor 3 was closed already -+ at 0x........: write (in /...libc...) -+ by 0x........: main - Previously closed - at 0x........: close (in /...libc...) - by 0x........: main - Originally opened - at 0x........: dup (in /...libc...) - by 0x........: main -- at 0x........: write (in /...libc...) -- by 0x........: main - File descriptor 7 was never created - at 0x........: write (in /...libc...) - by 0x........: main --- -2.48.1 - diff --git a/0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch b/0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch deleted file mode 100644 index 24b424b..0000000 --- a/0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 2c17a8a3e865816ee48e7f78148bbc7240c2a38c Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Wed, 12 Mar 2025 13:57:19 +0100 -Subject: [PATCH 17/18] add_hardwired_spec for ld-linux-x86-64.so.2 memcmp - -With RPATH processing ld.so compiled for x86-64-v3 uses an optimized -avx2 memcmp (bcmp) which causes (false postive) memcheck invalid reads -of size 32 warnings. - -Fix this my adding a hardwire spec with a simpler memcmp for -ld-linux-x86-64.so.2. - -https://bugs.kde.org/show_bug.cgi?id=501348 - -Authored-by: Florian Weimer - -(cherry picked from commit 9ffdeb4927b8505cc5a9ea54f608f4972166bb0e) ---- - NEWS | 1 + - coregrind/m_redir.c | 9 +++++++++ - coregrind/m_trampoline.S | 19 +++++++++++++++++++ - coregrind/pub_core_trampoline.h | 1 + - 4 files changed, 30 insertions(+) - -diff --git a/NEWS b/NEWS -index 7f9e005c59f4..fe225c666c77 100644 ---- a/NEWS -+++ b/NEWS -@@ -11,6 +11,7 @@ The following bugs have been fixed or resolved on this branch. - 498317 FdBadUse is not a valid CoreError type in a suppression - even though it's generated by --gen-suppressions=yes - 498143 False positive on EVIOCGRAB ioctl -+501348 glibc built with -march=x86-64-v3 does not work due to ld.so memcmp - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c -index f9e8d8801a19..64ebea3b6304 100644 ---- a/coregrind/m_redir.c -+++ b/coregrind/m_redir.c -@@ -1425,6 +1425,15 @@ void VG_(redir_initialise) ( void ) - NULL - # else - complain_about_stripped_glibc_ldso -+# endif -+ ); -+ add_hardwired_spec( -+ "ld-linux-x86-64.so.2", "memcmp", -+ (Addr)&VG_(amd64_linux_REDIR_FOR_memcmp), -+# ifndef GLIBC_MANDATORY_STRLEN_REDIRECT -+ NULL -+# else -+ complain_about_stripped_glibc_ldso - # endif - ); - } -diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S -index e897963be21a..27f1b35d2b08 100644 ---- a/coregrind/m_trampoline.S -+++ b/coregrind/m_trampoline.S -@@ -241,6 +241,25 @@ VG_(amd64_linux_REDIR_FOR_strcmp): - ret - .size VG_(amd64_linux_REDIR_FOR_strcmp), .-VG_(amd64_linux_REDIR_FOR_strcmp) - -+.global VG_(amd64_linux_REDIR_FOR_memcmp) -+.type VG_(amd64_linux_REDIR_FOR_memcmp), @function -+VG_(amd64_linux_REDIR_FOR_memcmp): -+ xorl %ecx, %ecx -+ jmp 2f -+1: -+ movzbl (%rdi, %rcx), %eax -+ movzbl (%rsi, %rcx), %r8d -+ addq $1, %rcx -+ subl %r8d, %eax -+ jne 3f -+2: -+ cmpq %rcx, %rdx -+ jne 1b -+ xorl %eax, %eax -+3: -+ ret -+.size VG_(amd64_linux_REDIR_FOR_memcmp), .-VG_(amd64_linux_REDIR_FOR_memcmp) -+ - .global VG_(amd64_linux_REDIR_FOR_index) - .type VG_(amd64_linux_REDIR_FOR_index), @function - VG_(amd64_linux_REDIR_FOR_index): -diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h -index d0bd6b859742..3d2f7e9f32b7 100644 ---- a/coregrind/pub_core_trampoline.h -+++ b/coregrind/pub_core_trampoline.h -@@ -82,6 +82,7 @@ extern Addr VG_(amd64_linux_REDIR_FOR_vtime); - extern Addr VG_(amd64_linux_REDIR_FOR_vgetcpu); - extern UInt VG_(amd64_linux_REDIR_FOR_strlen)( void* ); - extern Int VG_(amd64_linux_REDIR_FOR_strcmp)( void*, void* ); -+extern Int VG_(amd64_linux_REDIR_FOR_memcmp)( void*, void*, SizeT ); - extern Char* VG_(amd64_linux_REDIR_FOR_index) ( const Char*, Int ); - #endif - --- -2.48.1 - diff --git a/0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch b/0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch deleted file mode 100644 index cf0469b..0000000 --- a/0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 7b2806871f15977db3a64a59f70d48f55ba3228e Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Thu, 16 Jan 2025 17:30:37 +0100 -Subject: [PATCH 18/18] gdbserver_tests: filter out new Missing rpms message - -As seen on the fedora 40 s390x tester. GDB now might output something -like: - -Missing rpms, try: dnf --enablerepo='*debug*' install glibc-debuginfo-2.39-33.fc40.s390x - -Filter those messages out to get zero fail test results again. - -(cherry picked from commit 090f8ce59b5f3d3ec39e032ee5e9524ce4f51a44) ---- - gdbserver_tests/filter_gdb.in | 1 + - gdbserver_tests/filter_memcheck_monitor.in | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in -index 094ea933ec51..2bef9f3ee57b 100755 ---- a/gdbserver_tests/filter_gdb.in -+++ b/gdbserver_tests/filter_gdb.in -@@ -265,6 +265,7 @@ s/^0x........ in \(\w\+ (\)/\1/ - - # delete any missing debuginfo messages - /^Missing debuginfo.*/d -+/^Missing rpms.*/d - - EOF - -diff --git a/gdbserver_tests/filter_memcheck_monitor.in b/gdbserver_tests/filter_memcheck_monitor.in -index 6e8a49a303ba..e407e7b92158 100755 ---- a/gdbserver_tests/filter_memcheck_monitor.in -+++ b/gdbserver_tests/filter_memcheck_monitor.in -@@ -31,6 +31,7 @@ $dir/filter_vgdb | - $SED -e '/Cannot access memory at address 0x......../d' \ - -e '/^[1-9][0-9]* \.\.\/sysdeps\/powerpc\/powerpc32\/dl-start\.S: No such file or directory\./d' \ - -e '/^Missing separate debuginfo/d' \ -+ -e '/^Missing rpms/d' \ - -e '/^Try: zypper install -C/d' \ - -e 's/Test 3: FAIL: expected si_code==2, not 128/Test 3: PASS/' \ - -e 's/in use at exit: [0-9][0-9,]* bytes in [0-9][0-9]* blocks/in use at exit: ... bytes in ... blocks/' \ --- -2.48.1 - diff --git a/0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch b/0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch deleted file mode 100644 index 8e2e138..0000000 --- a/0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 275b98d60cee65acee7dd5793210aea7a0921bd2 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Fri, 28 Mar 2025 13:44:35 +0100 -Subject: [PATCH 19/22] filter_gdb.in: __syscall_cancel_arch is just in a - syscall - -Since glibc 2.41 some extra syscall_cancel frames are inserted before -that actual syscall is made. Just filter out __syscall_cancel_arch -from the gdb output and replace it with "in syscall ..." to make the -regtest .exp match. - -https://bugs.kde.org/show_bug.cgi?id=502126 - -(cherry picked from commit f3f30becff5851b0d0b2caa7e96e661c7889f7d1) ---- - gdbserver_tests/filter_gdb.in | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in -index 2bef9f3ee57b..e2b329a60483 100755 ---- a/gdbserver_tests/filter_gdb.in -+++ b/gdbserver_tests/filter_gdb.in -@@ -134,6 +134,9 @@ s/^>[> ]*// - # anonymise a 'general' system calls stack trace part - s/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../ - -+# in __syscall_cancel_arch is just in a syscall -+s/in __syscall_cancel_arch .*/in syscall .../ -+ - # anonymise kill syscall. - s/in kill ().*$/in syscall .../ - --- -2.48.1 - diff --git a/0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch b/0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch deleted file mode 100644 index 59d951a..0000000 --- a/0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch +++ /dev/null @@ -1,177 +0,0 @@ -From f206268ad56899f935d420770088076671a6b014 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Sun, 23 Mar 2025 10:21:29 +0100 -Subject: [PATCH 20/22] Bug 501893 - Missing suppression for __wcscat_avx2 - (strcat-strlen-avx2.h.S:68)? - -(cherry picked from commit f87c58e89c4a0e85c59f39a7ae01027686bfff73) ---- - .gitignore | 1 + - NEWS | 1 + - memcheck/tests/Makefile.am | 2 ++ - memcheck/tests/wcpncpy.stderr.exp | 8 ++++---- - memcheck/tests/wcscat.c | 20 ++++++++++++++++++++ - memcheck/tests/wcscat.stderr.exp | 0 - memcheck/tests/wcscat.stdout.exp | 1 + - memcheck/tests/wcscat.vgtest | 2 ++ - shared/vg_replace_strmem.c | 29 +++++++++++++++++++++++++++++ - 9 files changed, 60 insertions(+), 4 deletions(-) - create mode 100644 memcheck/tests/wcscat.c - create mode 100644 memcheck/tests/wcscat.stderr.exp - create mode 100644 memcheck/tests/wcscat.stdout.exp - create mode 100644 memcheck/tests/wcscat.vgtest - -diff --git a/NEWS b/NEWS -index fe225c666c77..23cf88c505f0 100644 ---- a/NEWS -+++ b/NEWS -@@ -12,6 +12,7 @@ The following bugs have been fixed or resolved on this branch. - even though it's generated by --gen-suppressions=yes - 498143 False positive on EVIOCGRAB ioctl - 501348 glibc built with -march=x86-64-v3 does not work due to ld.so memcmp -+501893 Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)? - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am -index c3b5fdbe9443..2bcffbf5ced9 100644 ---- a/memcheck/tests/Makefile.am -+++ b/memcheck/tests/Makefile.am -@@ -445,6 +445,7 @@ EXTRA_DIST = \ - vcpu_fnfns.stderr.exp vcpu_fnfns.vgtest \ - wcpncpy.stderr.exp wcpncpy.vgtest \ - wcs.vgtest wcs.stderr.exp wcs.stdout.exp \ -+ wcscat.vgtest wcscat.stderr.exp wcscat.stdout.exp \ - wcsncpy.vgtest wcsncpy.stderr.exp \ - wmemcmp.vgtest wmemcmp.stderr.exp \ - wrap1.vgtest wrap1.stdout.exp wrap1.stderr.exp \ -@@ -551,6 +552,7 @@ check_PROGRAMS = \ - varinforestrict \ - vcpu_fbench vcpu_fnfns \ - wcs \ -+ wcscat \ - xml1 \ - wmemcmp \ - wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \ -diff --git a/memcheck/tests/wcpncpy.stderr.exp b/memcheck/tests/wcpncpy.stderr.exp -index abe23b7730e1..0ff9e5c7417c 100644 ---- a/memcheck/tests/wcpncpy.stderr.exp -+++ b/memcheck/tests/wcpncpy.stderr.exp -@@ -1,19 +1,19 @@ - Conditional jump or move depends on uninitialised value(s) -- at 0x........: wcpncpy (vg_replace_strmem.c:2426) -+ at 0x........: wcpncpy (vg_replace_strmem.c:2427) - by 0x........: main (wcpncpy.c:14) - - Invalid write of size 4 -- at 0x........: wcpncpy (vg_replace_strmem.c:2426) -+ at 0x........: wcpncpy (vg_replace_strmem.c:2427) - by 0x........: main (wcpncpy.c:27) - Address 0x........ is 20 bytes inside a block of size 22 alloc'd - at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (wcpncpy.c:10) - - Source and destination overlap in wcpncpy(0x........, 0x........) -- at 0x........: wcpncpy (vg_replace_strmem.c:2426) -+ at 0x........: wcpncpy (vg_replace_strmem.c:2427) - by 0x........: main (wcpncpy.c:35) - - Source and destination overlap in wcpncpy(0x........, 0x........) -- at 0x........: wcpncpy (vg_replace_strmem.c:2426) -+ at 0x........: wcpncpy (vg_replace_strmem.c:2427) - by 0x........: main (wcpncpy.c:43) - -diff --git a/memcheck/tests/wcscat.c b/memcheck/tests/wcscat.c -new file mode 100644 -index 000000000000..bf3ec70c6d2d ---- /dev/null -+++ b/memcheck/tests/wcscat.c -@@ -0,0 +1,20 @@ -+// See https://bugs.kde.org/show_bug.cgi?id=501893 -+#include -+#include -+#include -+#include -+ -+int main(void) -+{ -+ wchar_t* str = malloc(sizeof(L"/usr/lib/python310.zip:/usr/lib/python3.10:")); -+ wchar_t* add1 = wcsdup(L"/usr/lib/python310.zip:/usr/lib/python3.10"); -+ wchar_t* add2 = wcsdup(L":"); -+ str[0] = 0; -+ wcscat(str, add1); -+ wcscat(str, add2); -+ setlocale(LC_ALL, "en_US.utf8"); -+ printf("%ls\n", str); -+ free(str); -+ free(add1); -+ free(add2); -+} -diff --git a/memcheck/tests/wcscat.stderr.exp b/memcheck/tests/wcscat.stderr.exp -new file mode 100644 -index 000000000000..e69de29bb2d1 -diff --git a/memcheck/tests/wcscat.stdout.exp b/memcheck/tests/wcscat.stdout.exp -new file mode 100644 -index 000000000000..b5b8c09e5393 ---- /dev/null -+++ b/memcheck/tests/wcscat.stdout.exp -@@ -0,0 +1 @@ -+/usr/lib/python310.zip:/usr/lib/python3.10: -diff --git a/memcheck/tests/wcscat.vgtest b/memcheck/tests/wcscat.vgtest -new file mode 100644 -index 000000000000..30b25d0efc89 ---- /dev/null -+++ b/memcheck/tests/wcscat.vgtest -@@ -0,0 +1,2 @@ -+prog: wcscat -+vgopts: -q -diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c -index ae13a2a5f87a..71f15c85fb71 100644 ---- a/shared/vg_replace_strmem.c -+++ b/shared/vg_replace_strmem.c -@@ -108,6 +108,7 @@ - 20480 WCSNCPY - 20490 MEMCCPY - 20500 WCPNCPY -+ 20510 WCSCAT - */ - - #if defined(VGO_solaris) -@@ -2426,6 +2427,34 @@ static inline void my_exit ( int x ) - WCPNCPY(VG_Z_LIBC_SONAME, wcpncpy) - #endif - -+/*----------------------- wcscat ----------------------*/ -+ -+#define WCSCAT(soname, fnname) \ -+ Int* VG_REPLACE_FUNCTION_EZU(20510,soname,fnname) \ -+ ( Int *restrict dest, const Int *restrict src ); \ -+ Int* VG_REPLACE_FUNCTION_EZU(20510,soname,fnname) \ -+ ( Int *restrict dest, const Int *restrict src ) \ -+ { \ -+ const Int* src_orig = src; \ -+ Int* dest_orig = dest; \ -+ while (*dest) dest++; \ -+ while (*src) *dest++ = *src++; \ -+ *dest = 0; \ -+ \ -+ /* This is a bit redundant, I think; any overlap and the wcscat will */ \ -+ /* go forever... or until a seg fault occurs. */ \ -+ if (is_overlap(dest_orig, \ -+ src_orig, \ -+ (Addr)dest-(Addr)dest_orig+1, \ -+ (Addr)src-(Addr)src_orig+1)) \ -+ RECORD_OVERLAP_ERROR("wcscat", dest_orig, src_orig, 0); \ -+ \ -+ return dest_orig; \ -+ } -+ -+#if defined(VGO_linux) -+ WCSCAT(VG_Z_LIBC_SONAME, __wcscat_avx2) -+#endif - - /*------------------------------------------------------------*/ - /*--- Improve definedness checking of process environment ---*/ --- -2.48.1 - diff --git a/0021-filter_gdb.in-filter-out-__libc_do_syscall.patch b/0021-filter_gdb.in-filter-out-__libc_do_syscall.patch deleted file mode 100644 index 0e5d628..0000000 --- a/0021-filter_gdb.in-filter-out-__libc_do_syscall.patch +++ /dev/null @@ -1,37 +0,0 @@ -From e4d9cc414d13fa0685da8f1c7ac6bf027cadd730 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Sun, 30 Mar 2025 13:08:55 +0200 -Subject: [PATCH 21/22] filter_gdb.in: filter out __libc_do_syscall - -On i386 and armhf __libc_do_syscall might be used to invoke a syscall. -Replace __libc_do_syscall with "in syscall ..." and filter out -possible extra (assembly) source file lines containing -libc-do-syscall.S from the gdb output. - -https://bugs.kde.org/show_bug.cgi?id=502126 - -(cherry picked from commit ddcb3aa3ed3188cd28c193225245a76e928b850b) ---- - gdbserver_tests/filter_gdb.in | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in -index e2b329a60483..d7b1bb11c64c 100755 ---- a/gdbserver_tests/filter_gdb.in -+++ b/gdbserver_tests/filter_gdb.in -@@ -137,6 +137,12 @@ s/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../ - # in __syscall_cancel_arch is just in a syscall - s/in __syscall_cancel_arch .*/in syscall .../ - -+# do_syscall is in syscall -+s/__libc_do_syscall ().*/0x........ in syscall .../ -+ -+# extra source code line -+/libc-do-syscall.S/d -+ - # anonymise kill syscall. - s/in kill ().*$/in syscall .../ - --- -2.48.1 - diff --git a/0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch b/0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch deleted file mode 100644 index 58ee4a5..0000000 --- a/0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch +++ /dev/null @@ -1,109 +0,0 @@ -From f18977fe271fc7dbfbf5d1657366cf69ec1361b8 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Sun, 30 Mar 2025 17:38:21 +0200 -Subject: [PATCH 22/22] Handle top __syscall_cancel frames when getting stack - traces - -Since glibc 2.41 there are extra frames inserted before doing a -syscall to support proper thread cancellation. This breaks various -suppressions and regtests involving checking syscall arguments. - -Solve this by removing those extra frames from the top of the call -stack when we are processing a linux system call. - -https://bugs.kde.org/show_bug.cgi?id=502126 -(cherry picked from commit 41441379baa63b5471385361d08c8df317705b69) ---- - NEWS | 1 + - coregrind/m_stacktrace.c | 53 +++++++++++++++++++++++++++++++++++++++- - 2 files changed, 53 insertions(+), 1 deletion(-) - -diff --git a/NEWS b/NEWS -index 23cf88c505f0..8b43361eb255 100644 ---- a/NEWS -+++ b/NEWS -@@ -13,6 +13,7 @@ The following bugs have been fixed or resolved on this branch. - 498143 False positive on EVIOCGRAB ioctl - 501348 glibc built with -march=x86-64-v3 does not work due to ld.so memcmp - 501893 Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)? -+502126 glibc 2.41 extra syscall_cancel frames - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c -index 630b5b87524c..0ddd3639cd8a 100644 ---- a/coregrind/m_stacktrace.c -+++ b/coregrind/m_stacktrace.c -@@ -9,6 +9,8 @@ - - Copyright (C) 2000-2017 Julian Seward - jseward@acm.org -+ Copyright (C) 2025 Mark J. Wielaard -+ mark@klomp.org - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as -@@ -1598,10 +1600,59 @@ UInt VG_(get_StackTrace_with_deltas)( - tid, stack_highest_byte, - startRegs.r_pc, startRegs.r_sp); - -- return VG_(get_StackTrace_wrk)(tid, ips, n_ips, -+ Int found = VG_(get_StackTrace_wrk)(tid, ips, n_ips, - sps, fps, - &startRegs, - stack_highest_byte); -+ -+#if defined(VGO_linux) -+ /* glibc might insert some extra frames before doing a syscall to support -+ thread cancellation. This breaks various suppressions and regtests -+ involving checking syscall arguments. So when processing a syscall just -+ remove those extra frames from the top of the call stack. */ -+ if (VG_(is_in_syscall)(tid)) { -+ Int i; -+ Int start = 0; -+ DiEpoch ep = VG_(current_DiEpoch)(); -+ for (i = 0; i < found; i++) { -+ /* This could be made a little more efficient by doing the lookups -+ for the symbols at glibc load time and check the address falls -+ inside the function symbol address range here. But given this -+ is only called during syscall processing, this is probably fine -+ for now. */ -+ const HChar *buf; -+ if (VG_(get_fnname_raw)(ep, ips[i], &buf)) { // raw, don't demangle -+ if (VG_STREQ("__syscall_cancel_arch", buf) || -+ VG_STREQ("__internal_syscall_cancel", buf) || -+#if defined(VGP_x86_linux) || defined(VGP_arm_linux) -+ VG_STREQ("__libc_do_syscall", buf) || -+#endif -+#if defined(VGP_x86_linux) -+ VG_STREQ("_dl_sysinfo_int80", buf) || -+#endif -+ VG_STREQ("__syscall_cancel", buf)) { -+ start++; -+ continue; // Maybe the next one is special too? -+ } else { -+ break; // Not special, only skip top stack names. -+ } -+ } else { -+ break; // No name, not special, don't skip. -+ } -+ } -+ -+ if (start > 0) { -+ for (i = 0; i < (found - start); i++) { -+ ips[i] = ips[i + start]; -+ if (sps) sps[i] = sps[i + start]; -+ if (fps) fps[i] = fps[i + start]; -+ } -+ return found - start; -+ } -+ } -+#endif -+ -+ return found; - } - - UInt VG_(get_StackTrace) ( ThreadId tid, --- -2.48.1 - diff --git a/sources b/sources index 6713bf4..1a6303b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.24.0.tar.bz2) = 6c131ff93d1f432d8362a47285cc377cba224ebca4f18e922c6156f7736d43020ece14d8fd16913498ab00fd18c85e2042a7d5351c3901e80413c584ebb406f3 +SHA512 (valgrind-3.25.0.RC1.tar.bz2) = 448655499e20c00f41b9390c5ee693e78e5aa319aa414437ffdf5ed5028dabd1478a04ce97a7b7780d4415efbc0a51de9eb0abb30be379e490fed7bf188107a5 diff --git a/valgrind.spec b/valgrind.spec index 63a682e..d12837d 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.24.0 -Release: 8%{?dist} +Version: 3.25.0 +Release: 0.1.RC1%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -71,7 +71,7 @@ URL: https://www.valgrind.org/ # So those will already have their full symbol table. %undefine _include_minidebuginfo -Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.tar.bz2 +Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC1.tar.bz2 # Needs investigation and pushing upstream Patch1: valgrind-3.9.0-cachegrind-improvements.patch @@ -85,30 +85,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 -# VALGRIND_3_24_BRANCH patches -Patch5: 0001-Prepare-NEWS-for-branch-3.24-fixes.patch -Patch6: 0002-vgdb.c-fork_and_exec_valgrind-Fix-off-by-one-error-w.patch -Patch7: 0003-vgdb.c-fork_and_exec_valgrind-Fix-another-off-by-one.patch -Patch8: 0004-regtest-add-a-fdleak-filter-for-write-on-write-on-li.patch -Patch9: 0005-Add-exp-and-supp-patterns-for-missing-main-frame-for.patch -Patch10: 0006-Add-additional-exp-ppc64le-files-to-EXTRA_DIST.patch -Patch11: 0007-Add-support-for-landlock_create_ruleset-444-landlock.patch -Patch12: 0008-helgrind-tests-tc17_sembar.c-Remove-bool-typedef.patch -Patch13: 0009-drd-tests-swapcontext.c-Rename-typedef-struct-thread.patch -Patch14: 0010-none-tests-bug234814.c-sa_handler-take-an-int-as-arg.patch -Patch15: 0011-Add-open_tree-move_mount-fsopen-fsconfig-fsmount-fsp.patch -Patch16: 0012-Recognize-new-DWARF5-DW_LANG-constants.patch -Patch17: 0013-Bug-498317-FdBadUse-is-not-a-valid-CoreError-type-in.patch -Patch18: 0014-linux-support-EVIOCGRAB-ioctl.patch -Patch19: 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch -Patch20: 0016-syswrap-generic-Emit-pp_ExeContext-after-the-file-de.patch -Patch21: 0017-add_hardwired_spec-for-ld-linux-x86-64.so.2-memcmp.patch -Patch22: 0018-gdbserver_tests-filter-out-new-Missing-rpms-message.patch -Patch23: 0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch -Patch24: 0020-Bug-501893-Missing-suppression-for-__wcscat_avx2-str.patch -Patch25: 0021-filter_gdb.in-filter-out-__libc_do_syscall.patch -Patch26: 0022-Handle-top-__syscall_cancel-frames-when-getting-stac.patch - BuildRequires: make BuildRequires: glibc-devel @@ -161,7 +137,7 @@ BuildRequires: python3-devel # We could use %%valgrind_arches as defined in redhat-rpm-config # But that is really for programs using valgrind, it defines the # set of architectures that valgrind works correctly on. -ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64 +ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64 riscv64 # Define valarch, the architecture name that valgrind uses # And only_arch, the configure option to only build for that arch. @@ -197,6 +173,10 @@ ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64 %define valarch arm64 %define only_arch --enable-only64bit %endif +%ifarch riscv64 +%define valarch riscv64 +%define only_arch --enable-only64bit +%endif %description Valgrind is an instrumentation framework for building dynamic analysis @@ -277,36 +257,13 @@ Valgrind User Manual for details. %endif %prep -%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version} +%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC1 %patch -P1 -p1 %patch -P2 -p1 %patch -P3 -p1 %patch -P4 -p1 -%patch -P5 -p1 -%patch -P6 -p1 -%patch -P7 -p1 -%patch -P8 -p1 -%patch -P9 -p1 -%patch -P10 -p1 -%patch -P11 -p1 -%patch -P12 -p1 -%patch -P13 -p1 -%patch -P14 -p1 -%patch -P15 -p1 -%patch -P16 -p1 -%patch -P17 -p1 -%patch -P18 -p1 -%patch -P19 -p1 -%patch -P20 -p1 -%patch -P21 -p1 -%patch -P22 -p1 -%patch -P23 -p1 -%patch -P24 -p1 -%patch -P25 -p1 -%patch -P26 -p1 - %build # LTO triggers undefined symbols in valgrind. But valgrind has a # --enable-lto configure time option that we will use instead. @@ -545,6 +502,11 @@ echo ===============END TESTING=============== %endif %changelog +* Fri Apr 18 2025 Mark Wielaard - 3.25.0-0.1.RC1 +- Upstream 3.25.0-RC1 +- Remove all VALGRIND_3_24_BRANCH patches +- Enable riscv64 arch support + * Sun Mar 30 2025 Mark Wielaard - 3.24.0-8 - Add new VALGRIND_3_24_BRANCH patches - 0019-filter_gdb.in-__syscall_cancel_arch-is-just-in-a-sys.patch From 5aabba389f2c1d2f06bebe601e0699ce615eb646 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 24 Apr 2025 04:08:55 +0200 Subject: [PATCH 09/30] 3.25.0-0.1.RC2 --- .gitignore | 1 + sources | 2 +- valgrind.spec | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index f54faf4..b586850 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ /valgrind-3.23.0.tar.bz2 /valgrind-3.24.0.tar.bz2 /valgrind-3.25.0.RC1.tar.bz2 +/valgrind-3.25.0.RC2.tar.bz2 diff --git a/sources b/sources index 1a6303b..67219a5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.25.0.RC1.tar.bz2) = 448655499e20c00f41b9390c5ee693e78e5aa319aa414437ffdf5ed5028dabd1478a04ce97a7b7780d4415efbc0a51de9eb0abb30be379e490fed7bf188107a5 +SHA512 (valgrind-3.25.0.RC2.tar.bz2) = 21827f76f6441fa682bfe78c9ec8dd7077780e733c7cd3044257c39838f28b407a06fb5da09163081a10e2fc0f3905b3ea98d97b0efe784afc2906c00ea660ec diff --git a/valgrind.spec b/valgrind.spec index d12837d..af028bf 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.25.0 -Release: 0.1.RC1%{?dist} +Release: 0.1.RC2%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -71,7 +71,7 @@ URL: https://www.valgrind.org/ # So those will already have their full symbol table. %undefine _include_minidebuginfo -Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC1.tar.bz2 +Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC2.tar.bz2 # Needs investigation and pushing upstream Patch1: valgrind-3.9.0-cachegrind-improvements.patch @@ -257,7 +257,7 @@ Valgrind User Manual for details. %endif %prep -%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC1 +%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC2 %patch -P1 -p1 %patch -P2 -p1 @@ -502,6 +502,9 @@ echo ===============END TESTING=============== %endif %changelog +* Wed Apr 23 2025 Mark Wielaard - 3.25.0-0.1.RC2 +- Upstream 3.25.0-RC2 + * Fri Apr 18 2025 Mark Wielaard - 3.25.0-0.1.RC1 - Upstream 3.25.0-RC1 - Remove all VALGRIND_3_24_BRANCH patches From 6bfb3b55aa3eadf2124dc88796d31a7622530981 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 25 Apr 2025 14:58:03 +0200 Subject: [PATCH 10/30] Valgrind 3.25.0 final --- .gitignore | 1 + sources | 2 +- valgrind.spec | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b586850..83af548 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ /valgrind-3.24.0.tar.bz2 /valgrind-3.25.0.RC1.tar.bz2 /valgrind-3.25.0.RC2.tar.bz2 +/valgrind-3.25.0.tar.bz2 diff --git a/sources b/sources index 67219a5..7102d08 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.25.0.RC2.tar.bz2) = 21827f76f6441fa682bfe78c9ec8dd7077780e733c7cd3044257c39838f28b407a06fb5da09163081a10e2fc0f3905b3ea98d97b0efe784afc2906c00ea660ec +SHA512 (valgrind-3.25.0.tar.bz2) = 1fc649ae346d5106b69fe2cf8b494fa441d63f576b16e62d90e547f760851e427a173b6d03c4076a8ae13df66717f66631f4dc6769ede15f5521bd95099a649d diff --git a/valgrind.spec b/valgrind.spec index af028bf..97f24d7 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.25.0 -Release: 0.1.RC2%{?dist} +Release: 1%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -71,7 +71,7 @@ URL: https://www.valgrind.org/ # So those will already have their full symbol table. %undefine _include_minidebuginfo -Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC2.tar.bz2 +Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.tar.bz2 # Needs investigation and pushing upstream Patch1: valgrind-3.9.0-cachegrind-improvements.patch @@ -257,7 +257,7 @@ Valgrind User Manual for details. %endif %prep -%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC2 +%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version} %patch -P1 -p1 %patch -P2 -p1 @@ -502,6 +502,9 @@ echo ===============END TESTING=============== %endif %changelog +* Fri Apr 25 2025 Mark Wielaard - 3.25.0-1 +- Valgrind 3.25.0 final + * Wed Apr 23 2025 Mark Wielaard - 3.25.0-0.1.RC2 - Upstream 3.25.0-RC2 From 5d0c2c856b90fddd95377922cd7455c98f74c5b1 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 10 May 2025 01:55:19 +0200 Subject: [PATCH 11/30] 3.25.0-2 - Add VALGRIND_3_25_BRANCH patches --- valgrind.spec | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/valgrind.spec b/valgrind.spec index 97f24d7..6725a26 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.25.0 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -85,6 +85,13 @@ Patch3: valgrind-3.16.0-some-stack-protector.patch # Add some -Wl,z,now. Patch4: valgrind-3.16.0-some-Wl-z-now.patch +# VALGRIND_3_25_BRANCH patches +Patch5: 0001-Prepare-NEWS-for-branch-3.25-fixes.patch +Patch6: 0002-FreeBSD-close_range-syscall.patch +Patch7: 0003-Bug-503641-close_range-syscalls-started-failing-with.patch +Patch8: 0004-mount-syscall-param-filesystemtype-may-be-NULL.patch +Patch9: 0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch + BuildRequires: make BuildRequires: glibc-devel @@ -264,6 +271,12 @@ Valgrind User Manual for details. %patch -P3 -p1 %patch -P4 -p1 +%patch -P5 -p1 +%patch -P6 -p1 +%patch -P7 -p1 +%patch -P8 -p1 +%patch -P9 -p1 + %build # LTO triggers undefined symbols in valgrind. But valgrind has a # --enable-lto configure time option that we will use instead. @@ -502,6 +515,9 @@ echo ===============END TESTING=============== %endif %changelog +* Fri May 9 2025 Mark Wielaard - 3.25.0-2 +- Add VALGRIND_3_25_BRANCH patches + * Fri Apr 25 2025 Mark Wielaard - 3.25.0-1 - Valgrind 3.25.0 final From 821c1d5c3fe2235434724146faa8e8163d646906 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 10 May 2025 02:06:15 +0200 Subject: [PATCH 12/30] Add VALGRIND_3_25_BRANCH patches --- 0001-Prepare-NEWS-for-branch-3.25-fixes.patch | 32 ++++ 0002-FreeBSD-close_range-syscall.patch | 160 ++++++++++++++++++ ..._range-syscalls-started-failing-with.patch | 144 ++++++++++++++++ ...all-param-filesystemtype-may-be-NULL.patch | 90 ++++++++++ ...or-missing-riscv_hwprobe-syscall-258.patch | 50 ++++++ 5 files changed, 476 insertions(+) create mode 100644 0001-Prepare-NEWS-for-branch-3.25-fixes.patch create mode 100644 0002-FreeBSD-close_range-syscall.patch create mode 100644 0003-Bug-503641-close_range-syscalls-started-failing-with.patch create mode 100644 0004-mount-syscall-param-filesystemtype-may-be-NULL.patch create mode 100644 0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch diff --git a/0001-Prepare-NEWS-for-branch-3.25-fixes.patch b/0001-Prepare-NEWS-for-branch-3.25-fixes.patch new file mode 100644 index 0000000..527cebb --- /dev/null +++ b/0001-Prepare-NEWS-for-branch-3.25-fixes.patch @@ -0,0 +1,32 @@ +From 1b9e202f13daffe3b4aa0c0e4a5e8e644055145e Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Fri, 9 May 2025 16:43:06 +0200 +Subject: [PATCH 1/5] Prepare NEWS for branch 3.25 fixes + +--- + NEWS | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/NEWS b/NEWS +index cd4670aca684..08fc1117d6a7 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,3 +1,15 @@ ++Branch 3.25 ++~~~~~~~~~~~ ++ ++* ==================== FIXED BUGS ==================== ++ ++The following bugs have been fixed or resolved on this branch. ++ ++To see details of a given bug, visit ++ https://bugs.kde.org/show_bug.cgi?id=XXXXXX ++where XXXXXX is the bug number as listed above. ++ ++ + Release 3.25.0 (25 Apr 2025) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +-- +2.49.0 + diff --git a/0002-FreeBSD-close_range-syscall.patch b/0002-FreeBSD-close_range-syscall.patch new file mode 100644 index 0000000..327e3d2 --- /dev/null +++ b/0002-FreeBSD-close_range-syscall.patch @@ -0,0 +1,160 @@ +From 34eb704121e61257ea9f1937ce4e56863d60d793 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Fri, 2 May 2025 16:59:58 +0200 +Subject: [PATCH 2/5] FreeBSD close_range syscall + +Simplify the checking. No ned to test for reserved fds, +and just split the close_range if debug output is enabled. + +Add a call to close_range with an upper bound of ~0U in the +testcase. + +These changes will probably be the basis for fixing +https://bugs.kde.org/show_bug.cgi?id=503641 + +(cherry picked from commit 8edc2fa6f8d70dbe10d634adff2513aa68143a22) +--- + coregrind/m_syswrap/syswrap-freebsd.c | 62 +++++++++++++-------------- + memcheck/tests/close_range.c | 5 ++- + memcheck/tests/close_range.stderr.exp | 6 +-- + 3 files changed, 38 insertions(+), 35 deletions(-) + +diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c +index 7ea04fdbc6be..41cd0756196b 100644 +--- a/coregrind/m_syswrap/syswrap-freebsd.c ++++ b/coregrind/m_syswrap/syswrap-freebsd.c +@@ -6615,10 +6615,8 @@ POST(sys___realpathat) + // int close_range(u_int lowfd, u_int highfd, int flags); + PRE(sys_close_range) + { +- SysRes res = VG_(mk_SysRes_Success)(0); +- unsigned int lowfd = ARG1; +- unsigned int fd_counter; // will count from lowfd to highfd +- unsigned int highfd = ARG2; ++ UInt lowfd = ARG1; ++ UInt highfd = ARG2; + + /* on linux the may lock if futexes are used + * there is a lock in the kernel but I assume it's just +@@ -6642,46 +6640,48 @@ PRE(sys_close_range) + return; + } + +- fd_counter = lowfd; +- do { +- if (fd_counter > highfd +- || (fd_counter == 2U/*stderr*/ && VG_(debugLog_getLevel)() > 0) +- || fd_counter == VG_(log_output_sink).fd +- || fd_counter == VG_(xml_output_sink).fd) { +- /* Split the range if it contains a file descriptor we're not +- * supposed to close. */ +- if (fd_counter - 1 >= lowfd) { +- res = VG_(do_syscall3)(__NR_close_range, (UWord)lowfd, (UWord)fd_counter - 1, ARG3 ); +- } +- lowfd = fd_counter + 1; +- } +- } while (fd_counter++ <= highfd); ++ vg_assert(VG_(log_output_sink).fd == -1 || ++ VG_(log_output_sink).fd >= VG_(fd_hard_limit)); ++ vg_assert(VG_(xml_output_sink).fd == -1 || ++ VG_(xml_output_sink).fd >= VG_(fd_hard_limit)); + +- /* If it failed along the way, it's presumably the flags being wrong. */ +- SET_STATUS_from_SysRes (res); ++ if (VG_(debugLog_getLevel)() > 0 && ++ lowfd <= 2U && ++ highfd >= 2U && ++ lowfd != highfd) { ++ SysRes res = VG_(mk_SysRes_Success)(0); ++ if (lowfd <= 1U) { ++ res = VG_(do_syscall3)(__NR_close_range, lowfd, 1U, ARG3); ++ } ++ if (!sr_isError(res) && highfd >= 3U) { ++ res = VG_(do_syscall3)(__NR_close_range, 3U, highfd, ARG3); ++ } ++ /* If it failed along the way, it's presumably the flags being wrong. */ ++ SET_STATUS_from_SysRes (res); ++ } else { ++ SET_STATUS_from_SysRes(VG_(do_syscall3)(__NR_close_range, lowfd, highfd, ARG3)); ++ } + } + + POST(sys_close_range) + { +- unsigned int fd; +- unsigned int last = ARG2; ++ UInt fd; ++ UInt highfd = ARG2; + + if (!VG_(clo_track_fds) + || (ARG3 & VKI_CLOSE_RANGE_CLOEXEC) != 0) + return; + +- if (last >= VG_(fd_hard_limit)) +- last = VG_(fd_hard_limit) - 1; ++ if (highfd >= VG_(fd_hard_limit)) ++ highfd = VG_(fd_hard_limit) - 1; + + /* If the close_range range is too wide, we don't want to loop + through the whole range. */ +- if (ARG2 == ~0U) +- ML_(record_fd_close_range)(tid, ARG1); +- else { +- for (fd = ARG1; fd <= last; fd++) +- if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0) +- && fd != VG_(log_output_sink).fd +- && fd != VG_(xml_output_sink).fd) ++ if (ARG2 >= VG_(fd_hard_limit)) { ++ ML_(record_fd_close_range)(tid, ARG1); ++ } else { ++ for (fd = ARG1; fd <= highfd; fd++) ++ if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0)) + ML_(record_fd_close)(tid, fd); + } + } +diff --git a/memcheck/tests/close_range.c b/memcheck/tests/close_range.c +index 6d8b5a0ba842..5c21e7f42b6a 100644 +--- a/memcheck/tests/close_range.c ++++ b/memcheck/tests/close_range.c +@@ -65,7 +65,7 @@ int main(void) + + errno = 0; + // wrong order +- close_range(fd3, fd1, 2); ++ close_range(fd3, fd1, 0); + assert(errno = EINVAL); + + errno = 0; +@@ -82,6 +82,9 @@ int main(void) + + close_range(3, rl.rlim_cur+1, 0); + ++ int res = close_range(2U, ~0U, 0); ++ assert(res == 0); ++ + { + unsigned a; + unsigned b; +diff --git a/memcheck/tests/close_range.stderr.exp b/memcheck/tests/close_range.stderr.exp +index 2f4d018f22e1..51dfcd40a5f7 100644 +--- a/memcheck/tests/close_range.stderr.exp ++++ b/memcheck/tests/close_range.stderr.exp +@@ -1,12 +1,12 @@ + Syscall param close_range(lowfd) contains uninitialised byte(s) + at 0x........: close_range (in /...libc...) +- by 0x........: main (close_range.c:89) ++ by 0x........: main (close_range.c:92) + + Syscall param close_range(highfd) contains uninitialised byte(s) + at 0x........: close_range (in /...libc...) +- by 0x........: main (close_range.c:89) ++ by 0x........: main (close_range.c:92) + + Syscall param close_range(flags) contains uninitialised byte(s) + at 0x........: close_range (in /...libc...) +- by 0x........: main (close_range.c:89) ++ by 0x........: main (close_range.c:92) + +-- +2.49.0 + diff --git a/0003-Bug-503641-close_range-syscalls-started-failing-with.patch b/0003-Bug-503641-close_range-syscalls-started-failing-with.patch new file mode 100644 index 0000000..f81def4 --- /dev/null +++ b/0003-Bug-503641-close_range-syscalls-started-failing-with.patch @@ -0,0 +1,144 @@ +From 4e240e47f7a7560cf9383b6f9483bffd3a5ec289 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Fri, 2 May 2025 18:53:09 +0200 +Subject: [PATCH 3/5] Bug 503641 - close_range syscalls started failing with + 3.25.0 + +(cherry picked from commit 933e542b431f17681cc915de656e853dc16d4fe7) +--- + NEWS | 2 + + coregrind/m_syswrap/syswrap-linux.c | 58 ++++++++++----------- + memcheck/tests/close_range.stderr.exp.linux | 6 +-- + 3 files changed, 34 insertions(+), 32 deletions(-) + +diff --git a/NEWS b/NEWS +index 08fc1117d6a7..7cbe6344ac40 100644 +--- a/NEWS ++++ b/NEWS +@@ -5,6 +5,8 @@ Branch 3.25 + + The following bugs have been fixed or resolved on this branch. + ++503641 close_range syscalls started failing with 3.25.0 ++ + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX + where XXXXXX is the bug number as listed above. +diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c +index de710c97e435..6f3917830fa4 100644 +--- a/coregrind/m_syswrap/syswrap-linux.c ++++ b/coregrind/m_syswrap/syswrap-linux.c +@@ -13699,17 +13699,20 @@ PRE(sys_execveat) + + PRE(sys_close_range) + { +- SysRes res = VG_(mk_SysRes_Success)(0); +- Int beg, end; +- Int first = ARG1; +- Int last = ARG2; ++ UInt first = ARG1; ++ UInt last = ARG2; ++ ++ vg_assert(VG_(log_output_sink).fd == -1 || ++ VG_(log_output_sink).fd >= VG_(fd_hard_limit)); ++ vg_assert(VG_(xml_output_sink).fd == -1 || ++ VG_(xml_output_sink).fd >= VG_(fd_hard_limit)); + + FUSE_COMPATIBLE_MAY_BLOCK(); + PRINT("sys_close_range ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" + FMT_REGWORD "u )", ARG1, ARG2, ARG3); + PRE_REG_READ3(long, "close_range", + unsigned int, first, unsigned int, last, +- unsigned int, flags); ++ int, flags); + + if (first > last) { + SET_STATUS_Failure( VKI_EINVAL ); +@@ -13724,29 +13727,28 @@ PRE(sys_close_range) + return; + } + +- beg = end = first; +- do { +- if (end > last +- || (end == 2/*stderr*/ && VG_(debugLog_getLevel)() > 0) +- || end == VG_(log_output_sink).fd +- || end == VG_(xml_output_sink).fd) { +- /* Split the range if it contains a file descriptor we're not +- * supposed to close. */ +- if (end - 1 >= beg) +- res = VG_(do_syscall3)(__NR_close_range, (UWord)beg, (UWord)end - 1, ARG3 ); +- beg = end + 1; ++ if (VG_(debugLog_getLevel)() > 0 && ++ first <= 2U && ++ last >= 2U && ++ first != last) { ++ SysRes res = VG_(mk_SysRes_Success)(0); ++ if (first <= 1U) { ++ res = VG_(do_syscall3)(__NR_close_range, first, 1U, ARG3); + } +- } while (end++ <= last); +- +- /* If it failed along the way, it's presumably the flags being wrong. */ +- SET_STATUS_from_SysRes (res); ++ if (!sr_isError(res) && last >= 3U) { ++ res = VG_(do_syscall3)(__NR_close_range, 3U, last, ARG3); ++ } ++ /* If it failed along the way, it's presumably the flags being wrong. */ ++ SET_STATUS_from_SysRes (res); ++ } else { ++ SET_STATUS_from_SysRes(VG_(do_syscall3)(__NR_close_range, first, last, ARG3)); ++ } + } + + POST(sys_close_range) + { +- Int fd; +- Int first = ARG1; +- Int last = ARG2; ++ UInt fd; ++ UInt last = ARG2; + + if (!VG_(clo_track_fds) + || (ARG3 & VKI_CLOSE_RANGE_CLOEXEC) != 0) +@@ -13757,13 +13759,11 @@ POST(sys_close_range) + + /* If the close_range range is too wide, we don't want to loop + through the whole range. */ +- if (last == ~0U) +- ML_(record_fd_close_range)(tid, first); ++ if (ARG2 >= VG_(fd_hard_limit)) ++ ML_(record_fd_close_range)(tid, ARG1); + else { +- for (fd = first; fd <= last; fd++) +- if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0) +- && fd != VG_(log_output_sink).fd +- && fd != VG_(xml_output_sink).fd) ++ for (fd = ARG1; fd <= last; fd++) ++ if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0)) + ML_(record_fd_close)(tid, fd); + } + } +diff --git a/memcheck/tests/close_range.stderr.exp.linux b/memcheck/tests/close_range.stderr.exp.linux +index 3a0de7837a8a..93c4bfa270dd 100644 +--- a/memcheck/tests/close_range.stderr.exp.linux ++++ b/memcheck/tests/close_range.stderr.exp.linux +@@ -1,12 +1,12 @@ + Syscall param close_range(first) contains uninitialised byte(s) + at 0x........: close_range (in /...libc...) +- by 0x........: main (close_range.c:89) ++ by 0x........: main (close_range.c:92) + + Syscall param close_range(last) contains uninitialised byte(s) + at 0x........: close_range (in /...libc...) +- by 0x........: main (close_range.c:89) ++ by 0x........: main (close_range.c:92) + + Syscall param close_range(flags) contains uninitialised byte(s) + at 0x........: close_range (in /...libc...) +- by 0x........: main (close_range.c:89) ++ by 0x........: main (close_range.c:92) + +-- +2.49.0 + diff --git a/0004-mount-syscall-param-filesystemtype-may-be-NULL.patch b/0004-mount-syscall-param-filesystemtype-may-be-NULL.patch new file mode 100644 index 0000000..ff1ca22 --- /dev/null +++ b/0004-mount-syscall-param-filesystemtype-may-be-NULL.patch @@ -0,0 +1,90 @@ +From 5c943affd2012a9f54a82ce98a6e7f6a5830c3d6 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Fri, 9 May 2025 00:21:25 +0200 +Subject: [PATCH 4/5] mount syscall param filesystemtype may be NULL + +On Linux the mount syscall, depending on flags provided, the source, +type and data my be ignored. We already don't check data and allow +source to be NULL. Normally when type is ignored an application will +provide an empty string "". But sometimes NULL is passed (like for +source). So we now also allow type to be NULL to prevent false +positives. + +Adjust the linux/scalar.c tests so the type param is still +unaddressable. + +https://bugs.kde.org/show_bug.cgi?id=503914 + +(cherry picked from commit ff6e14ab798af0628c54c6a704c1cb8844a79419) +--- + NEWS | 1 + + coregrind/m_syswrap/syswrap-linux.c | 6 ++++-- + memcheck/tests/arm64-linux/scalar.c | 2 +- + memcheck/tests/x86-linux/scalar.c | 2 +- + 4 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/NEWS b/NEWS +index 7cbe6344ac40..3f084a52be09 100644 +--- a/NEWS ++++ b/NEWS +@@ -6,6 +6,7 @@ Branch 3.25 + The following bugs have been fixed or resolved on this branch. + + 503641 close_range syscalls started failing with 3.25.0 ++503914 mount syscall param filesystemtype may be NULL + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c +index 6f3917830fa4..afd4a618b12f 100644 +--- a/coregrind/m_syswrap/syswrap-linux.c ++++ b/coregrind/m_syswrap/syswrap-linux.c +@@ -1000,7 +1000,8 @@ PRE(sys_mount) + { + // Nb: depending on 'flags', the 'type' and 'data' args may be ignored. + // We are conservative and check everything, except the memory pointed to +- // by 'data'. ++ // by 'data'. And since both 'source' and 'type' may be ignored, we allow ++ // them to be NULL. + *flags |= SfMayBlock; + PRINT("sys_mount( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x(%s), %#" + FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", +@@ -1012,7 +1013,8 @@ PRE(sys_mount) + if (ARG1) + PRE_MEM_RASCIIZ( "mount(source)", ARG1); + PRE_MEM_RASCIIZ( "mount(target)", ARG2); +- PRE_MEM_RASCIIZ( "mount(type)", ARG3); ++ if (ARG3) ++ PRE_MEM_RASCIIZ( "mount(type)", ARG3); + } + + PRE(sys_oldumount) +diff --git a/memcheck/tests/arm64-linux/scalar.c b/memcheck/tests/arm64-linux/scalar.c +index 622ea1c47cc9..49e0ca6a701f 100644 +--- a/memcheck/tests/arm64-linux/scalar.c ++++ b/memcheck/tests/arm64-linux/scalar.c +@@ -128,7 +128,7 @@ int main(void) + + // __NR_mount 21 + GO(__NR_mount, "5s 3m"); +- SY(__NR_mount, x0, x0, x0, x0, x0); FAIL; ++ SY(__NR_mount, x0, x0, x0-1, x0, x0); FAIL; + + // __NR_umount arm64 only has umount2 + //GO(__NR_umount, "1s 1m"); +diff --git a/memcheck/tests/x86-linux/scalar.c b/memcheck/tests/x86-linux/scalar.c +index 83ed38c4d994..fe36a47ef0f5 100644 +--- a/memcheck/tests/x86-linux/scalar.c ++++ b/memcheck/tests/x86-linux/scalar.c +@@ -137,7 +137,7 @@ int main(void) + + // __NR_mount 21 + GO(__NR_mount, "5s 3m"); +- SY(__NR_mount, x0, x0, x0, x0, x0); FAIL; ++ SY(__NR_mount, x0, x0, x0-1, x0, x0); FAIL; + + // __NR_umount 22 + GO(__NR_umount, "1s 1m"); +-- +2.49.0 + diff --git a/0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch b/0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch new file mode 100644 index 0000000..5636a6d --- /dev/null +++ b/0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch @@ -0,0 +1,50 @@ +From 9b967eacdfcfaf7a6dfa472dc462bc54653a2fb7 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Fri, 9 May 2025 13:46:44 +0200 +Subject: [PATCH 5/5] Add workaround for missing riscv_hwprobe syscall (258) + +On riscv newer glibc (2.41) will probe instruction support using the +riscv_hwprobe syscall. Since Valgrind currently doesn't have a wrapper +for riscv_hwprobe that causes a Warning. Since the RISC-V Hardware +Probing Interface is non-trivial and we don't really implement +extended riscv instructions anyway work around that by "implementing" +riscv_hwprobe as sys_ni_syscall so it generates an ENOSYS and glibc +will silently fall back to not using any extended instructions. + +https://docs.kernel.org/arch/riscv/hwprobe.html + +https://bugs.kde.org/show_bug.cgi?id=503253 + +(cherry picked from commit 5efdbbd321e6816ab2ae436d38c20bdcc72b4c17) +--- + coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + + include/vki/vki-scnums-riscv64-linux.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c +index e0146f2b0dad..ebf9c3105339 100644 +--- a/coregrind/m_syswrap/syswrap-riscv64-linux.c ++++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c +@@ -545,6 +545,7 @@ static SyscallTableEntry syscall_main_table[] = { + LINXY(__NR_perf_event_open, sys_perf_event_open), /* 241 */ + LINXY(__NR_accept4, sys_accept4), /* 242 */ + LINXY(__NR_recvmmsg, sys_recvmmsg), /* 243 */ ++ GENX_(__NR_riscv_hwprobe, sys_ni_syscall), /* 258 */ + PLAX_(__NR_riscv_flush_icache, sys_riscv_flush_icache), /* 259 */ + GENXY(__NR_wait4, sys_wait4), /* 260 */ + LINXY(__NR_prlimit64, sys_prlimit64), /* 261 */ +diff --git a/include/vki/vki-scnums-riscv64-linux.h b/include/vki/vki-scnums-riscv64-linux.h +index e4cc04a608b4..17b6839f8a84 100644 +--- a/include/vki/vki-scnums-riscv64-linux.h ++++ b/include/vki/vki-scnums-riscv64-linux.h +@@ -321,6 +321,7 @@ + #define __NR_mmap __NR3264_mmap + #define __NR_fadvise64 __NR3264_fadvise64 + ++#define __NR_riscv_hwprobe (__NR_arch_specific_syscall + 14) + #define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15) + + #endif /* __VKI_SCNUMS_RISCV64_LINUX_H */ +-- +2.49.0 + From 9fafb702106a59e166f55deff9b1f6d0393218e7 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 16 May 2025 15:23:46 +0200 Subject: [PATCH 13/30] 3.25.0-3 - Add 2 more VALGRIND_3_25_BRANCH patches --- ...nt-closed-inherited-file-descriptors.patch | 79 +++++++++++++++++++ ...-cat-in-none-tests-fdleak_cat.vgtest.patch | 24 ++++++ valgrind.spec | 9 ++- 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 0006-Don-t-count-closed-inherited-file-descriptors.patch create mode 100644 0007-regtest-use-bin-cat-in-none-tests-fdleak_cat.vgtest.patch diff --git a/0006-Don-t-count-closed-inherited-file-descriptors.patch b/0006-Don-t-count-closed-inherited-file-descriptors.patch new file mode 100644 index 0000000..8b62e9e --- /dev/null +++ b/0006-Don-t-count-closed-inherited-file-descriptors.patch @@ -0,0 +1,79 @@ +From 46c50747724c70c4200257361b55ebb615a2fb35 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 14 May 2025 00:13:06 +0200 +Subject: [PATCH 6/7] Don't count closed inherited file descriptors + +Programs which close some inherited file descriptors and are run under +valgrind with -q and --track-fds=yes would still show the FILE +DESCRIPTORS banner even if there were no non-inherited file +descriptors still open. + +Fix this by not counting already closed inherited file descriptors. + +Add a simple testcase to show /usr/bin/cat /dev/null doesn't produce +any output running under valgrind -q --track-fds=yes. + +https://bugs.kde.org/show_bug.cgi?id=504177 +(cherry picked from commit 29a5fcb3f6371584f89f9b54c793cc0f29802553) +--- + NEWS | 1 + + coregrind/m_syswrap/syswrap-generic.c | 2 +- + none/tests/Makefile.am | 1 + + none/tests/fdleak_cat.stderr.exp | 0 + none/tests/fdleak_cat.vgtest | 3 +++ + 5 files changed, 6 insertions(+), 1 deletion(-) + create mode 100644 none/tests/fdleak_cat.stderr.exp + create mode 100644 none/tests/fdleak_cat.vgtest + +diff --git a/NEWS b/NEWS +index 3f084a52be09..533b0081666e 100644 +--- a/NEWS ++++ b/NEWS +@@ -7,6 +7,7 @@ The following bugs have been fixed or resolved on this branch. + + 503641 close_range syscalls started failing with 3.25.0 + 503914 mount syscall param filesystemtype may be NULL ++504177 FILE DESCRIPTORS banner shows when closing some inherited fds + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c +index 82a682a5ce55..81c8fc028d88 100644 +--- a/coregrind/m_syswrap/syswrap-generic.c ++++ b/coregrind/m_syswrap/syswrap-generic.c +@@ -987,7 +987,7 @@ void VG_(show_open_fds) (const HChar* when) + int inherited = 0; + + for (i = allocated_fds; i; i = i->next) { +- if (i->where == NULL) ++ if (i->where == NULL && !i->fd_closed) + inherited++; + } + +diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am +index 043454828a99..bebc2f4dd195 100644 +--- a/none/tests/Makefile.am ++++ b/none/tests/Makefile.am +@@ -140,6 +140,7 @@ EXTRA_DIST = \ + execve.vgtest execve.stdout.exp execve.stderr.exp \ + faultstatus.vgtest faultstatus.stderr.exp faultstatus.stderr.exp-s390x \ + fcntl_setown.vgtest fcntl_setown.stdout.exp fcntl_setown.stderr.exp \ ++ fdleak_cat.vgtest fdleak_cat.stderr.exp \ + fdleak_cmsg.stderr.exp fdleak_cmsg.vgtest \ + fdleak_cmsg_xml.stderr.exp-ppc64le \ + fdleak_cmsg_xml.stderr.exp fdleak_cmsg_xml.vgtest \ +diff --git a/none/tests/fdleak_cat.stderr.exp b/none/tests/fdleak_cat.stderr.exp +new file mode 100644 +index 000000000000..e69de29bb2d1 +diff --git a/none/tests/fdleak_cat.vgtest b/none/tests/fdleak_cat.vgtest +new file mode 100644 +index 000000000000..11a618d855bc +--- /dev/null ++++ b/none/tests/fdleak_cat.vgtest +@@ -0,0 +1,3 @@ ++prog: /usr/bin/cat ++vgopts: -q --track-fds=yes ++args: /dev/null +-- +2.49.0 + diff --git a/0007-regtest-use-bin-cat-in-none-tests-fdleak_cat.vgtest.patch b/0007-regtest-use-bin-cat-in-none-tests-fdleak_cat.vgtest.patch new file mode 100644 index 0000000..0831ffd --- /dev/null +++ b/0007-regtest-use-bin-cat-in-none-tests-fdleak_cat.vgtest.patch @@ -0,0 +1,24 @@ +From 02de5973dcfe1c470838da733fdc058bb0c796e4 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Wed, 14 May 2025 07:47:43 +0200 +Subject: [PATCH 7/7] regtest: use /bin/cat in none/tests/fdleak_cat.vgtest + +There's no /usr/bin/cat on FreeBSD or Darwin. + +(cherry picked from commit 045adc91f364e97fcc522fdf6b8915fd3cfeb24b) +--- + none/tests/fdleak_cat.vgtest | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/none/tests/fdleak_cat.vgtest b/none/tests/fdleak_cat.vgtest +index 11a618d855bc..2cf78a0d0f3c 100644 +--- a/none/tests/fdleak_cat.vgtest ++++ b/none/tests/fdleak_cat.vgtest +@@ -1,3 +1,3 @@ +-prog: /usr/bin/cat ++prog: /bin/cat + vgopts: -q --track-fds=yes + args: /dev/null +-- +2.49.0 + diff --git a/valgrind.spec b/valgrind.spec index 6725a26..c6a7c4d 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.25.0 -Release: 2%{?dist} +Release: 3%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -91,6 +91,8 @@ Patch6: 0002-FreeBSD-close_range-syscall.patch Patch7: 0003-Bug-503641-close_range-syscalls-started-failing-with.patch Patch8: 0004-mount-syscall-param-filesystemtype-may-be-NULL.patch Patch9: 0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch +Patch10: 0006-Don-t-count-closed-inherited-file-descriptors.patch +Patch11: 0007-regtest-use-bin-cat-in-none-tests-fdleak_cat.vgtest.patch BuildRequires: make BuildRequires: glibc-devel @@ -276,6 +278,8 @@ Valgrind User Manual for details. %patch -P7 -p1 %patch -P8 -p1 %patch -P9 -p1 +%patch -P10 -p1 +%patch -P11 -p1 %build # LTO triggers undefined symbols in valgrind. But valgrind has a @@ -515,6 +519,9 @@ echo ===============END TESTING=============== %endif %changelog +* Fri May 16 2025 Mark Wielaard - 3.25.0-3 +- Add 2 more VALGRIND_3_25_BRANCH patches + * Fri May 9 2025 Mark Wielaard - 3.25.0-2 - Add VALGRIND_3_25_BRANCH patches From 247872ecdc236f9e88cd44e040412a3fb6456505 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 20 May 2025 13:27:24 +0200 Subject: [PATCH 14/30] Valgrind 3.25.1 final --- .gitignore | 1 + 0001-Prepare-NEWS-for-branch-3.25-fixes.patch | 32 ---- 0002-FreeBSD-close_range-syscall.patch | 160 ------------------ ..._range-syscalls-started-failing-with.patch | 144 ---------------- ...all-param-filesystemtype-may-be-NULL.patch | 90 ---------- ...or-missing-riscv_hwprobe-syscall-258.patch | 50 ------ ...nt-closed-inherited-file-descriptors.patch | 79 --------- ...-cat-in-none-tests-fdleak_cat.vgtest.patch | 24 --- sources | 2 +- valgrind.spec | 24 +-- 10 files changed, 7 insertions(+), 599 deletions(-) delete mode 100644 0001-Prepare-NEWS-for-branch-3.25-fixes.patch delete mode 100644 0002-FreeBSD-close_range-syscall.patch delete mode 100644 0003-Bug-503641-close_range-syscalls-started-failing-with.patch delete mode 100644 0004-mount-syscall-param-filesystemtype-may-be-NULL.patch delete mode 100644 0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch delete mode 100644 0006-Don-t-count-closed-inherited-file-descriptors.patch delete mode 100644 0007-regtest-use-bin-cat-in-none-tests-fdleak_cat.vgtest.patch diff --git a/.gitignore b/.gitignore index 83af548..d89612b 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,4 @@ /valgrind-3.25.0.RC1.tar.bz2 /valgrind-3.25.0.RC2.tar.bz2 /valgrind-3.25.0.tar.bz2 +/valgrind-3.25.1.tar.bz2 diff --git a/0001-Prepare-NEWS-for-branch-3.25-fixes.patch b/0001-Prepare-NEWS-for-branch-3.25-fixes.patch deleted file mode 100644 index 527cebb..0000000 --- a/0001-Prepare-NEWS-for-branch-3.25-fixes.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 1b9e202f13daffe3b4aa0c0e4a5e8e644055145e Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Fri, 9 May 2025 16:43:06 +0200 -Subject: [PATCH 1/5] Prepare NEWS for branch 3.25 fixes - ---- - NEWS | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/NEWS b/NEWS -index cd4670aca684..08fc1117d6a7 100644 ---- a/NEWS -+++ b/NEWS -@@ -1,3 +1,15 @@ -+Branch 3.25 -+~~~~~~~~~~~ -+ -+* ==================== FIXED BUGS ==================== -+ -+The following bugs have been fixed or resolved on this branch. -+ -+To see details of a given bug, visit -+ https://bugs.kde.org/show_bug.cgi?id=XXXXXX -+where XXXXXX is the bug number as listed above. -+ -+ - Release 3.25.0 (25 Apr 2025) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - --- -2.49.0 - diff --git a/0002-FreeBSD-close_range-syscall.patch b/0002-FreeBSD-close_range-syscall.patch deleted file mode 100644 index 327e3d2..0000000 --- a/0002-FreeBSD-close_range-syscall.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 34eb704121e61257ea9f1937ce4e56863d60d793 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Fri, 2 May 2025 16:59:58 +0200 -Subject: [PATCH 2/5] FreeBSD close_range syscall - -Simplify the checking. No ned to test for reserved fds, -and just split the close_range if debug output is enabled. - -Add a call to close_range with an upper bound of ~0U in the -testcase. - -These changes will probably be the basis for fixing -https://bugs.kde.org/show_bug.cgi?id=503641 - -(cherry picked from commit 8edc2fa6f8d70dbe10d634adff2513aa68143a22) ---- - coregrind/m_syswrap/syswrap-freebsd.c | 62 +++++++++++++-------------- - memcheck/tests/close_range.c | 5 ++- - memcheck/tests/close_range.stderr.exp | 6 +-- - 3 files changed, 38 insertions(+), 35 deletions(-) - -diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c -index 7ea04fdbc6be..41cd0756196b 100644 ---- a/coregrind/m_syswrap/syswrap-freebsd.c -+++ b/coregrind/m_syswrap/syswrap-freebsd.c -@@ -6615,10 +6615,8 @@ POST(sys___realpathat) - // int close_range(u_int lowfd, u_int highfd, int flags); - PRE(sys_close_range) - { -- SysRes res = VG_(mk_SysRes_Success)(0); -- unsigned int lowfd = ARG1; -- unsigned int fd_counter; // will count from lowfd to highfd -- unsigned int highfd = ARG2; -+ UInt lowfd = ARG1; -+ UInt highfd = ARG2; - - /* on linux the may lock if futexes are used - * there is a lock in the kernel but I assume it's just -@@ -6642,46 +6640,48 @@ PRE(sys_close_range) - return; - } - -- fd_counter = lowfd; -- do { -- if (fd_counter > highfd -- || (fd_counter == 2U/*stderr*/ && VG_(debugLog_getLevel)() > 0) -- || fd_counter == VG_(log_output_sink).fd -- || fd_counter == VG_(xml_output_sink).fd) { -- /* Split the range if it contains a file descriptor we're not -- * supposed to close. */ -- if (fd_counter - 1 >= lowfd) { -- res = VG_(do_syscall3)(__NR_close_range, (UWord)lowfd, (UWord)fd_counter - 1, ARG3 ); -- } -- lowfd = fd_counter + 1; -- } -- } while (fd_counter++ <= highfd); -+ vg_assert(VG_(log_output_sink).fd == -1 || -+ VG_(log_output_sink).fd >= VG_(fd_hard_limit)); -+ vg_assert(VG_(xml_output_sink).fd == -1 || -+ VG_(xml_output_sink).fd >= VG_(fd_hard_limit)); - -- /* If it failed along the way, it's presumably the flags being wrong. */ -- SET_STATUS_from_SysRes (res); -+ if (VG_(debugLog_getLevel)() > 0 && -+ lowfd <= 2U && -+ highfd >= 2U && -+ lowfd != highfd) { -+ SysRes res = VG_(mk_SysRes_Success)(0); -+ if (lowfd <= 1U) { -+ res = VG_(do_syscall3)(__NR_close_range, lowfd, 1U, ARG3); -+ } -+ if (!sr_isError(res) && highfd >= 3U) { -+ res = VG_(do_syscall3)(__NR_close_range, 3U, highfd, ARG3); -+ } -+ /* If it failed along the way, it's presumably the flags being wrong. */ -+ SET_STATUS_from_SysRes (res); -+ } else { -+ SET_STATUS_from_SysRes(VG_(do_syscall3)(__NR_close_range, lowfd, highfd, ARG3)); -+ } - } - - POST(sys_close_range) - { -- unsigned int fd; -- unsigned int last = ARG2; -+ UInt fd; -+ UInt highfd = ARG2; - - if (!VG_(clo_track_fds) - || (ARG3 & VKI_CLOSE_RANGE_CLOEXEC) != 0) - return; - -- if (last >= VG_(fd_hard_limit)) -- last = VG_(fd_hard_limit) - 1; -+ if (highfd >= VG_(fd_hard_limit)) -+ highfd = VG_(fd_hard_limit) - 1; - - /* If the close_range range is too wide, we don't want to loop - through the whole range. */ -- if (ARG2 == ~0U) -- ML_(record_fd_close_range)(tid, ARG1); -- else { -- for (fd = ARG1; fd <= last; fd++) -- if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0) -- && fd != VG_(log_output_sink).fd -- && fd != VG_(xml_output_sink).fd) -+ if (ARG2 >= VG_(fd_hard_limit)) { -+ ML_(record_fd_close_range)(tid, ARG1); -+ } else { -+ for (fd = ARG1; fd <= highfd; fd++) -+ if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0)) - ML_(record_fd_close)(tid, fd); - } - } -diff --git a/memcheck/tests/close_range.c b/memcheck/tests/close_range.c -index 6d8b5a0ba842..5c21e7f42b6a 100644 ---- a/memcheck/tests/close_range.c -+++ b/memcheck/tests/close_range.c -@@ -65,7 +65,7 @@ int main(void) - - errno = 0; - // wrong order -- close_range(fd3, fd1, 2); -+ close_range(fd3, fd1, 0); - assert(errno = EINVAL); - - errno = 0; -@@ -82,6 +82,9 @@ int main(void) - - close_range(3, rl.rlim_cur+1, 0); - -+ int res = close_range(2U, ~0U, 0); -+ assert(res == 0); -+ - { - unsigned a; - unsigned b; -diff --git a/memcheck/tests/close_range.stderr.exp b/memcheck/tests/close_range.stderr.exp -index 2f4d018f22e1..51dfcd40a5f7 100644 ---- a/memcheck/tests/close_range.stderr.exp -+++ b/memcheck/tests/close_range.stderr.exp -@@ -1,12 +1,12 @@ - Syscall param close_range(lowfd) contains uninitialised byte(s) - at 0x........: close_range (in /...libc...) -- by 0x........: main (close_range.c:89) -+ by 0x........: main (close_range.c:92) - - Syscall param close_range(highfd) contains uninitialised byte(s) - at 0x........: close_range (in /...libc...) -- by 0x........: main (close_range.c:89) -+ by 0x........: main (close_range.c:92) - - Syscall param close_range(flags) contains uninitialised byte(s) - at 0x........: close_range (in /...libc...) -- by 0x........: main (close_range.c:89) -+ by 0x........: main (close_range.c:92) - --- -2.49.0 - diff --git a/0003-Bug-503641-close_range-syscalls-started-failing-with.patch b/0003-Bug-503641-close_range-syscalls-started-failing-with.patch deleted file mode 100644 index f81def4..0000000 --- a/0003-Bug-503641-close_range-syscalls-started-failing-with.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 4e240e47f7a7560cf9383b6f9483bffd3a5ec289 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Fri, 2 May 2025 18:53:09 +0200 -Subject: [PATCH 3/5] Bug 503641 - close_range syscalls started failing with - 3.25.0 - -(cherry picked from commit 933e542b431f17681cc915de656e853dc16d4fe7) ---- - NEWS | 2 + - coregrind/m_syswrap/syswrap-linux.c | 58 ++++++++++----------- - memcheck/tests/close_range.stderr.exp.linux | 6 +-- - 3 files changed, 34 insertions(+), 32 deletions(-) - -diff --git a/NEWS b/NEWS -index 08fc1117d6a7..7cbe6344ac40 100644 ---- a/NEWS -+++ b/NEWS -@@ -5,6 +5,8 @@ Branch 3.25 - - The following bugs have been fixed or resolved on this branch. - -+503641 close_range syscalls started failing with 3.25.0 -+ - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX - where XXXXXX is the bug number as listed above. -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index de710c97e435..6f3917830fa4 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -13699,17 +13699,20 @@ PRE(sys_execveat) - - PRE(sys_close_range) - { -- SysRes res = VG_(mk_SysRes_Success)(0); -- Int beg, end; -- Int first = ARG1; -- Int last = ARG2; -+ UInt first = ARG1; -+ UInt last = ARG2; -+ -+ vg_assert(VG_(log_output_sink).fd == -1 || -+ VG_(log_output_sink).fd >= VG_(fd_hard_limit)); -+ vg_assert(VG_(xml_output_sink).fd == -1 || -+ VG_(xml_output_sink).fd >= VG_(fd_hard_limit)); - - FUSE_COMPATIBLE_MAY_BLOCK(); - PRINT("sys_close_range ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" - FMT_REGWORD "u )", ARG1, ARG2, ARG3); - PRE_REG_READ3(long, "close_range", - unsigned int, first, unsigned int, last, -- unsigned int, flags); -+ int, flags); - - if (first > last) { - SET_STATUS_Failure( VKI_EINVAL ); -@@ -13724,29 +13727,28 @@ PRE(sys_close_range) - return; - } - -- beg = end = first; -- do { -- if (end > last -- || (end == 2/*stderr*/ && VG_(debugLog_getLevel)() > 0) -- || end == VG_(log_output_sink).fd -- || end == VG_(xml_output_sink).fd) { -- /* Split the range if it contains a file descriptor we're not -- * supposed to close. */ -- if (end - 1 >= beg) -- res = VG_(do_syscall3)(__NR_close_range, (UWord)beg, (UWord)end - 1, ARG3 ); -- beg = end + 1; -+ if (VG_(debugLog_getLevel)() > 0 && -+ first <= 2U && -+ last >= 2U && -+ first != last) { -+ SysRes res = VG_(mk_SysRes_Success)(0); -+ if (first <= 1U) { -+ res = VG_(do_syscall3)(__NR_close_range, first, 1U, ARG3); - } -- } while (end++ <= last); -- -- /* If it failed along the way, it's presumably the flags being wrong. */ -- SET_STATUS_from_SysRes (res); -+ if (!sr_isError(res) && last >= 3U) { -+ res = VG_(do_syscall3)(__NR_close_range, 3U, last, ARG3); -+ } -+ /* If it failed along the way, it's presumably the flags being wrong. */ -+ SET_STATUS_from_SysRes (res); -+ } else { -+ SET_STATUS_from_SysRes(VG_(do_syscall3)(__NR_close_range, first, last, ARG3)); -+ } - } - - POST(sys_close_range) - { -- Int fd; -- Int first = ARG1; -- Int last = ARG2; -+ UInt fd; -+ UInt last = ARG2; - - if (!VG_(clo_track_fds) - || (ARG3 & VKI_CLOSE_RANGE_CLOEXEC) != 0) -@@ -13757,13 +13759,11 @@ POST(sys_close_range) - - /* If the close_range range is too wide, we don't want to loop - through the whole range. */ -- if (last == ~0U) -- ML_(record_fd_close_range)(tid, first); -+ if (ARG2 >= VG_(fd_hard_limit)) -+ ML_(record_fd_close_range)(tid, ARG1); - else { -- for (fd = first; fd <= last; fd++) -- if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0) -- && fd != VG_(log_output_sink).fd -- && fd != VG_(xml_output_sink).fd) -+ for (fd = ARG1; fd <= last; fd++) -+ if ((fd != 2/*stderr*/ || VG_(debugLog_getLevel)() == 0)) - ML_(record_fd_close)(tid, fd); - } - } -diff --git a/memcheck/tests/close_range.stderr.exp.linux b/memcheck/tests/close_range.stderr.exp.linux -index 3a0de7837a8a..93c4bfa270dd 100644 ---- a/memcheck/tests/close_range.stderr.exp.linux -+++ b/memcheck/tests/close_range.stderr.exp.linux -@@ -1,12 +1,12 @@ - Syscall param close_range(first) contains uninitialised byte(s) - at 0x........: close_range (in /...libc...) -- by 0x........: main (close_range.c:89) -+ by 0x........: main (close_range.c:92) - - Syscall param close_range(last) contains uninitialised byte(s) - at 0x........: close_range (in /...libc...) -- by 0x........: main (close_range.c:89) -+ by 0x........: main (close_range.c:92) - - Syscall param close_range(flags) contains uninitialised byte(s) - at 0x........: close_range (in /...libc...) -- by 0x........: main (close_range.c:89) -+ by 0x........: main (close_range.c:92) - --- -2.49.0 - diff --git a/0004-mount-syscall-param-filesystemtype-may-be-NULL.patch b/0004-mount-syscall-param-filesystemtype-may-be-NULL.patch deleted file mode 100644 index ff1ca22..0000000 --- a/0004-mount-syscall-param-filesystemtype-may-be-NULL.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 5c943affd2012a9f54a82ce98a6e7f6a5830c3d6 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Fri, 9 May 2025 00:21:25 +0200 -Subject: [PATCH 4/5] mount syscall param filesystemtype may be NULL - -On Linux the mount syscall, depending on flags provided, the source, -type and data my be ignored. We already don't check data and allow -source to be NULL. Normally when type is ignored an application will -provide an empty string "". But sometimes NULL is passed (like for -source). So we now also allow type to be NULL to prevent false -positives. - -Adjust the linux/scalar.c tests so the type param is still -unaddressable. - -https://bugs.kde.org/show_bug.cgi?id=503914 - -(cherry picked from commit ff6e14ab798af0628c54c6a704c1cb8844a79419) ---- - NEWS | 1 + - coregrind/m_syswrap/syswrap-linux.c | 6 ++++-- - memcheck/tests/arm64-linux/scalar.c | 2 +- - memcheck/tests/x86-linux/scalar.c | 2 +- - 4 files changed, 7 insertions(+), 4 deletions(-) - -diff --git a/NEWS b/NEWS -index 7cbe6344ac40..3f084a52be09 100644 ---- a/NEWS -+++ b/NEWS -@@ -6,6 +6,7 @@ Branch 3.25 - The following bugs have been fixed or resolved on this branch. - - 503641 close_range syscalls started failing with 3.25.0 -+503914 mount syscall param filesystemtype may be NULL - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index 6f3917830fa4..afd4a618b12f 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -1000,7 +1000,8 @@ PRE(sys_mount) - { - // Nb: depending on 'flags', the 'type' and 'data' args may be ignored. - // We are conservative and check everything, except the memory pointed to -- // by 'data'. -+ // by 'data'. And since both 'source' and 'type' may be ignored, we allow -+ // them to be NULL. - *flags |= SfMayBlock; - PRINT("sys_mount( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x(%s), %#" - FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", -@@ -1012,7 +1013,8 @@ PRE(sys_mount) - if (ARG1) - PRE_MEM_RASCIIZ( "mount(source)", ARG1); - PRE_MEM_RASCIIZ( "mount(target)", ARG2); -- PRE_MEM_RASCIIZ( "mount(type)", ARG3); -+ if (ARG3) -+ PRE_MEM_RASCIIZ( "mount(type)", ARG3); - } - - PRE(sys_oldumount) -diff --git a/memcheck/tests/arm64-linux/scalar.c b/memcheck/tests/arm64-linux/scalar.c -index 622ea1c47cc9..49e0ca6a701f 100644 ---- a/memcheck/tests/arm64-linux/scalar.c -+++ b/memcheck/tests/arm64-linux/scalar.c -@@ -128,7 +128,7 @@ int main(void) - - // __NR_mount 21 - GO(__NR_mount, "5s 3m"); -- SY(__NR_mount, x0, x0, x0, x0, x0); FAIL; -+ SY(__NR_mount, x0, x0, x0-1, x0, x0); FAIL; - - // __NR_umount arm64 only has umount2 - //GO(__NR_umount, "1s 1m"); -diff --git a/memcheck/tests/x86-linux/scalar.c b/memcheck/tests/x86-linux/scalar.c -index 83ed38c4d994..fe36a47ef0f5 100644 ---- a/memcheck/tests/x86-linux/scalar.c -+++ b/memcheck/tests/x86-linux/scalar.c -@@ -137,7 +137,7 @@ int main(void) - - // __NR_mount 21 - GO(__NR_mount, "5s 3m"); -- SY(__NR_mount, x0, x0, x0, x0, x0); FAIL; -+ SY(__NR_mount, x0, x0, x0-1, x0, x0); FAIL; - - // __NR_umount 22 - GO(__NR_umount, "1s 1m"); --- -2.49.0 - diff --git a/0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch b/0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch deleted file mode 100644 index 5636a6d..0000000 --- a/0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 9b967eacdfcfaf7a6dfa472dc462bc54653a2fb7 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Fri, 9 May 2025 13:46:44 +0200 -Subject: [PATCH 5/5] Add workaround for missing riscv_hwprobe syscall (258) - -On riscv newer glibc (2.41) will probe instruction support using the -riscv_hwprobe syscall. Since Valgrind currently doesn't have a wrapper -for riscv_hwprobe that causes a Warning. Since the RISC-V Hardware -Probing Interface is non-trivial and we don't really implement -extended riscv instructions anyway work around that by "implementing" -riscv_hwprobe as sys_ni_syscall so it generates an ENOSYS and glibc -will silently fall back to not using any extended instructions. - -https://docs.kernel.org/arch/riscv/hwprobe.html - -https://bugs.kde.org/show_bug.cgi?id=503253 - -(cherry picked from commit 5efdbbd321e6816ab2ae436d38c20bdcc72b4c17) ---- - coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + - include/vki/vki-scnums-riscv64-linux.h | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c -index e0146f2b0dad..ebf9c3105339 100644 ---- a/coregrind/m_syswrap/syswrap-riscv64-linux.c -+++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c -@@ -545,6 +545,7 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY(__NR_perf_event_open, sys_perf_event_open), /* 241 */ - LINXY(__NR_accept4, sys_accept4), /* 242 */ - LINXY(__NR_recvmmsg, sys_recvmmsg), /* 243 */ -+ GENX_(__NR_riscv_hwprobe, sys_ni_syscall), /* 258 */ - PLAX_(__NR_riscv_flush_icache, sys_riscv_flush_icache), /* 259 */ - GENXY(__NR_wait4, sys_wait4), /* 260 */ - LINXY(__NR_prlimit64, sys_prlimit64), /* 261 */ -diff --git a/include/vki/vki-scnums-riscv64-linux.h b/include/vki/vki-scnums-riscv64-linux.h -index e4cc04a608b4..17b6839f8a84 100644 ---- a/include/vki/vki-scnums-riscv64-linux.h -+++ b/include/vki/vki-scnums-riscv64-linux.h -@@ -321,6 +321,7 @@ - #define __NR_mmap __NR3264_mmap - #define __NR_fadvise64 __NR3264_fadvise64 - -+#define __NR_riscv_hwprobe (__NR_arch_specific_syscall + 14) - #define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15) - - #endif /* __VKI_SCNUMS_RISCV64_LINUX_H */ --- -2.49.0 - diff --git a/0006-Don-t-count-closed-inherited-file-descriptors.patch b/0006-Don-t-count-closed-inherited-file-descriptors.patch deleted file mode 100644 index 8b62e9e..0000000 --- a/0006-Don-t-count-closed-inherited-file-descriptors.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 46c50747724c70c4200257361b55ebb615a2fb35 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Wed, 14 May 2025 00:13:06 +0200 -Subject: [PATCH 6/7] Don't count closed inherited file descriptors - -Programs which close some inherited file descriptors and are run under -valgrind with -q and --track-fds=yes would still show the FILE -DESCRIPTORS banner even if there were no non-inherited file -descriptors still open. - -Fix this by not counting already closed inherited file descriptors. - -Add a simple testcase to show /usr/bin/cat /dev/null doesn't produce -any output running under valgrind -q --track-fds=yes. - -https://bugs.kde.org/show_bug.cgi?id=504177 -(cherry picked from commit 29a5fcb3f6371584f89f9b54c793cc0f29802553) ---- - NEWS | 1 + - coregrind/m_syswrap/syswrap-generic.c | 2 +- - none/tests/Makefile.am | 1 + - none/tests/fdleak_cat.stderr.exp | 0 - none/tests/fdleak_cat.vgtest | 3 +++ - 5 files changed, 6 insertions(+), 1 deletion(-) - create mode 100644 none/tests/fdleak_cat.stderr.exp - create mode 100644 none/tests/fdleak_cat.vgtest - -diff --git a/NEWS b/NEWS -index 3f084a52be09..533b0081666e 100644 ---- a/NEWS -+++ b/NEWS -@@ -7,6 +7,7 @@ The following bugs have been fixed or resolved on this branch. - - 503641 close_range syscalls started failing with 3.25.0 - 503914 mount syscall param filesystemtype may be NULL -+504177 FILE DESCRIPTORS banner shows when closing some inherited fds - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c -index 82a682a5ce55..81c8fc028d88 100644 ---- a/coregrind/m_syswrap/syswrap-generic.c -+++ b/coregrind/m_syswrap/syswrap-generic.c -@@ -987,7 +987,7 @@ void VG_(show_open_fds) (const HChar* when) - int inherited = 0; - - for (i = allocated_fds; i; i = i->next) { -- if (i->where == NULL) -+ if (i->where == NULL && !i->fd_closed) - inherited++; - } - -diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am -index 043454828a99..bebc2f4dd195 100644 ---- a/none/tests/Makefile.am -+++ b/none/tests/Makefile.am -@@ -140,6 +140,7 @@ EXTRA_DIST = \ - execve.vgtest execve.stdout.exp execve.stderr.exp \ - faultstatus.vgtest faultstatus.stderr.exp faultstatus.stderr.exp-s390x \ - fcntl_setown.vgtest fcntl_setown.stdout.exp fcntl_setown.stderr.exp \ -+ fdleak_cat.vgtest fdleak_cat.stderr.exp \ - fdleak_cmsg.stderr.exp fdleak_cmsg.vgtest \ - fdleak_cmsg_xml.stderr.exp-ppc64le \ - fdleak_cmsg_xml.stderr.exp fdleak_cmsg_xml.vgtest \ -diff --git a/none/tests/fdleak_cat.stderr.exp b/none/tests/fdleak_cat.stderr.exp -new file mode 100644 -index 000000000000..e69de29bb2d1 -diff --git a/none/tests/fdleak_cat.vgtest b/none/tests/fdleak_cat.vgtest -new file mode 100644 -index 000000000000..11a618d855bc ---- /dev/null -+++ b/none/tests/fdleak_cat.vgtest -@@ -0,0 +1,3 @@ -+prog: /usr/bin/cat -+vgopts: -q --track-fds=yes -+args: /dev/null --- -2.49.0 - diff --git a/0007-regtest-use-bin-cat-in-none-tests-fdleak_cat.vgtest.patch b/0007-regtest-use-bin-cat-in-none-tests-fdleak_cat.vgtest.patch deleted file mode 100644 index 0831ffd..0000000 --- a/0007-regtest-use-bin-cat-in-none-tests-fdleak_cat.vgtest.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 02de5973dcfe1c470838da733fdc058bb0c796e4 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Wed, 14 May 2025 07:47:43 +0200 -Subject: [PATCH 7/7] regtest: use /bin/cat in none/tests/fdleak_cat.vgtest - -There's no /usr/bin/cat on FreeBSD or Darwin. - -(cherry picked from commit 045adc91f364e97fcc522fdf6b8915fd3cfeb24b) ---- - none/tests/fdleak_cat.vgtest | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/none/tests/fdleak_cat.vgtest b/none/tests/fdleak_cat.vgtest -index 11a618d855bc..2cf78a0d0f3c 100644 ---- a/none/tests/fdleak_cat.vgtest -+++ b/none/tests/fdleak_cat.vgtest -@@ -1,3 +1,3 @@ --prog: /usr/bin/cat -+prog: /bin/cat - vgopts: -q --track-fds=yes - args: /dev/null --- -2.49.0 - diff --git a/sources b/sources index 7102d08..074653a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.25.0.tar.bz2) = 1fc649ae346d5106b69fe2cf8b494fa441d63f576b16e62d90e547f760851e427a173b6d03c4076a8ae13df66717f66631f4dc6769ede15f5521bd95099a649d +SHA512 (valgrind-3.25.1.tar.bz2) = 6a474d58730274c57d6ca012ffd3226d393d6507cd57bf46c3b26c87a0cba84e3c8cfc84c8c76e50041861e98baba7b9613490faef4212d082845581d08af351 diff --git a/valgrind.spec b/valgrind.spec index c6a7c4d..114f220 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.25.0 -Release: 3%{?dist} +Version: 3.25.1 +Release: 1%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -85,15 +85,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 -# VALGRIND_3_25_BRANCH patches -Patch5: 0001-Prepare-NEWS-for-branch-3.25-fixes.patch -Patch6: 0002-FreeBSD-close_range-syscall.patch -Patch7: 0003-Bug-503641-close_range-syscalls-started-failing-with.patch -Patch8: 0004-mount-syscall-param-filesystemtype-may-be-NULL.patch -Patch9: 0005-Add-workaround-for-missing-riscv_hwprobe-syscall-258.patch -Patch10: 0006-Don-t-count-closed-inherited-file-descriptors.patch -Patch11: 0007-regtest-use-bin-cat-in-none-tests-fdleak_cat.vgtest.patch - BuildRequires: make BuildRequires: glibc-devel @@ -273,14 +264,6 @@ Valgrind User Manual for details. %patch -P3 -p1 %patch -P4 -p1 -%patch -P5 -p1 -%patch -P6 -p1 -%patch -P7 -p1 -%patch -P8 -p1 -%patch -P9 -p1 -%patch -P10 -p1 -%patch -P11 -p1 - %build # LTO triggers undefined symbols in valgrind. But valgrind has a # --enable-lto configure time option that we will use instead. @@ -519,6 +502,9 @@ echo ===============END TESTING=============== %endif %changelog +* Tue May 20 2025 Mark Wielaard - 3.25.1-1 +- Valgrind 3.25.1 final + * Fri May 16 2025 Mark Wielaard - 3.25.0-3 - Add 2 more VALGRIND_3_25_BRANCH patches From 7246749fd706d2a4d2098e1800132e4a8fc33a17 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 25 Jul 2025 19:57:25 +0000 Subject: [PATCH 15/30] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- valgrind.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/valgrind.spec b/valgrind.spec index 114f220..03401b9 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.25.1 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -502,6 +502,9 @@ echo ===============END TESTING=============== %endif %changelog +* Fri Jul 25 2025 Fedora Release Engineering - 1:3.25.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Tue May 20 2025 Mark Wielaard - 3.25.1-1 - Valgrind 3.25.1 final From 6adf1117a347e83cebe7d41bee80caae560eca1b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 6 Aug 2025 00:08:54 +0200 Subject: [PATCH 16/30] 3.25.1-3 - Add VALGRIND_3_25_BRANCH patches - 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch - 0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch --- ...Prepare-NEWS-for-branch-3.25.x-fixes.patch | 32 ++ ...-Support-z17-changes-to-the-NNPA-ins.patch | 539 ++++++++++++++++++ valgrind.spec | 14 +- 3 files changed, 584 insertions(+), 1 deletion(-) create mode 100644 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch create mode 100644 0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch diff --git a/0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch b/0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch new file mode 100644 index 0000000..cca72ed --- /dev/null +++ b/0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch @@ -0,0 +1,32 @@ +From 2e92839f77ad5b1e2db95887185eca3b4e70a4d5 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 5 Aug 2025 22:05:30 +0200 +Subject: [PATCH 1/2] Prepare NEWS for branch 3.25.x fixes + +--- + NEWS | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/NEWS b/NEWS +index 741329a68170..5043e7008bf0 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,3 +1,15 @@ ++Branch 3.25.x ++~~~~~~~~~~~~~ ++ ++* ==================== FIXED BUGS ==================== ++ ++The following bugs have been fixed or resolved on this branch. ++ ++To see details of a given bug, visit ++ https://bugs.kde.org/show_bug.cgi?id=XXXXXX ++where XXXXXX is the bug number as listed above. ++ ++ + Release 3.25.1 (20 May 2025) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +-- +2.50.1 + diff --git a/0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch b/0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch new file mode 100644 index 0000000..67cf2e5 --- /dev/null +++ b/0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch @@ -0,0 +1,539 @@ +From 2ad8efa8f31c7e8733e430dad4f93541797d6792 Mon Sep 17 00:00:00 2001 +From: Andreas Arnez +Date: Wed, 25 Jun 2025 16:35:04 +0200 +Subject: [PATCH 2/2] Bug 503241 - s390x: Support z17 changes to the NNPA + instruction + +This adds support for the NNPA enhancements that are implemented with z17. + +(cherry picked from commit 24b634e8ce04de70d4aa6c61a12149df223f9c68) +--- + NEWS | 2 + + coregrind/m_extension/extension-s390x.c | 346 ++++++++++++++---------- + 2 files changed, 209 insertions(+), 139 deletions(-) + +diff --git a/NEWS b/NEWS +index 5043e7008bf0..4e6e6c6d2387 100644 +--- a/NEWS ++++ b/NEWS +@@ -5,6 +5,8 @@ Branch 3.25.x + + The following bugs have been fixed or resolved on this branch. + ++503241 s390x: Support z17 changes to the NNPA instruction ++ + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX + where XXXXXX is the bug number as listed above. +diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c +index 85b99ad08687..98b825d9b5d2 100644 +--- a/coregrind/m_extension/extension-s390x.c ++++ b/coregrind/m_extension/extension-s390x.c +@@ -301,11 +301,17 @@ typedef enum { + S390_NNPA_MAX = 0x15, + S390_NNPA_LOG = 0x20, + S390_NNPA_EXP = 0x21, ++ S390_NNPA_SQRT = 0x22, ++ S390_NNPA_INVSQRT = 0x23, + S390_NNPA_RELU = 0x31, + S390_NNPA_TANH = 0x32, + S390_NNPA_SIGMOID = 0x33, + S390_NNPA_SOFTMAX = 0x34, ++ S390_NNPA_GELU = 0x35, + S390_NNPA_BATCHNORM = 0x40, ++ S390_NNPA_MOMENTS = 0x41, ++ S390_NNPA_LAYERNORM = 0x42, ++ S390_NNPA_NORM = 0x43, + S390_NNPA_MAXPOOL2D = 0x50, + S390_NNPA_AVGPOOL2D = 0x51, + S390_NNPA_LSTMACT = 0x60, +@@ -313,6 +319,9 @@ typedef enum { + S390_NNPA_CONVOLUTION = 0x70, + S390_NNPA_MATMUL_OP = 0x71, + S390_NNPA_MATMUL_OP_BCAST23 = 0x72, ++ S390_NNPA_MATMUL_OP_BCAST1 = 0x73, ++ S390_NNPA_TRANSFORM = 0xf0, ++ S390_NNPA_REDUCE = 0xf1, + } s390_nnpa_function_t; + + /* Suported NNPA functions */ +@@ -321,30 +330,51 @@ static const ULong NNPA_functions[] = { + S390_SETBIT(S390_NNPA_SUB) | S390_SETBIT(S390_NNPA_MUL) | + S390_SETBIT(S390_NNPA_DIV) | S390_SETBIT(S390_NNPA_MIN) | + S390_SETBIT(S390_NNPA_MAX) | S390_SETBIT(S390_NNPA_LOG) | +- S390_SETBIT(S390_NNPA_EXP) | S390_SETBIT(S390_NNPA_RELU) | ++ S390_SETBIT(S390_NNPA_EXP) | S390_SETBIT(S390_NNPA_SQRT) | ++ S390_SETBIT(S390_NNPA_INVSQRT) | S390_SETBIT(S390_NNPA_RELU) | + S390_SETBIT(S390_NNPA_TANH) | S390_SETBIT(S390_NNPA_SIGMOID) | +- S390_SETBIT(S390_NNPA_SOFTMAX)), +- (S390_SETBIT(S390_NNPA_BATCHNORM) | S390_SETBIT(S390_NNPA_MAXPOOL2D) | +- S390_SETBIT(S390_NNPA_AVGPOOL2D) | S390_SETBIT(S390_NNPA_LSTMACT) | +- S390_SETBIT(S390_NNPA_GRUACT) | S390_SETBIT(S390_NNPA_CONVOLUTION) | +- S390_SETBIT(S390_NNPA_MATMUL_OP) | +- S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST23)), ++ S390_SETBIT(S390_NNPA_SOFTMAX) | S390_SETBIT(S390_NNPA_GELU)), ++ (S390_SETBIT(S390_NNPA_BATCHNORM) | S390_SETBIT(S390_NNPA_MOMENTS) | ++ S390_SETBIT(S390_NNPA_LAYERNORM) | S390_SETBIT(S390_NNPA_NORM) | ++ S390_SETBIT(S390_NNPA_MAXPOOL2D) | S390_SETBIT(S390_NNPA_AVGPOOL2D) | ++ S390_SETBIT(S390_NNPA_LSTMACT) | S390_SETBIT(S390_NNPA_GRUACT) | ++ S390_SETBIT(S390_NNPA_CONVOLUTION) | S390_SETBIT(S390_NNPA_MATMUL_OP) | ++ S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST23) | ++ S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST1)), ++ 0, ++ (S390_SETBIT(S390_NNPA_TRANSFORM) | S390_SETBIT(S390_NNPA_REDUCE)), + }; + + /* Supported parameter block formats */ + static const ULong NNPA_ipbf[] = { +- (S390_SETBIT(0)), ++ (S390_SETBIT(0) | S390_SETBIT(1)), + }; + + /* Supported data types and data layout formats */ ++enum { ++ S390_NNPA_TYPE_1 = 0, // data type 1 (16 bit) ++ S390_NNPA_TYPE_BFP32 = 6, ++ S390_NNPA_TYPE_INT8 = 8, ++ S390_NNPA_TYPE_INT32 = 10, ++}; ++ ++enum { ++ S390_NNPA_4D_FEATURE_TENSOR = 0, ++ S390_NNPA_4D_KERNEL_TENSOR = 1, ++ S390_NNPA_4D_WEIGHTS_TENSOR = 2, ++ S390_NNPA_4D_GENERIC_TENSOR = 31, ++}; ++ + static const ULong NNPA_dtypes_layouts[] = { + /* Data types */ +- (S390_SETBIT(0) | // data type 1 (16 bit) ++ (S390_SETBIT(S390_NNPA_TYPE_1) | S390_SETBIT(S390_NNPA_TYPE_BFP32) | ++ S390_SETBIT(S390_NNPA_TYPE_INT8) | S390_SETBIT(S390_NNPA_TYPE_INT32) | + + /* Data layout formats */ +- S390_SETBIT(32 + 0) | // 4D-feature tensor +- S390_SETBIT(32 + 1) // 4D-kernel tensor +- ), ++ S390_SETBIT(32 + S390_NNPA_4D_FEATURE_TENSOR) | ++ S390_SETBIT(32 + S390_NNPA_4D_KERNEL_TENSOR) | ++ S390_SETBIT(32 + S390_NNPA_4D_WEIGHTS_TENSOR) | ++ S390_SETBIT(32 + S390_NNPA_4D_GENERIC_TENSOR)), + }; + + static const ULong NNPA_conversions[] = { +@@ -360,10 +390,15 @@ struct s390_NNPA_parms_qaf { + UInt mdis; + ULong mts; + ULong conversions; +- ULong reserved2[22]; ++ ULong reserved2; ++ UInt mdnis[4]; ++ struct { ++ ULong reserved[19]; ++ } reserved3; + }; + +-struct s390_NNPA_tensor0 { ++/* Tensor descriptor, common for all data-layout formats */ ++struct s390_NNPA_tensor { + UChar layout; + UChar dtype; + UShort reserved1; +@@ -372,21 +407,21 @@ struct s390_NNPA_tensor0 { + ULong address; + }; + +-struct s390_NNPA_parms0 { +- ULong pbvn : 16; +- ULong mvn : 8; +- ULong ribm : 24; +- ULong reserved0 : 15; +- ULong cf : 1; +- ULong reserved1[6]; +- ULong save_area_address; +- struct s390_NNPA_tensor0 out[2]; +- struct s390_NNPA_tensor0 reserved2[2]; +- struct s390_NNPA_tensor0 in[3]; +- ULong reserved3[12]; +- UInt param[5]; +- UInt reserved4; +- ULong reserved5[13]; ++/* Parameter block format 0 or 1 */ ++struct s390_NNPA_parms { ++ ULong pbvn : 16; ++ ULong mvn : 8; ++ ULong ribm : 24; ++ ULong reserved0 : 15; ++ ULong cf : 1; ++ ULong reserved1[6]; ++ ULong save_area_address; ++ struct s390_NNPA_tensor out[2]; ++ struct s390_NNPA_tensor reserved2[2]; ++ struct s390_NNPA_tensor in[3]; ++ ULong reserved3[12]; ++ UInt param[16]; ++ ULong reserved4[8]; + }; + + enum { +@@ -418,135 +453,145 @@ static const char* const s390_NNPA_errmsg_access[s390_NNPA_message_n] = { + + struct s390_NNPA_mem_dimensions { + UChar layout; +- ULong dim[5]; // total dimensions +- ULong used[4]; // used dimensions, without padding +- ULong step[5]; +- ULong last_dim4_size; ++ ULong dim[4]; ++ ULong total_size; ++ ULong used_sticks; // occupied sticks per next-higher dimension ++ ULong stick_fill; ++ ULong last_stick_fill; + }; + +-/* Determine the 5 dimensions used to represent the tensor data in memory */ ++/* Determine the dimensions used to represent the tensor data in memory */ + static enum ExtensionError +-NNPA_tensor0_size(const struct s390_NNPA_tensor0* t, +- UInt msg_idx, +- struct s390_NNPA_mem_dimensions* out_md) ++NNPA_tensor_size(const struct s390_NNPA_tensor* t, ++ UInt msg_idx, ++ struct s390_NNPA_mem_dimensions* out_md) + { + struct s390_NNPA_mem_dimensions md; + ULong elem_size; ++ ULong eps; + +- md.layout = t->layout; +- if (t->dtype == 0) ++ switch (t->dtype) { ++ case S390_NNPA_TYPE_INT8: ++ elem_size = 1; ++ break; ++ case S390_NNPA_TYPE_1: + elem_size = 2; +- else ++ break; ++ case S390_NNPA_TYPE_BFP32: ++ case S390_NNPA_TYPE_INT32: ++ elem_size = 4; ++ break; ++ default: + return INSN_ERR(s390_NNPA_errmsg_dtype[msg_idx]); ++ } ++ eps = 128 / elem_size; + ++ md.layout = t->layout; + switch (t->layout) { +- case 0: // 4D-feature tensor +- md.dim[0] = md.used[0] = t->dim4; +- md.dim[1] = md.used[1] = (t->dim1 + 63) / 64; +- md.dim[2] = md.used[2] = t->dim3; +- md.dim[3] = (t->dim2 + 31) / 32 * 32; +- md.used[3] = t->dim2; +- md.dim[4] = 64; +- md.last_dim4_size = elem_size * (t->dim1 % 64); ++ case S390_NNPA_4D_FEATURE_TENSOR: ++ md.dim[0] = t->dim4; ++ md.dim[1] = (t->dim1 + eps - 1) / eps; ++ md.used_sticks = t->dim2; ++ goto common_tensor_dimensions; ++ case S390_NNPA_4D_KERNEL_TENSOR: ++ md.dim[0] = (t->dim1 + eps - 1) / eps; ++ md.dim[1] = t->dim4; ++ md.used_sticks = t->dim2; ++ goto common_tensor_dimensions; ++ case S390_NNPA_4D_WEIGHTS_TENSOR: ++ elem_size *= 2; ++ eps /= 2; ++ md.dim[0] = t->dim4; ++ md.dim[1] = (t->dim1 + eps - 1) / eps; ++ md.used_sticks = (t->dim2 + 1) / 2; ++ common_tensor_dimensions: ++ md.dim[2] = t->dim3; ++ md.dim[3] = (md.used_sticks + 31) / 32 * 32; ++ md.stick_fill = elem_size * (t->dim1 >= eps ? eps : t->dim1); ++ md.last_stick_fill = elem_size * ((t->dim1 - 1) % eps + 1); + break; +- case 1: // 4D-kernel tensor +- md.dim[0] = md.used[0] = (t->dim1 + 63) / 64; +- md.dim[1] = md.used[1] = t->dim4; +- md.dim[2] = md.used[2] = t->dim3; +- md.dim[3] = (t->dim2 + 31) / 32 * 32; +- md.used[3] = t->dim2; +- md.dim[4] = 64; +- md.last_dim4_size = elem_size * (t->dim1 % 64); ++ case S390_NNPA_4D_GENERIC_TENSOR: ++ md.dim[0] = t->dim4; ++ md.dim[1] = t->dim3; ++ md.dim[2] = t->dim2; ++ md.dim[3] = t->dim1; ++ eps = 1; + break; + default: + return INSN_ERR(s390_NNPA_errmsg_layout[msg_idx]); + } +- md.step[4] = elem_size * md.dim[4]; +- md.step[3] = md.step[4] * md.dim[3]; +- md.step[2] = md.step[3] * md.dim[2]; +- md.step[1] = md.step[2] * md.dim[1]; +- md.step[0] = md.step[1] * md.dim[0]; // total size +- *out_md = md; ++ md.total_size = ++ elem_size * eps * md.dim[3] * md.dim[2] * md.dim[1] * md.dim[0]; ++ *out_md = md; + return ExtErr_OK; + } + +-/* Determine the size of the non-pad elements in the last dimension */ +-static ULong NNPA_mem_dim4_size(const struct s390_NNPA_mem_dimensions* md, +- ULong d0, +- ULong d1) +-{ +- switch (md->layout) { +- case 0: // 4D-feature tensor +- return d1 + 1 == md->dim[1] ? md->last_dim4_size : md->step[4]; +- case 1: // 4D-kernel tensor +- return d0 + 1 == md->dim[0] ? md->last_dim4_size : md->step[4]; +- } +- return 0; +-} +- +-static enum ExtensionError NNPA_pre_read_tensor0( +- ThreadState* tst, UInt msg_idx, const struct s390_NNPA_tensor0* t) ++/* Track a tensor's memory regions with PRE_MEM_READ or POST_MEM_WRITE */ ++static enum ExtensionError NNPA_track_tensor(ThreadState* tst, ++ UInt msg_idx, ++ const struct s390_NNPA_tensor* t, ++ Bool do_write) + { + struct s390_NNPA_mem_dimensions md; + enum ExtensionError ret; ++ ULong addr = t->address; + +- ret = NNPA_tensor0_size(t, msg_idx, &md); ++ ret = NNPA_tensor_size(t, msg_idx, &md); + if (ret != ExtErr_OK) + return ret; + +- for (ULong d0 = 0; d0 < md.used[0]; d0++) { +- for (ULong d1 = 0; d1 < md.used[1]; d1++) { +- for (ULong d2 = 0; d2 < md.used[2]; d2++) { +- for (ULong d3 = 0; d3 < md.used[3]; d3++) { +- ULong addr = t->address + d0 * md.step[1] + d1 * md.step[2] + +- d2 * md.step[3] + d3 * md.step[4]; +- ULong len = NNPA_mem_dim4_size(&md, d0, d1); +- PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], addr, len); ++ switch (md.layout) { ++ case S390_NNPA_4D_FEATURE_TENSOR: ++ case S390_NNPA_4D_KERNEL_TENSOR: ++ case S390_NNPA_4D_WEIGHTS_TENSOR: ++ for (ULong d0 = 0; d0 < md.dim[0]; d0++) { ++ for (ULong d1 = 0; d1 < md.dim[1]; d1++) { ++ ULong len; ++ switch (md.layout) { ++ case S390_NNPA_4D_FEATURE_TENSOR: ++ case S390_NNPA_4D_WEIGHTS_TENSOR: ++ len = d1 + 1 == md.dim[1] ? md.last_stick_fill : md.stick_fill; ++ break; ++ case S390_NNPA_4D_KERNEL_TENSOR: ++ len = d0 + 1 == md.dim[0] ? md.last_stick_fill : md.stick_fill; ++ break; + } +- } +- } +- } +- return ExtErr_OK; +-} +- +-static UWord NNPA_pre_write_tensor0(ThreadState* tst, +- UInt msg_idx, +- const struct s390_NNPA_tensor0* t) +-{ +- struct s390_NNPA_mem_dimensions md; +- enum ExtensionError ret; +- +- ret = NNPA_tensor0_size(t, msg_idx, &md); +- if (ret != ExtErr_OK) +- return ret; +- +- PRE_MEM_WRITE(tst, "NNPA(out_tensor)", t->address, md.step[0]); +- return ExtErr_OK; +-} +- +-static void NNPA_post_write_tensor0(ThreadState* tst, +- UInt msg_idx, +- const struct s390_NNPA_tensor0* t) +-{ +- struct s390_NNPA_mem_dimensions md; +- enum ExtensionError ret; +- +- ret = NNPA_tensor0_size(t, msg_idx, &md); +- if (ret != ExtErr_OK) +- return; +- +- for (ULong d0 = 0; d0 < md.used[0]; d0++) { +- for (ULong d1 = 0; d1 < md.used[1]; d1++) { +- for (ULong d2 = 0; d2 < md.used[2]; d2++) { +- for (ULong d3 = 0; d3 < md.used[3]; d3++) { +- ULong addr = t->address + d0 * md.step[1] + d1 * md.step[2] + +- d2 * md.step[3] + d3 * md.step[4]; +- ULong len = NNPA_mem_dim4_size(&md, d0, d1); +- POST_MEM_WRITE(tst, addr, len); ++ for (ULong d2 = 0; d2 < md.dim[2]; d2++) { ++ for (ULong d3 = 0; d3 < md.used_sticks; d3++) { ++ if (md.layout == S390_NNPA_4D_WEIGHTS_TENSOR && ++ d3 == md.used_sticks - 1 && t->dim2 % 2 != 0) { ++ // even elements only ++ for (ULong i = 0; i < len - 1; i += 2) { ++ if (do_write) { ++ POST_MEM_WRITE(tst, addr + i, 1); ++ } else { ++ PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], ++ addr + i, 1); ++ } ++ } ++ } else if (do_write) { ++ POST_MEM_WRITE(tst, addr, len); ++ } else { ++ PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], addr, ++ len); ++ } ++ addr += 128; ++ } ++ addr += 128 * (md.dim[3] - md.used_sticks); + } + } + } ++ break; ++ case S390_NNPA_4D_GENERIC_TENSOR: ++ if (do_write) { ++ POST_MEM_WRITE(tst, t->address, md.total_size); ++ } else { ++ PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], t->address, ++ md.total_size); ++ } ++ break; + } ++ return ExtErr_OK; + } + + static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) +@@ -571,16 +616,21 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) + NNPA_dtypes_layouts, sizeof(NNPA_dtypes_layouts)); + s390_filter_functions(&parms->conversions, sizeof(ULong), + NNPA_conversions, sizeof(NNPA_conversions)); ++ // Clear reserved fields ++ parms->reserved1 = 0; ++ parms->reserved2 = 0; ++ parms->reserved3 = (__typeof__(parms->reserved3)){0}; + } else { +- struct s390_NNPA_parms0* parms = (void*)parms_addr; +- const struct s390_NNPA_parms0 orig_parms = *parms; +- ULong save_area_size = 0; +- UInt in_tensors; +- UInt out_tensors; ++ struct s390_NNPA_parms* parms = (void*)parms_addr; ++ const struct s390_NNPA_parms orig_parms = *parms; ++ ULong save_area_size = 0; ++ UInt in_tensors; ++ UInt out_tensors; ++ enum ExtensionError retval; + + parms_len = 4096; + PRE_MEM_READ(tst, "NNPA(parms)", parms_addr, +- sizeof(struct s390_NNPA_parms0)); ++ sizeof(struct s390_NNPA_parms)); + if (parms->cf) { + PRE_MEM_READ(tst, "NNPA(parms.csb)", parms_addr + 512, + parms_len - 512); +@@ -594,28 +644,39 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) + case S390_NNPA_DIV: + case S390_NNPA_MIN: + case S390_NNPA_MAX: ++ case S390_NNPA_NORM: + in_tensors = 2; + out_tensors = 1; + break; + case S390_NNPA_LOG: + case S390_NNPA_EXP: ++ case S390_NNPA_SQRT: ++ case S390_NNPA_INVSQRT: + case S390_NNPA_RELU: + case S390_NNPA_TANH: + case S390_NNPA_SIGMOID: ++ case S390_NNPA_GELU: + in_tensors = 1; + out_tensors = 1; + break; + case S390_NNPA_SOFTMAX: ++ case S390_NNPA_REDUCE: + in_tensors = 1; + out_tensors = 1; + save_area_size = 8192; + break; + case S390_NNPA_BATCHNORM: ++ case S390_NNPA_LAYERNORM: + in_tensors = 3; + out_tensors = 1; + break; ++ case S390_NNPA_MOMENTS: ++ in_tensors = 1; ++ out_tensors = 2; ++ break; + case S390_NNPA_MAXPOOL2D: + case S390_NNPA_AVGPOOL2D: ++ case S390_NNPA_TRANSFORM: + in_tensors = 1; + out_tensors = 1; + break; +@@ -627,6 +688,7 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) + case S390_NNPA_CONVOLUTION: + case S390_NNPA_MATMUL_OP: + case S390_NNPA_MATMUL_OP_BCAST23: ++ case S390_NNPA_MATMUL_OP_BCAST1: + in_tensors = 3; + out_tensors = 1; + break; +@@ -635,16 +697,20 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) + } + + for (UInt i = 0; i < in_tensors; i++) { +- enum ExtensionError retval = +- NNPA_pre_read_tensor0(tst, s390_NNPA_message_in + i, &parms->in[i]); ++ retval = NNPA_track_tensor(tst, s390_NNPA_message_in + i, ++ &parms->in[i], False); + if (retval != ExtErr_OK) + return retval; + } + for (UInt i = 0; i < out_tensors; i++) { +- enum ExtensionError retval = NNPA_pre_write_tensor0( +- tst, s390_NNPA_message_out + i, &parms->out[i]); ++ UInt msg_idx = s390_NNPA_message_out + i; ++ struct s390_NNPA_mem_dimensions md; ++ ++ retval = NNPA_tensor_size(&parms->out[i], msg_idx, &md); + if (retval != ExtErr_OK) + return retval; ++ PRE_MEM_WRITE(tst, s390_NNPA_errmsg_access[msg_idx], ++ parms->out[i].address, md.total_size); + } + if (save_area_size != 0) { + PRE_MEM_WRITE(tst, "NNPA(save_area)", parms->save_area_address, +@@ -653,8 +719,10 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) + cc = do_NNPA_insn(&gpr0, parms_addr); + if (cc == 0) { + for (UInt i = 0; i < out_tensors; i++) { +- NNPA_post_write_tensor0(tst, s390_NNPA_message_out + i, +- &orig_parms.out[i]); ++ retval = NNPA_track_tensor(tst, s390_NNPA_message_out + i, ++ &orig_parms.out[i], True); ++ if (retval != ExtErr_OK) ++ return retval; + } + } + } +-- +2.50.1 + diff --git a/valgrind.spec b/valgrind.spec index 03401b9..b721294 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.25.1 -Release: 2%{?dist} +Release: 3%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -85,6 +85,10 @@ Patch3: valgrind-3.16.0-some-stack-protector.patch # Add some -Wl,z,now. Patch4: valgrind-3.16.0-some-Wl-z-now.patch +# VALGRIND_3_25_BRANCH patches +Patch5: 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch +Patch6: 0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch + BuildRequires: make BuildRequires: glibc-devel @@ -264,6 +268,9 @@ Valgrind User Manual for details. %patch -P3 -p1 %patch -P4 -p1 +%patch -P5 -p1 +%patch -P6 -p1 + %build # LTO triggers undefined symbols in valgrind. But valgrind has a # --enable-lto configure time option that we will use instead. @@ -502,6 +509,11 @@ echo ===============END TESTING=============== %endif %changelog +* Tue Aug 5 2025 Mark Wielaard - 3.25.1-3 +- Add VALGRIND_3_25_BRANCH patches + - 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch + - 0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch + * Fri Jul 25 2025 Fedora Release Engineering - 1:3.25.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 17943405edd0ac55d77bc6555a10610d22376a1d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 12 Aug 2025 03:07:30 +0200 Subject: [PATCH 17/30] Add ppc64-strcmp-ld.patch --- ppc64-strcmp-ld.patch | 87 +++++++++++++++++++++++++++++++++++++++++++ valgrind.spec | 9 +++++ 2 files changed, 96 insertions(+) create mode 100644 ppc64-strcmp-ld.patch diff --git a/ppc64-strcmp-ld.patch b/ppc64-strcmp-ld.patch new file mode 100644 index 0000000..92c6b7e --- /dev/null +++ b/ppc64-strcmp-ld.patch @@ -0,0 +1,87 @@ +diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c +index 63172b971..857f910cb 100644 +--- a/coregrind/m_redir.c ++++ b/coregrind/m_redir.c +@@ -1508,6 +1508,12 @@ void VG_(redir_initialise) ( void ) + NULL /* not mandatory - so why bother at all? */ + /* glibc-2.5 (FC6, ppc64) seems fine without it */ + ); ++ ++ add_hardwired_spec( ++ "ld64.so.2", "strcmp", ++ (Addr)&VG_(ppc64_linux_REDIR_FOR_strcmp), ++ NULL ++ ); + } + + # elif defined(VGP_arm_linux) +diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S +index 2c2cc0dc2..5e1f2f147 100644 +--- a/coregrind/m_trampoline.S ++++ b/coregrind/m_trampoline.S +@@ -602,8 +602,52 @@ VG_(ppc64_linux_REDIR_FOR_strchr): + .long 0 + .byte 0,0,0,0,0,0,0,0 + .L1end: +- + ++ /* this function is written using the "dotless" ABI convention */ ++ .align 2 ++ .globl VG_(ppc64_linux_REDIR_FOR_strcmp) ++#if !defined VGP_ppc64be_linux || _CALL_ELF == 2 ++ /* Little Endian uses ELF version 2 */ ++ .type VG_(ppc64_linux_REDIR_FOR_strcmp),@function ++VG_(ppc64_linux_REDIR_FOR_strcmp): ++#else ++ /* Big Endian uses ELF version 1 */ ++ .section ".opd","aw" ++ .align 3 ++VG_(ppc64_linux_REDIR_FOR_strcmp): ++ .quad .L.VG_(ppc64_linux_REDIR_FOR_strcmp),.TOC.@tocbase,0 ++ .previous ++ .size VG_(ppc64_linux_REDIR_FOR_strcmp), \ ++ .LFE0-.L.VG_(ppc64_linux_REDIR_FOR_strcmp) ++ .type VG_(ppc64_linux_REDIR_FOR_strcmp), @function ++ ++.L.VG_(ppc64_linux_REDIR_FOR_strcmp): ++#endif ++#if _CALL_ELF == 2 ++0: addis 2,12,.TOC.-0b@ha ++ addi 2,2,.TOC.-0b@l ++ .localentry VG_(ppc64_linux_REDIR_FOR_strcmp), .-VG_(ppc64_linux_REDIR_FOR_strcmp) ++#endif ++.LFB0: ++ .cfi_startproc ++ li 10,0 ++.L3: ++ lbzx 8,3,10 ++ lbzx 9,4,10 ++ cmpwi 0,8,0 ++ beq 0,.L2 ++ cmpw 0,8,9 ++ addi 10,10,1 ++ beq 0,.L3 ++.L2: ++ subf 3,9,8 ++ extsw 3,3 ++ blr ++ .long 0 ++ .byte 0,0,0,0,0,0,0,0 ++ .cfi_endproc ++.LFE0: ++ + .global VG_(trampoline_stuff_end) + VG_(trampoline_stuff_end): + +diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h +index 11d791df7..92b4fc67b 100644 +--- a/coregrind/pub_core_trampoline.h ++++ b/coregrind/pub_core_trampoline.h +@@ -97,6 +97,7 @@ extern void* VG_(ppc32_linux_REDIR_FOR_strchr)( void*, Int ); + #if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux) + extern Addr VG_(ppc64_linux_SUBST_FOR_rt_sigreturn); + extern UInt VG_(ppc64_linux_REDIR_FOR_strlen)( void* ); ++extern UInt VG_(ppc64_linux_REDIR_FOR_strcmp)( void*, void* ); + extern void* VG_(ppc64_linux_REDIR_FOR_strchr)( void*, Int ); + /* A label (sans dot) marking the ultra-magical return stub via which + all redirected and wrapped functions are made to "return" on diff --git a/valgrind.spec b/valgrind.spec index b721294..fbfc599 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -89,6 +89,10 @@ Patch4: valgrind-3.16.0-some-Wl-z-now.patch Patch5: 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch Patch6: 0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch +# Proposed upstream patches +# https://bugs.kde.org/show_bug.cgi?id=508145 +Patch101: ppc64-strcmp-ld.patch + BuildRequires: make BuildRequires: glibc-devel @@ -271,6 +275,8 @@ Valgrind User Manual for details. %patch -P5 -p1 %patch -P6 -p1 +%patch -P101 -p1 + %build # LTO triggers undefined symbols in valgrind. But valgrind has a # --enable-lto configure time option that we will use instead. @@ -509,6 +515,9 @@ echo ===============END TESTING=============== %endif %changelog +* Mon Aug 11 2025 Mark Wielaard +- Add ppc64-strcmp-ld.patch + * Tue Aug 5 2025 Mark Wielaard - 3.25.1-3 - Add VALGRIND_3_25_BRANCH patches - 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch From 76937a654eb10671f5328e2556b6e84a48ef5542 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 12 Aug 2025 03:44:53 +0200 Subject: [PATCH 18/30] 3.25.1-4 - Add 0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch --- ...missing-syscall-hooks-to-ppc64-linux.patch | 102 ++++++++++++++++++ valgrind.spec | 7 +- 2 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch diff --git a/0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch b/0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch new file mode 100644 index 0000000..7331e2b --- /dev/null +++ b/0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch @@ -0,0 +1,102 @@ +From 5c912fcfaff2c7c34232562a118fa5722c6df995 Mon Sep 17 00:00:00 2001 +From: Martin Cermak +Date: Fri, 8 Aug 2025 23:46:53 +0200 +Subject: [PATCH 3/3] Add several missing syscall hooks to ppc64-linux + +Specifically: + +sys_getrlimit +sys_mincore +sys_tkill +sys_unshare +sys_splice +sys_tee +sys_vmsplice +sys_fanotify_init +sys_fanotify_mark +sys_kcmp +sys_bpf + +https://bugs.kde.org/show_bug.cgi?id=508030 +(cherry picked from commit 4363549490ecaeaa6c3048beeb8c5edcec33ec06) +--- + NEWS | 1 + + coregrind/m_syswrap/syswrap-ppc64-linux.c | 14 +++++++++++--- + 2 files changed, 12 insertions(+), 3 deletions(-) + +diff --git a/NEWS b/NEWS +index 4e6e6c6d2387..3eea6bb1b709 100644 +--- a/NEWS ++++ b/NEWS +@@ -6,6 +6,7 @@ Branch 3.25.x + The following bugs have been fixed or resolved on this branch. + + 503241 s390x: Support z17 changes to the NNPA instruction ++508030 Add several missing syscall hooks to ppc64-linux + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c +index 007fa6336c0e..03a5e6a822c1 100644 +--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c ++++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c +@@ -691,7 +691,7 @@ static SyscallTableEntry syscall_table[] = { + // _____(__NR_sethostname, sys_sethostname), // 74 + + GENX_(__NR_setrlimit, sys_setrlimit), // 75 +-// _____(__NR_getrlimit, sys_getrlimit), // 76 ++ GENXY(__NR_getrlimit, sys_getrlimit), // 76 + GENXY(__NR_getrusage, sys_getrusage), // 77 + GENXY(__NR_gettimeofday, sys_gettimeofday), // 78 + // _____(__NR_settimeofday, sys_settimeofday), // 79 +@@ -847,9 +847,9 @@ static SyscallTableEntry syscall_table[] = { + LINXY(__NR_fcntl64, sys_fcntl64), // 204 !!!!?? 32bit only */ + + GENX_(__NR_madvise, sys_madvise), // 205 +-// _____(__NR_mincore, sys_mincore), // 206 ++ GENXY(__NR_mincore, sys_mincore), // 206 + LINX_(__NR_gettid, sys_gettid), // 207 +-// _____(__NR_tkill, sys_tkill), // 208 ++ LINXY(__NR_tkill, sys_tkill), // 208 + LINX_(__NR_setxattr, sys_setxattr), // 209 + + LINX_(__NR_lsetxattr, sys_lsetxattr), // 210 +@@ -934,6 +934,10 @@ static SyscallTableEntry syscall_table[] = { + + LINXY(__NR_pselect6, sys_pselect6), // 280 + LINXY(__NR_ppoll, sys_ppoll), // 281 ++ LINX_(__NR_unshare, sys_unshare), // 282 ++ LINX_(__NR_splice, sys_splice), // 283 ++ LINX_(__NR_tee, sys_tee), // 284 ++ LINXY(__NR_vmsplice, sys_vmsplice), // 285 + + LINXY(__NR_openat, sys_openat), // 286 + LINX_(__NR_mkdirat, sys_mkdirat), // 287 +@@ -972,6 +976,8 @@ static SyscallTableEntry syscall_table[] = { + LINXY(__NR_preadv, sys_preadv), // 320 + LINX_(__NR_pwritev, sys_pwritev), // 321 + LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 322 ++ LINXY(__NR_fanotify_init, sys_fanotify_init), // 323 ++ LINX_(__NR_fanotify_mark, sys_fanotify_mark), // 324 + + LINXY(__NR_prlimit64, sys_prlimit64), // 325 + LINXY(__NR_socket, sys_socket), // 326 +@@ -1001,6 +1007,7 @@ static SyscallTableEntry syscall_table[] = { + + LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 351 + LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 352 ++ LINX_(__NR_kcmp, sys_kcmp), // 354 + + LINX_(__NR_sched_setattr, sys_sched_setattr), // 355 + LINXY(__NR_sched_getattr, sys_sched_getattr), // 356 +@@ -1008,6 +1015,7 @@ static SyscallTableEntry syscall_table[] = { + + LINXY(__NR_getrandom, sys_getrandom), // 359 + LINXY(__NR_memfd_create, sys_memfd_create), // 360 ++ LINXY(__NR_bpf, sys_bpf), // 361 + + LINX_(__NR_execveat, sys_execveat), // 362 + +-- +2.50.1 + diff --git a/valgrind.spec b/valgrind.spec index fbfc599..8e89c9b 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.25.1 -Release: 3%{?dist} +Release: 4%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -88,6 +88,7 @@ Patch4: valgrind-3.16.0-some-Wl-z-now.patch # VALGRIND_3_25_BRANCH patches Patch5: 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch Patch6: 0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch +Patch7: 0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch # Proposed upstream patches # https://bugs.kde.org/show_bug.cgi?id=508145 @@ -274,6 +275,7 @@ Valgrind User Manual for details. %patch -P5 -p1 %patch -P6 -p1 +%patch -P7 -p1 %patch -P101 -p1 @@ -515,8 +517,9 @@ echo ===============END TESTING=============== %endif %changelog -* Mon Aug 11 2025 Mark Wielaard +* Mon Aug 11 2025 Mark Wielaard - 3.25.1-4 - Add ppc64-strcmp-ld.patch +- Add 0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch * Tue Aug 5 2025 Mark Wielaard - 3.25.1-3 - Add VALGRIND_3_25_BRANCH patches From be14de47f6d628d3e5e0f49a868e48c3f0d6caab Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 18 Oct 2025 23:35:53 +0200 Subject: [PATCH 19/30] 3.26.0-0.1.RC1 - Upstream 3.26.0-RC1 - Remove all VALGRIND_3_25_BRANCH and proposed upstream patches - Refresh some-stack-protector and some-Wl-z-now patches. - Add vgstack to valgrind-gdb. - Update License to GPL-3.0-or-later --- .gitignore | 1 + ...Prepare-NEWS-for-branch-3.25.x-fixes.patch | 32 -- ...-Support-z17-changes-to-the-NNPA-ins.patch | 539 ------------------ ...missing-syscall-hooks-to-ppc64-linux.patch | 102 ---- ppc64-strcmp-ld.patch | 87 --- sources | 2 +- ...tch => valgrind-3.26.0-some-Wl-z-now.patch | 30 +- ...valgrind-3.26.0-some-stack-protector.patch | 53 +- valgrind.spec | 41 +- 9 files changed, 59 insertions(+), 828 deletions(-) delete mode 100644 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch delete mode 100644 0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch delete mode 100644 0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch delete mode 100644 ppc64-strcmp-ld.patch rename valgrind-3.16.0-some-Wl-z-now.patch => valgrind-3.26.0-some-Wl-z-now.patch (70%) rename valgrind-3.16.0-some-stack-protector.patch => valgrind-3.26.0-some-stack-protector.patch (62%) diff --git a/.gitignore b/.gitignore index d89612b..e3a1993 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ /valgrind-3.25.0.RC2.tar.bz2 /valgrind-3.25.0.tar.bz2 /valgrind-3.25.1.tar.bz2 +/valgrind-3.26.0.RC1.tar.bz2 diff --git a/0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch b/0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch deleted file mode 100644 index cca72ed..0000000 --- a/0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 2e92839f77ad5b1e2db95887185eca3b4e70a4d5 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Tue, 5 Aug 2025 22:05:30 +0200 -Subject: [PATCH 1/2] Prepare NEWS for branch 3.25.x fixes - ---- - NEWS | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/NEWS b/NEWS -index 741329a68170..5043e7008bf0 100644 ---- a/NEWS -+++ b/NEWS -@@ -1,3 +1,15 @@ -+Branch 3.25.x -+~~~~~~~~~~~~~ -+ -+* ==================== FIXED BUGS ==================== -+ -+The following bugs have been fixed or resolved on this branch. -+ -+To see details of a given bug, visit -+ https://bugs.kde.org/show_bug.cgi?id=XXXXXX -+where XXXXXX is the bug number as listed above. -+ -+ - Release 3.25.1 (20 May 2025) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - --- -2.50.1 - diff --git a/0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch b/0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch deleted file mode 100644 index 67cf2e5..0000000 --- a/0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch +++ /dev/null @@ -1,539 +0,0 @@ -From 2ad8efa8f31c7e8733e430dad4f93541797d6792 Mon Sep 17 00:00:00 2001 -From: Andreas Arnez -Date: Wed, 25 Jun 2025 16:35:04 +0200 -Subject: [PATCH 2/2] Bug 503241 - s390x: Support z17 changes to the NNPA - instruction - -This adds support for the NNPA enhancements that are implemented with z17. - -(cherry picked from commit 24b634e8ce04de70d4aa6c61a12149df223f9c68) ---- - NEWS | 2 + - coregrind/m_extension/extension-s390x.c | 346 ++++++++++++++---------- - 2 files changed, 209 insertions(+), 139 deletions(-) - -diff --git a/NEWS b/NEWS -index 5043e7008bf0..4e6e6c6d2387 100644 ---- a/NEWS -+++ b/NEWS -@@ -5,6 +5,8 @@ Branch 3.25.x - - The following bugs have been fixed or resolved on this branch. - -+503241 s390x: Support z17 changes to the NNPA instruction -+ - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX - where XXXXXX is the bug number as listed above. -diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c -index 85b99ad08687..98b825d9b5d2 100644 ---- a/coregrind/m_extension/extension-s390x.c -+++ b/coregrind/m_extension/extension-s390x.c -@@ -301,11 +301,17 @@ typedef enum { - S390_NNPA_MAX = 0x15, - S390_NNPA_LOG = 0x20, - S390_NNPA_EXP = 0x21, -+ S390_NNPA_SQRT = 0x22, -+ S390_NNPA_INVSQRT = 0x23, - S390_NNPA_RELU = 0x31, - S390_NNPA_TANH = 0x32, - S390_NNPA_SIGMOID = 0x33, - S390_NNPA_SOFTMAX = 0x34, -+ S390_NNPA_GELU = 0x35, - S390_NNPA_BATCHNORM = 0x40, -+ S390_NNPA_MOMENTS = 0x41, -+ S390_NNPA_LAYERNORM = 0x42, -+ S390_NNPA_NORM = 0x43, - S390_NNPA_MAXPOOL2D = 0x50, - S390_NNPA_AVGPOOL2D = 0x51, - S390_NNPA_LSTMACT = 0x60, -@@ -313,6 +319,9 @@ typedef enum { - S390_NNPA_CONVOLUTION = 0x70, - S390_NNPA_MATMUL_OP = 0x71, - S390_NNPA_MATMUL_OP_BCAST23 = 0x72, -+ S390_NNPA_MATMUL_OP_BCAST1 = 0x73, -+ S390_NNPA_TRANSFORM = 0xf0, -+ S390_NNPA_REDUCE = 0xf1, - } s390_nnpa_function_t; - - /* Suported NNPA functions */ -@@ -321,30 +330,51 @@ static const ULong NNPA_functions[] = { - S390_SETBIT(S390_NNPA_SUB) | S390_SETBIT(S390_NNPA_MUL) | - S390_SETBIT(S390_NNPA_DIV) | S390_SETBIT(S390_NNPA_MIN) | - S390_SETBIT(S390_NNPA_MAX) | S390_SETBIT(S390_NNPA_LOG) | -- S390_SETBIT(S390_NNPA_EXP) | S390_SETBIT(S390_NNPA_RELU) | -+ S390_SETBIT(S390_NNPA_EXP) | S390_SETBIT(S390_NNPA_SQRT) | -+ S390_SETBIT(S390_NNPA_INVSQRT) | S390_SETBIT(S390_NNPA_RELU) | - S390_SETBIT(S390_NNPA_TANH) | S390_SETBIT(S390_NNPA_SIGMOID) | -- S390_SETBIT(S390_NNPA_SOFTMAX)), -- (S390_SETBIT(S390_NNPA_BATCHNORM) | S390_SETBIT(S390_NNPA_MAXPOOL2D) | -- S390_SETBIT(S390_NNPA_AVGPOOL2D) | S390_SETBIT(S390_NNPA_LSTMACT) | -- S390_SETBIT(S390_NNPA_GRUACT) | S390_SETBIT(S390_NNPA_CONVOLUTION) | -- S390_SETBIT(S390_NNPA_MATMUL_OP) | -- S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST23)), -+ S390_SETBIT(S390_NNPA_SOFTMAX) | S390_SETBIT(S390_NNPA_GELU)), -+ (S390_SETBIT(S390_NNPA_BATCHNORM) | S390_SETBIT(S390_NNPA_MOMENTS) | -+ S390_SETBIT(S390_NNPA_LAYERNORM) | S390_SETBIT(S390_NNPA_NORM) | -+ S390_SETBIT(S390_NNPA_MAXPOOL2D) | S390_SETBIT(S390_NNPA_AVGPOOL2D) | -+ S390_SETBIT(S390_NNPA_LSTMACT) | S390_SETBIT(S390_NNPA_GRUACT) | -+ S390_SETBIT(S390_NNPA_CONVOLUTION) | S390_SETBIT(S390_NNPA_MATMUL_OP) | -+ S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST23) | -+ S390_SETBIT(S390_NNPA_MATMUL_OP_BCAST1)), -+ 0, -+ (S390_SETBIT(S390_NNPA_TRANSFORM) | S390_SETBIT(S390_NNPA_REDUCE)), - }; - - /* Supported parameter block formats */ - static const ULong NNPA_ipbf[] = { -- (S390_SETBIT(0)), -+ (S390_SETBIT(0) | S390_SETBIT(1)), - }; - - /* Supported data types and data layout formats */ -+enum { -+ S390_NNPA_TYPE_1 = 0, // data type 1 (16 bit) -+ S390_NNPA_TYPE_BFP32 = 6, -+ S390_NNPA_TYPE_INT8 = 8, -+ S390_NNPA_TYPE_INT32 = 10, -+}; -+ -+enum { -+ S390_NNPA_4D_FEATURE_TENSOR = 0, -+ S390_NNPA_4D_KERNEL_TENSOR = 1, -+ S390_NNPA_4D_WEIGHTS_TENSOR = 2, -+ S390_NNPA_4D_GENERIC_TENSOR = 31, -+}; -+ - static const ULong NNPA_dtypes_layouts[] = { - /* Data types */ -- (S390_SETBIT(0) | // data type 1 (16 bit) -+ (S390_SETBIT(S390_NNPA_TYPE_1) | S390_SETBIT(S390_NNPA_TYPE_BFP32) | -+ S390_SETBIT(S390_NNPA_TYPE_INT8) | S390_SETBIT(S390_NNPA_TYPE_INT32) | - - /* Data layout formats */ -- S390_SETBIT(32 + 0) | // 4D-feature tensor -- S390_SETBIT(32 + 1) // 4D-kernel tensor -- ), -+ S390_SETBIT(32 + S390_NNPA_4D_FEATURE_TENSOR) | -+ S390_SETBIT(32 + S390_NNPA_4D_KERNEL_TENSOR) | -+ S390_SETBIT(32 + S390_NNPA_4D_WEIGHTS_TENSOR) | -+ S390_SETBIT(32 + S390_NNPA_4D_GENERIC_TENSOR)), - }; - - static const ULong NNPA_conversions[] = { -@@ -360,10 +390,15 @@ struct s390_NNPA_parms_qaf { - UInt mdis; - ULong mts; - ULong conversions; -- ULong reserved2[22]; -+ ULong reserved2; -+ UInt mdnis[4]; -+ struct { -+ ULong reserved[19]; -+ } reserved3; - }; - --struct s390_NNPA_tensor0 { -+/* Tensor descriptor, common for all data-layout formats */ -+struct s390_NNPA_tensor { - UChar layout; - UChar dtype; - UShort reserved1; -@@ -372,21 +407,21 @@ struct s390_NNPA_tensor0 { - ULong address; - }; - --struct s390_NNPA_parms0 { -- ULong pbvn : 16; -- ULong mvn : 8; -- ULong ribm : 24; -- ULong reserved0 : 15; -- ULong cf : 1; -- ULong reserved1[6]; -- ULong save_area_address; -- struct s390_NNPA_tensor0 out[2]; -- struct s390_NNPA_tensor0 reserved2[2]; -- struct s390_NNPA_tensor0 in[3]; -- ULong reserved3[12]; -- UInt param[5]; -- UInt reserved4; -- ULong reserved5[13]; -+/* Parameter block format 0 or 1 */ -+struct s390_NNPA_parms { -+ ULong pbvn : 16; -+ ULong mvn : 8; -+ ULong ribm : 24; -+ ULong reserved0 : 15; -+ ULong cf : 1; -+ ULong reserved1[6]; -+ ULong save_area_address; -+ struct s390_NNPA_tensor out[2]; -+ struct s390_NNPA_tensor reserved2[2]; -+ struct s390_NNPA_tensor in[3]; -+ ULong reserved3[12]; -+ UInt param[16]; -+ ULong reserved4[8]; - }; - - enum { -@@ -418,135 +453,145 @@ static const char* const s390_NNPA_errmsg_access[s390_NNPA_message_n] = { - - struct s390_NNPA_mem_dimensions { - UChar layout; -- ULong dim[5]; // total dimensions -- ULong used[4]; // used dimensions, without padding -- ULong step[5]; -- ULong last_dim4_size; -+ ULong dim[4]; -+ ULong total_size; -+ ULong used_sticks; // occupied sticks per next-higher dimension -+ ULong stick_fill; -+ ULong last_stick_fill; - }; - --/* Determine the 5 dimensions used to represent the tensor data in memory */ -+/* Determine the dimensions used to represent the tensor data in memory */ - static enum ExtensionError --NNPA_tensor0_size(const struct s390_NNPA_tensor0* t, -- UInt msg_idx, -- struct s390_NNPA_mem_dimensions* out_md) -+NNPA_tensor_size(const struct s390_NNPA_tensor* t, -+ UInt msg_idx, -+ struct s390_NNPA_mem_dimensions* out_md) - { - struct s390_NNPA_mem_dimensions md; - ULong elem_size; -+ ULong eps; - -- md.layout = t->layout; -- if (t->dtype == 0) -+ switch (t->dtype) { -+ case S390_NNPA_TYPE_INT8: -+ elem_size = 1; -+ break; -+ case S390_NNPA_TYPE_1: - elem_size = 2; -- else -+ break; -+ case S390_NNPA_TYPE_BFP32: -+ case S390_NNPA_TYPE_INT32: -+ elem_size = 4; -+ break; -+ default: - return INSN_ERR(s390_NNPA_errmsg_dtype[msg_idx]); -+ } -+ eps = 128 / elem_size; - -+ md.layout = t->layout; - switch (t->layout) { -- case 0: // 4D-feature tensor -- md.dim[0] = md.used[0] = t->dim4; -- md.dim[1] = md.used[1] = (t->dim1 + 63) / 64; -- md.dim[2] = md.used[2] = t->dim3; -- md.dim[3] = (t->dim2 + 31) / 32 * 32; -- md.used[3] = t->dim2; -- md.dim[4] = 64; -- md.last_dim4_size = elem_size * (t->dim1 % 64); -+ case S390_NNPA_4D_FEATURE_TENSOR: -+ md.dim[0] = t->dim4; -+ md.dim[1] = (t->dim1 + eps - 1) / eps; -+ md.used_sticks = t->dim2; -+ goto common_tensor_dimensions; -+ case S390_NNPA_4D_KERNEL_TENSOR: -+ md.dim[0] = (t->dim1 + eps - 1) / eps; -+ md.dim[1] = t->dim4; -+ md.used_sticks = t->dim2; -+ goto common_tensor_dimensions; -+ case S390_NNPA_4D_WEIGHTS_TENSOR: -+ elem_size *= 2; -+ eps /= 2; -+ md.dim[0] = t->dim4; -+ md.dim[1] = (t->dim1 + eps - 1) / eps; -+ md.used_sticks = (t->dim2 + 1) / 2; -+ common_tensor_dimensions: -+ md.dim[2] = t->dim3; -+ md.dim[3] = (md.used_sticks + 31) / 32 * 32; -+ md.stick_fill = elem_size * (t->dim1 >= eps ? eps : t->dim1); -+ md.last_stick_fill = elem_size * ((t->dim1 - 1) % eps + 1); - break; -- case 1: // 4D-kernel tensor -- md.dim[0] = md.used[0] = (t->dim1 + 63) / 64; -- md.dim[1] = md.used[1] = t->dim4; -- md.dim[2] = md.used[2] = t->dim3; -- md.dim[3] = (t->dim2 + 31) / 32 * 32; -- md.used[3] = t->dim2; -- md.dim[4] = 64; -- md.last_dim4_size = elem_size * (t->dim1 % 64); -+ case S390_NNPA_4D_GENERIC_TENSOR: -+ md.dim[0] = t->dim4; -+ md.dim[1] = t->dim3; -+ md.dim[2] = t->dim2; -+ md.dim[3] = t->dim1; -+ eps = 1; - break; - default: - return INSN_ERR(s390_NNPA_errmsg_layout[msg_idx]); - } -- md.step[4] = elem_size * md.dim[4]; -- md.step[3] = md.step[4] * md.dim[3]; -- md.step[2] = md.step[3] * md.dim[2]; -- md.step[1] = md.step[2] * md.dim[1]; -- md.step[0] = md.step[1] * md.dim[0]; // total size -- *out_md = md; -+ md.total_size = -+ elem_size * eps * md.dim[3] * md.dim[2] * md.dim[1] * md.dim[0]; -+ *out_md = md; - return ExtErr_OK; - } - --/* Determine the size of the non-pad elements in the last dimension */ --static ULong NNPA_mem_dim4_size(const struct s390_NNPA_mem_dimensions* md, -- ULong d0, -- ULong d1) --{ -- switch (md->layout) { -- case 0: // 4D-feature tensor -- return d1 + 1 == md->dim[1] ? md->last_dim4_size : md->step[4]; -- case 1: // 4D-kernel tensor -- return d0 + 1 == md->dim[0] ? md->last_dim4_size : md->step[4]; -- } -- return 0; --} -- --static enum ExtensionError NNPA_pre_read_tensor0( -- ThreadState* tst, UInt msg_idx, const struct s390_NNPA_tensor0* t) -+/* Track a tensor's memory regions with PRE_MEM_READ or POST_MEM_WRITE */ -+static enum ExtensionError NNPA_track_tensor(ThreadState* tst, -+ UInt msg_idx, -+ const struct s390_NNPA_tensor* t, -+ Bool do_write) - { - struct s390_NNPA_mem_dimensions md; - enum ExtensionError ret; -+ ULong addr = t->address; - -- ret = NNPA_tensor0_size(t, msg_idx, &md); -+ ret = NNPA_tensor_size(t, msg_idx, &md); - if (ret != ExtErr_OK) - return ret; - -- for (ULong d0 = 0; d0 < md.used[0]; d0++) { -- for (ULong d1 = 0; d1 < md.used[1]; d1++) { -- for (ULong d2 = 0; d2 < md.used[2]; d2++) { -- for (ULong d3 = 0; d3 < md.used[3]; d3++) { -- ULong addr = t->address + d0 * md.step[1] + d1 * md.step[2] + -- d2 * md.step[3] + d3 * md.step[4]; -- ULong len = NNPA_mem_dim4_size(&md, d0, d1); -- PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], addr, len); -+ switch (md.layout) { -+ case S390_NNPA_4D_FEATURE_TENSOR: -+ case S390_NNPA_4D_KERNEL_TENSOR: -+ case S390_NNPA_4D_WEIGHTS_TENSOR: -+ for (ULong d0 = 0; d0 < md.dim[0]; d0++) { -+ for (ULong d1 = 0; d1 < md.dim[1]; d1++) { -+ ULong len; -+ switch (md.layout) { -+ case S390_NNPA_4D_FEATURE_TENSOR: -+ case S390_NNPA_4D_WEIGHTS_TENSOR: -+ len = d1 + 1 == md.dim[1] ? md.last_stick_fill : md.stick_fill; -+ break; -+ case S390_NNPA_4D_KERNEL_TENSOR: -+ len = d0 + 1 == md.dim[0] ? md.last_stick_fill : md.stick_fill; -+ break; - } -- } -- } -- } -- return ExtErr_OK; --} -- --static UWord NNPA_pre_write_tensor0(ThreadState* tst, -- UInt msg_idx, -- const struct s390_NNPA_tensor0* t) --{ -- struct s390_NNPA_mem_dimensions md; -- enum ExtensionError ret; -- -- ret = NNPA_tensor0_size(t, msg_idx, &md); -- if (ret != ExtErr_OK) -- return ret; -- -- PRE_MEM_WRITE(tst, "NNPA(out_tensor)", t->address, md.step[0]); -- return ExtErr_OK; --} -- --static void NNPA_post_write_tensor0(ThreadState* tst, -- UInt msg_idx, -- const struct s390_NNPA_tensor0* t) --{ -- struct s390_NNPA_mem_dimensions md; -- enum ExtensionError ret; -- -- ret = NNPA_tensor0_size(t, msg_idx, &md); -- if (ret != ExtErr_OK) -- return; -- -- for (ULong d0 = 0; d0 < md.used[0]; d0++) { -- for (ULong d1 = 0; d1 < md.used[1]; d1++) { -- for (ULong d2 = 0; d2 < md.used[2]; d2++) { -- for (ULong d3 = 0; d3 < md.used[3]; d3++) { -- ULong addr = t->address + d0 * md.step[1] + d1 * md.step[2] + -- d2 * md.step[3] + d3 * md.step[4]; -- ULong len = NNPA_mem_dim4_size(&md, d0, d1); -- POST_MEM_WRITE(tst, addr, len); -+ for (ULong d2 = 0; d2 < md.dim[2]; d2++) { -+ for (ULong d3 = 0; d3 < md.used_sticks; d3++) { -+ if (md.layout == S390_NNPA_4D_WEIGHTS_TENSOR && -+ d3 == md.used_sticks - 1 && t->dim2 % 2 != 0) { -+ // even elements only -+ for (ULong i = 0; i < len - 1; i += 2) { -+ if (do_write) { -+ POST_MEM_WRITE(tst, addr + i, 1); -+ } else { -+ PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], -+ addr + i, 1); -+ } -+ } -+ } else if (do_write) { -+ POST_MEM_WRITE(tst, addr, len); -+ } else { -+ PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], addr, -+ len); -+ } -+ addr += 128; -+ } -+ addr += 128 * (md.dim[3] - md.used_sticks); - } - } - } -+ break; -+ case S390_NNPA_4D_GENERIC_TENSOR: -+ if (do_write) { -+ POST_MEM_WRITE(tst, t->address, md.total_size); -+ } else { -+ PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], t->address, -+ md.total_size); -+ } -+ break; - } -+ return ExtErr_OK; - } - - static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) -@@ -571,16 +616,21 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) - NNPA_dtypes_layouts, sizeof(NNPA_dtypes_layouts)); - s390_filter_functions(&parms->conversions, sizeof(ULong), - NNPA_conversions, sizeof(NNPA_conversions)); -+ // Clear reserved fields -+ parms->reserved1 = 0; -+ parms->reserved2 = 0; -+ parms->reserved3 = (__typeof__(parms->reserved3)){0}; - } else { -- struct s390_NNPA_parms0* parms = (void*)parms_addr; -- const struct s390_NNPA_parms0 orig_parms = *parms; -- ULong save_area_size = 0; -- UInt in_tensors; -- UInt out_tensors; -+ struct s390_NNPA_parms* parms = (void*)parms_addr; -+ const struct s390_NNPA_parms orig_parms = *parms; -+ ULong save_area_size = 0; -+ UInt in_tensors; -+ UInt out_tensors; -+ enum ExtensionError retval; - - parms_len = 4096; - PRE_MEM_READ(tst, "NNPA(parms)", parms_addr, -- sizeof(struct s390_NNPA_parms0)); -+ sizeof(struct s390_NNPA_parms)); - if (parms->cf) { - PRE_MEM_READ(tst, "NNPA(parms.csb)", parms_addr + 512, - parms_len - 512); -@@ -594,28 +644,39 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) - case S390_NNPA_DIV: - case S390_NNPA_MIN: - case S390_NNPA_MAX: -+ case S390_NNPA_NORM: - in_tensors = 2; - out_tensors = 1; - break; - case S390_NNPA_LOG: - case S390_NNPA_EXP: -+ case S390_NNPA_SQRT: -+ case S390_NNPA_INVSQRT: - case S390_NNPA_RELU: - case S390_NNPA_TANH: - case S390_NNPA_SIGMOID: -+ case S390_NNPA_GELU: - in_tensors = 1; - out_tensors = 1; - break; - case S390_NNPA_SOFTMAX: -+ case S390_NNPA_REDUCE: - in_tensors = 1; - out_tensors = 1; - save_area_size = 8192; - break; - case S390_NNPA_BATCHNORM: -+ case S390_NNPA_LAYERNORM: - in_tensors = 3; - out_tensors = 1; - break; -+ case S390_NNPA_MOMENTS: -+ in_tensors = 1; -+ out_tensors = 2; -+ break; - case S390_NNPA_MAXPOOL2D: - case S390_NNPA_AVGPOOL2D: -+ case S390_NNPA_TRANSFORM: - in_tensors = 1; - out_tensors = 1; - break; -@@ -627,6 +688,7 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) - case S390_NNPA_CONVOLUTION: - case S390_NNPA_MATMUL_OP: - case S390_NNPA_MATMUL_OP_BCAST23: -+ case S390_NNPA_MATMUL_OP_BCAST1: - in_tensors = 3; - out_tensors = 1; - break; -@@ -635,16 +697,20 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) - } - - for (UInt i = 0; i < in_tensors; i++) { -- enum ExtensionError retval = -- NNPA_pre_read_tensor0(tst, s390_NNPA_message_in + i, &parms->in[i]); -+ retval = NNPA_track_tensor(tst, s390_NNPA_message_in + i, -+ &parms->in[i], False); - if (retval != ExtErr_OK) - return retval; - } - for (UInt i = 0; i < out_tensors; i++) { -- enum ExtensionError retval = NNPA_pre_write_tensor0( -- tst, s390_NNPA_message_out + i, &parms->out[i]); -+ UInt msg_idx = s390_NNPA_message_out + i; -+ struct s390_NNPA_mem_dimensions md; -+ -+ retval = NNPA_tensor_size(&parms->out[i], msg_idx, &md); - if (retval != ExtErr_OK) - return retval; -+ PRE_MEM_WRITE(tst, s390_NNPA_errmsg_access[msg_idx], -+ parms->out[i].address, md.total_size); - } - if (save_area_size != 0) { - PRE_MEM_WRITE(tst, "NNPA(save_area)", parms->save_area_address, -@@ -653,8 +719,10 @@ static enum ExtensionError do_extension_NNPA(ThreadState* tst, ULong variant) - cc = do_NNPA_insn(&gpr0, parms_addr); - if (cc == 0) { - for (UInt i = 0; i < out_tensors; i++) { -- NNPA_post_write_tensor0(tst, s390_NNPA_message_out + i, -- &orig_parms.out[i]); -+ retval = NNPA_track_tensor(tst, s390_NNPA_message_out + i, -+ &orig_parms.out[i], True); -+ if (retval != ExtErr_OK) -+ return retval; - } - } - } --- -2.50.1 - diff --git a/0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch b/0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch deleted file mode 100644 index 7331e2b..0000000 --- a/0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 5c912fcfaff2c7c34232562a118fa5722c6df995 Mon Sep 17 00:00:00 2001 -From: Martin Cermak -Date: Fri, 8 Aug 2025 23:46:53 +0200 -Subject: [PATCH 3/3] Add several missing syscall hooks to ppc64-linux - -Specifically: - -sys_getrlimit -sys_mincore -sys_tkill -sys_unshare -sys_splice -sys_tee -sys_vmsplice -sys_fanotify_init -sys_fanotify_mark -sys_kcmp -sys_bpf - -https://bugs.kde.org/show_bug.cgi?id=508030 -(cherry picked from commit 4363549490ecaeaa6c3048beeb8c5edcec33ec06) ---- - NEWS | 1 + - coregrind/m_syswrap/syswrap-ppc64-linux.c | 14 +++++++++++--- - 2 files changed, 12 insertions(+), 3 deletions(-) - -diff --git a/NEWS b/NEWS -index 4e6e6c6d2387..3eea6bb1b709 100644 ---- a/NEWS -+++ b/NEWS -@@ -6,6 +6,7 @@ Branch 3.25.x - The following bugs have been fixed or resolved on this branch. - - 503241 s390x: Support z17 changes to the NNPA instruction -+508030 Add several missing syscall hooks to ppc64-linux - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c -index 007fa6336c0e..03a5e6a822c1 100644 ---- a/coregrind/m_syswrap/syswrap-ppc64-linux.c -+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c -@@ -691,7 +691,7 @@ static SyscallTableEntry syscall_table[] = { - // _____(__NR_sethostname, sys_sethostname), // 74 - - GENX_(__NR_setrlimit, sys_setrlimit), // 75 --// _____(__NR_getrlimit, sys_getrlimit), // 76 -+ GENXY(__NR_getrlimit, sys_getrlimit), // 76 - GENXY(__NR_getrusage, sys_getrusage), // 77 - GENXY(__NR_gettimeofday, sys_gettimeofday), // 78 - // _____(__NR_settimeofday, sys_settimeofday), // 79 -@@ -847,9 +847,9 @@ static SyscallTableEntry syscall_table[] = { - LINXY(__NR_fcntl64, sys_fcntl64), // 204 !!!!?? 32bit only */ - - GENX_(__NR_madvise, sys_madvise), // 205 --// _____(__NR_mincore, sys_mincore), // 206 -+ GENXY(__NR_mincore, sys_mincore), // 206 - LINX_(__NR_gettid, sys_gettid), // 207 --// _____(__NR_tkill, sys_tkill), // 208 -+ LINXY(__NR_tkill, sys_tkill), // 208 - LINX_(__NR_setxattr, sys_setxattr), // 209 - - LINX_(__NR_lsetxattr, sys_lsetxattr), // 210 -@@ -934,6 +934,10 @@ static SyscallTableEntry syscall_table[] = { - - LINXY(__NR_pselect6, sys_pselect6), // 280 - LINXY(__NR_ppoll, sys_ppoll), // 281 -+ LINX_(__NR_unshare, sys_unshare), // 282 -+ LINX_(__NR_splice, sys_splice), // 283 -+ LINX_(__NR_tee, sys_tee), // 284 -+ LINXY(__NR_vmsplice, sys_vmsplice), // 285 - - LINXY(__NR_openat, sys_openat), // 286 - LINX_(__NR_mkdirat, sys_mkdirat), // 287 -@@ -972,6 +976,8 @@ static SyscallTableEntry syscall_table[] = { - LINXY(__NR_preadv, sys_preadv), // 320 - LINX_(__NR_pwritev, sys_pwritev), // 321 - LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 322 -+ LINXY(__NR_fanotify_init, sys_fanotify_init), // 323 -+ LINX_(__NR_fanotify_mark, sys_fanotify_mark), // 324 - - LINXY(__NR_prlimit64, sys_prlimit64), // 325 - LINXY(__NR_socket, sys_socket), // 326 -@@ -1001,6 +1007,7 @@ static SyscallTableEntry syscall_table[] = { - - LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 351 - LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 352 -+ LINX_(__NR_kcmp, sys_kcmp), // 354 - - LINX_(__NR_sched_setattr, sys_sched_setattr), // 355 - LINXY(__NR_sched_getattr, sys_sched_getattr), // 356 -@@ -1008,6 +1015,7 @@ static SyscallTableEntry syscall_table[] = { - - LINXY(__NR_getrandom, sys_getrandom), // 359 - LINXY(__NR_memfd_create, sys_memfd_create), // 360 -+ LINXY(__NR_bpf, sys_bpf), // 361 - - LINX_(__NR_execveat, sys_execveat), // 362 - --- -2.50.1 - diff --git a/ppc64-strcmp-ld.patch b/ppc64-strcmp-ld.patch deleted file mode 100644 index 92c6b7e..0000000 --- a/ppc64-strcmp-ld.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c -index 63172b971..857f910cb 100644 ---- a/coregrind/m_redir.c -+++ b/coregrind/m_redir.c -@@ -1508,6 +1508,12 @@ void VG_(redir_initialise) ( void ) - NULL /* not mandatory - so why bother at all? */ - /* glibc-2.5 (FC6, ppc64) seems fine without it */ - ); -+ -+ add_hardwired_spec( -+ "ld64.so.2", "strcmp", -+ (Addr)&VG_(ppc64_linux_REDIR_FOR_strcmp), -+ NULL -+ ); - } - - # elif defined(VGP_arm_linux) -diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S -index 2c2cc0dc2..5e1f2f147 100644 ---- a/coregrind/m_trampoline.S -+++ b/coregrind/m_trampoline.S -@@ -602,8 +602,52 @@ VG_(ppc64_linux_REDIR_FOR_strchr): - .long 0 - .byte 0,0,0,0,0,0,0,0 - .L1end: -- - -+ /* this function is written using the "dotless" ABI convention */ -+ .align 2 -+ .globl VG_(ppc64_linux_REDIR_FOR_strcmp) -+#if !defined VGP_ppc64be_linux || _CALL_ELF == 2 -+ /* Little Endian uses ELF version 2 */ -+ .type VG_(ppc64_linux_REDIR_FOR_strcmp),@function -+VG_(ppc64_linux_REDIR_FOR_strcmp): -+#else -+ /* Big Endian uses ELF version 1 */ -+ .section ".opd","aw" -+ .align 3 -+VG_(ppc64_linux_REDIR_FOR_strcmp): -+ .quad .L.VG_(ppc64_linux_REDIR_FOR_strcmp),.TOC.@tocbase,0 -+ .previous -+ .size VG_(ppc64_linux_REDIR_FOR_strcmp), \ -+ .LFE0-.L.VG_(ppc64_linux_REDIR_FOR_strcmp) -+ .type VG_(ppc64_linux_REDIR_FOR_strcmp), @function -+ -+.L.VG_(ppc64_linux_REDIR_FOR_strcmp): -+#endif -+#if _CALL_ELF == 2 -+0: addis 2,12,.TOC.-0b@ha -+ addi 2,2,.TOC.-0b@l -+ .localentry VG_(ppc64_linux_REDIR_FOR_strcmp), .-VG_(ppc64_linux_REDIR_FOR_strcmp) -+#endif -+.LFB0: -+ .cfi_startproc -+ li 10,0 -+.L3: -+ lbzx 8,3,10 -+ lbzx 9,4,10 -+ cmpwi 0,8,0 -+ beq 0,.L2 -+ cmpw 0,8,9 -+ addi 10,10,1 -+ beq 0,.L3 -+.L2: -+ subf 3,9,8 -+ extsw 3,3 -+ blr -+ .long 0 -+ .byte 0,0,0,0,0,0,0,0 -+ .cfi_endproc -+.LFE0: -+ - .global VG_(trampoline_stuff_end) - VG_(trampoline_stuff_end): - -diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h -index 11d791df7..92b4fc67b 100644 ---- a/coregrind/pub_core_trampoline.h -+++ b/coregrind/pub_core_trampoline.h -@@ -97,6 +97,7 @@ extern void* VG_(ppc32_linux_REDIR_FOR_strchr)( void*, Int ); - #if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux) - extern Addr VG_(ppc64_linux_SUBST_FOR_rt_sigreturn); - extern UInt VG_(ppc64_linux_REDIR_FOR_strlen)( void* ); -+extern UInt VG_(ppc64_linux_REDIR_FOR_strcmp)( void*, void* ); - extern void* VG_(ppc64_linux_REDIR_FOR_strchr)( void*, Int ); - /* A label (sans dot) marking the ultra-magical return stub via which - all redirected and wrapped functions are made to "return" on diff --git a/sources b/sources index 074653a..4d6e003 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.25.1.tar.bz2) = 6a474d58730274c57d6ca012ffd3226d393d6507cd57bf46c3b26c87a0cba84e3c8cfc84c8c76e50041861e98baba7b9613490faef4212d082845581d08af351 +SHA512 (valgrind-3.26.0.RC1.tar.bz2) = f8b840b3a68621f6219c6611ccc1da0efdcaaf399b5f4c0a87a080afdc385466d6a9c8b1599a714802ea6df3bc88951def41eeb5286d6af1be673257accadf55 diff --git a/valgrind-3.16.0-some-Wl-z-now.patch b/valgrind-3.26.0-some-Wl-z-now.patch similarity index 70% rename from valgrind-3.16.0-some-Wl-z-now.patch rename to valgrind-3.26.0-some-Wl-z-now.patch index f6001d2..ccf867b 100644 --- a/valgrind-3.16.0-some-Wl-z-now.patch +++ b/valgrind-3.26.0-some-Wl-z-now.patch @@ -1,34 +1,28 @@ -commit d3c977726064ba09fed6dfc7daf22b16824c97b4 -Author: Mark Wielaard -Date: Fri May 24 18:24:56 2019 +0200 - - Add -Wl,-z,now to some binaries. - diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am -index 1b7842b..e211eec 100644 +index 2b8703cf1a63..8cb828b85c57 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am -@@ -32,7 +32,7 @@ valgrind_listener_SOURCES = valgrind-listener.c +@@ -50,7 +50,7 @@ valgrind_listener_SOURCES = valgrind-listener.c valgrind_listener_CPPFLAGS = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind - valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) -fstack-protector-strong + valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) -fhosted -fstack-protector-strong valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI) -valgrind_listener_LDFLAGS = $(AM_CFLAGS_PRI) +valgrind_listener_LDFLAGS = $(AM_CFLAGS_PRI) -Wl,-z,now if VGCONF_PLATVARIANT_IS_ANDROID valgrind_listener_CFLAGS += -static endif -@@ -51,7 +51,7 @@ valgrind_di_server_SOURCES = valgrind-di-server.c +@@ -69,7 +69,7 @@ valgrind_di_server_SOURCES = valgrind-di-server.c valgrind_di_server_CPPFLAGS = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind - valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) -fstack-protector-strong + valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) -fhosted -fstack-protector-strong valgrind_di_server_CCASFLAGS = $(AM_CCASFLAGS_PRI) -valgrind_di_server_LDFLAGS = $(AM_CFLAGS_PRI) +valgrind_di_server_LDFLAGS = $(AM_CFLAGS_PRI) -Wl,-z,now if VGCONF_PLATVARIANT_IS_ANDROID valgrind_di_server_CFLAGS += -static endif -@@ -86,7 +86,7 @@ getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = getoff.c +@@ -104,7 +104,7 @@ getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = getoff.c getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) - getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -fstack-protector-strong + getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -fhosted -fstack-protector-strong getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_PRI) -getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ +getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ -Wl,-z,now @@ -36,21 +30,21 @@ index 1b7842b..e211eec 100644 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDADD = $(LDADD) -ldl endif diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am -index 3c73210..fb6b7bb 100644 +index 0bcb4a4f423f..59fc48052e50 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am -@@ -57,7 +57,7 @@ RANLIB = ${LTO_RANLIB} +@@ -64,7 +64,7 @@ RANLIB = ${LTO_RANLIB} valgrind_CPPFLAGS = $(AM_CPPFLAGS_PRI) - valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong + valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fhosted -fstack-protector-strong valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI) -valgrind_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ +valgrind_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ -Wl,-z,now # 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 -@@ -104,7 +104,7 @@ +@@ -106,7 +106,7 @@ endif vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) $(GDB_SCRIPTS_DIR) - vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong + vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fhosted -fstack-protector-strong vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI) -vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ +vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ -Wl,-z,now diff --git a/valgrind-3.16.0-some-stack-protector.patch b/valgrind-3.26.0-some-stack-protector.patch similarity index 62% rename from valgrind-3.16.0-some-stack-protector.patch rename to valgrind-3.26.0-some-stack-protector.patch index 751cf39..a2907a1 100644 --- a/valgrind-3.16.0-some-stack-protector.patch +++ b/valgrind-3.26.0-some-stack-protector.patch @@ -1,45 +1,48 @@ -commit b73fb7a614e1b5d60af23fb0752b5cead995e02e -Author: Mark Wielaard -Date: Sun Apr 14 00:30:05 2019 +0200 - - Remove no-stack-protector, add stack-protector-strong to some. - diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am -index 56cc5ef..1b7842b 100644 +index d96e7fd0a968..2b8703cf1a63 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am -@@ -30,7 +30,7 @@ bin_PROGRAMS = valgrind-listener valgrind-di-server +@@ -48,7 +48,7 @@ bin_PROGRAMS = valgrind-listener valgrind-di-server valgrind_listener_SOURCES = valgrind-listener.c valgrind_listener_CPPFLAGS = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind --valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) -+valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) -fstack-protector-strong +-valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) -fhosted ++valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) -fhosted -fstack-protector-strong valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI) valgrind_listener_LDFLAGS = $(AM_CFLAGS_PRI) if VGCONF_PLATVARIANT_IS_ANDROID -@@ -49,7 +49,7 @@ endif +@@ -67,7 +67,7 @@ endif valgrind_di_server_SOURCES = valgrind-di-server.c valgrind_di_server_CPPFLAGS = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind --valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) -+valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) -fstack-protector-strong +-valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) -fhosted ++valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) -fhosted -fstack-protector-strong valgrind_di_server_CCASFLAGS = $(AM_CCASFLAGS_PRI) valgrind_di_server_LDFLAGS = $(AM_CFLAGS_PRI) if VGCONF_PLATVARIANT_IS_ANDROID -@@ -84,7 +84,7 @@ endif +@@ -102,7 +102,7 @@ endif getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = getoff.c getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) --getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -+getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -fstack-protector-strong +-getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -fhosted ++getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -fhosted -fstack-protector-strong getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_PRI) getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ if HAVE_DLINFO_RTLD_DI_TLS_MODID +@@ -119,7 +119,7 @@ endif + if VGCONF_HAVE_PLATFORM_SEC + getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = getoff.c + getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) +-getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) -fhosted ++getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) -fhosted -fstack-protector-strong + getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_SEC) + getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = $(AM_CFLAGS_SEC) + if HAVE_DLINFO_RTLD_DI_TLS_MODID diff --git a/configure.ac b/configure.ac -index f8c798b..ccc8f52 100755 +index 90fafaf1c557..84a3d22c5bff 100644 --- a/configure.ac +++ b/configure.ac -@@ -2352,24 +2352,24 @@ +@@ -2764,24 +2764,24 @@ AC_LANG(C) AM_CONDITIONAL([HAVE_ALIGNED_CXX_ALLOC], [test x$ac_have_aligned_cxx_alloc = xyes]) # does this compiler support -fno-stack-protector ? @@ -82,24 +85,24 @@ index f8c798b..ccc8f52 100755 # does this compiler support -finline-functions ? diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am -index 94030fd..3c73210 100644 +index 4ead1542b0c7..0bcb4a4f423f 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am -@@ -55,7 +55,7 @@ AR = ${LTO_AR} +@@ -62,7 +62,7 @@ AR = ${LTO_AR} RANLIB = ${LTO_RANLIB} valgrind_CPPFLAGS = $(AM_CPPFLAGS_PRI) --valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -+valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong +-valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fhosted ++valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fhosted -fstack-protector-strong valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI) valgrind_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ # If there is no secondary platform, and the platforms include x86-darwin, -@@ -102,7 +102,7 @@ +@@ -104,7 +104,7 @@ vgdb_SOURCES += vgdb-invoker-freebsd.c endif 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_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fhosted ++vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fhosted -fstack-protector-strong vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI) vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ if VGCONF_PLATVARIANT_IS_ANDROID diff --git a/valgrind.spec b/valgrind.spec index 8e89c9b..ea28bf2 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.25.1 -Release: 4%{?dist} +Version: 3.26.0 +Release: 0.1.RC1%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -12,7 +12,7 @@ Epoch: 1 # a license specifier is in coregrind/m_main.c for some Hacker's Delight # public domain code, which is only compiled into Darwin binaries, which # we don't create. Also some subpackages have their own license tags. -License: GPL-2.0-or-later AND bzip2-1.0.6 AND GFDL-1.2-or-later AND (GPL-2.0-or-later AND LGPL-2.0-or-later) AND (GPL-2.0-or-later AND ISC) AND (GPL-2.0-or-later AND Unlicense) AND (GPL-2.0-or-later AND Zlib) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later AND BSD-3-Clause) AND (GPL-2.0-or-later AND (MIT OR NCSA)) AND CMU-Mach AND (GPL-2.0-or-later AND X11 AND BSD-3-Clause) AND X11 AND (GPL-2.0-or-later AND LGPL-2.0-or-later) AND (GPL-2.0-or-later AND (GPL-2.0-or-later OR MPL-2.0)) AND (GPL-2.0-or-later WITH Autoconf-exception-generic) AND (GPL-3.0-or-later WITH Autoconf-exception-generic-3.0) AND FSFULLR AND FSFAP AND FSFUL AND FSFULLRWD +License: GPL-3.0-or-later AND bzip2-1.0.6 AND (GPL-3.0-or-later AND LGPL-2.0-or-later) AND (GPL-3.0-or-later AND ISC) AND (GPL-3.0-or-later AND Unlicense) AND (GPL-3.0-or-later AND Zlib) AND (GPL-3.0-or-later WITH GCC-exception-2.0) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-3.0-or-later AND BSD-3-Clause) AND (GPL-3.0-or-later AND (MIT OR NCSA)) AND CMU-Mach AND (GPL-3.0-or-later AND X11 AND BSD-3-Clause) AND X11 AND (GPL-3.0-or-later AND LGPL-2.0-or-later) AND (GPL-3.0-or-later AND (GPL-3.0-or-later OR MPL-2.0)) AND (GPL-2.0-or-later WITH Autoconf-exception-generic) AND (GPL-3.0-or-later WITH Autoconf-exception-generic-3.0) AND FSFULLR AND FSFAP AND FSFUL AND FSFULLRWD URL: https://www.valgrind.org/ # Are we building for a Software Collection? @@ -71,7 +71,7 @@ URL: https://www.valgrind.org/ # So those will already have their full symbol table. %undefine _include_minidebuginfo -Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.tar.bz2 +Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC1.tar.bz2 # Needs investigation and pushing upstream Patch1: valgrind-3.9.0-cachegrind-improvements.patch @@ -80,19 +80,10 @@ Patch1: valgrind-3.9.0-cachegrind-improvements.patch Patch2: valgrind-3.9.0-ldso-supp.patch # Add some stack-protector -Patch3: valgrind-3.16.0-some-stack-protector.patch +Patch3: valgrind-3.26.0-some-stack-protector.patch # Add some -Wl,z,now. -Patch4: valgrind-3.16.0-some-Wl-z-now.patch - -# VALGRIND_3_25_BRANCH patches -Patch5: 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch -Patch6: 0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch -Patch7: 0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch - -# Proposed upstream patches -# https://bugs.kde.org/show_bug.cgi?id=508145 -Patch101: ppc64-strcmp-ld.patch +Patch4: valgrind-3.26.0-some-Wl-z-now.patch BuildRequires: make BuildRequires: glibc-devel @@ -223,7 +214,7 @@ Documentation in html and pdf, plus man pages for valgrind tools and scripts. %package scripts Summary: Scripts for post-processing valgrind tool output -License: GPL-2.0-or-later +License: GPL-3.0-or-later # Most scripts can be used as is for post-processing a valgrind tool run. # But callgrind_control uses vgdb. Recommends: %{?scl_prefix}valgrind-gdb = %{epoch}:%{version}-%{release} @@ -233,7 +224,7 @@ Perl and Python scripts for post-processing valgrind tool output. %package gdb Summary: Tools for integrating valgrind and gdb -License: GPL-2.0-or-later +License: GPL-3.0-or-later Requires: %{?scl_prefix}valgrind = %{epoch}:%{version}-%{release} # vgdb can be used without gdb, just to control valgrind. # But normally you use it together with both valgrind and gdb. @@ -266,19 +257,13 @@ Valgrind User Manual for details. %endif %prep -%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version} +%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC1 %patch -P1 -p1 %patch -P2 -p1 %patch -P3 -p1 %patch -P4 -p1 -%patch -P5 -p1 -%patch -P6 -p1 -%patch -P7 -p1 - -%patch -P101 -p1 - %build # LTO triggers undefined symbols in valgrind. But valgrind has a # --enable-lto configure time option that we will use instead. @@ -482,6 +467,7 @@ echo ===============END TESTING=============== %{_bindir}/valgrind-di-server %{_bindir}/valgrind-listener %{_bindir}/vgdb +%{_bindir}/vgstack # gdb register descriptions %{_libexecdir}/valgrind/*.xml %{_datadir}/gdb/auto-load/valgrind-monitor.py @@ -517,6 +503,13 @@ echo ===============END TESTING=============== %endif %changelog +* Sat Oct 18 2025 Mark Wielaard - 3.26.0-0.1.RC1 +- Upstream 3.26.0-RC1 +- Remove all VALGRIND_3_25_BRANCH and proposed upstream patches +- Refresh some-stack-protector and some-Wl-z-now patches. +- Add vgstack to valgrind-gdb. +- Update License to GPL-3.0-or-later + * Mon Aug 11 2025 Mark Wielaard - 3.25.1-4 - Add ppc64-strcmp-ld.patch - Add 0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch From fae4a5224942c42024e5c722775ead0f1c492b9c Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 24 Oct 2025 23:45:58 +0200 Subject: [PATCH 20/30] 3.26.0-1 - Valgrind 3.26.0 final --- .gitignore | 1 + sources | 2 +- valgrind.spec | 14 +++++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index e3a1993..fb83280 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ /valgrind-3.25.0.tar.bz2 /valgrind-3.25.1.tar.bz2 /valgrind-3.26.0.RC1.tar.bz2 +/valgrind-3.26.0.tar.bz2 diff --git a/sources b/sources index 4d6e003..10021d6 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.26.0.RC1.tar.bz2) = f8b840b3a68621f6219c6611ccc1da0efdcaaf399b5f4c0a87a080afdc385466d6a9c8b1599a714802ea6df3bc88951def41eeb5286d6af1be673257accadf55 +SHA512 (valgrind-3.26.0.tar.bz2) = 80ebf9197be602fdd4aad0e9277e6ef2fd25ede9cecb6e6d159f6f062c13f62ad907c6b6e7000e82b3404d8b4f9e7bf15813f60d9fed414c7b713a4280c82898 diff --git a/valgrind.spec b/valgrind.spec index ea28bf2..d311364 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.26.0 -Release: 0.1.RC1%{?dist} +Release: 1%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -12,7 +12,7 @@ Epoch: 1 # a license specifier is in coregrind/m_main.c for some Hacker's Delight # public domain code, which is only compiled into Darwin binaries, which # we don't create. Also some subpackages have their own license tags. -License: GPL-3.0-or-later AND bzip2-1.0.6 AND (GPL-3.0-or-later AND LGPL-2.0-or-later) AND (GPL-3.0-or-later AND ISC) AND (GPL-3.0-or-later AND Unlicense) AND (GPL-3.0-or-later AND Zlib) AND (GPL-3.0-or-later WITH GCC-exception-2.0) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-3.0-or-later AND BSD-3-Clause) AND (GPL-3.0-or-later AND (MIT OR NCSA)) AND CMU-Mach AND (GPL-3.0-or-later AND X11 AND BSD-3-Clause) AND X11 AND (GPL-3.0-or-later AND LGPL-2.0-or-later) AND (GPL-3.0-or-later AND (GPL-3.0-or-later OR MPL-2.0)) AND (GPL-2.0-or-later WITH Autoconf-exception-generic) AND (GPL-3.0-or-later WITH Autoconf-exception-generic-3.0) AND FSFULLR AND FSFAP AND FSFUL AND FSFULLRWD +License: GPL-3.0-or-later AND bzip2-1.0.6 AND (GPL-3.0-or-later AND LGPL-2.0-or-later) AND (GPL-3.0-or-later AND ISC) AND (GPL-3.0-or-later AND Unlicense) AND (GPL-3.0-or-later AND Zlib) AND (GPL-3.0-or-later WITH GCC-exception-2.0) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-3.0-or-later AND BSD-3-Clause) AND (GPL-3.0-or-later AND (MIT OR NCSA)) AND CMU-Mach AND (GPL-3.0-or-later AND X11 AND BSD-3-Clause) AND X11 AND (GPL-3.0-or-later AND LGPL-2.0-or-later) AND (GPL-2.0-or-later WITH Autoconf-exception-generic) AND (GPL-3.0-or-later WITH Autoconf-exception-generic-3.0) AND FSFULLR AND FSFAP AND FSFUL AND FSFULLRWD URL: https://www.valgrind.org/ # Are we building for a Software Collection? @@ -71,7 +71,7 @@ URL: https://www.valgrind.org/ # So those will already have their full symbol table. %undefine _include_minidebuginfo -Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC1.tar.bz2 +Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.tar.bz2 # Needs investigation and pushing upstream Patch1: valgrind-3.9.0-cachegrind-improvements.patch @@ -214,7 +214,7 @@ Documentation in html and pdf, plus man pages for valgrind tools and scripts. %package scripts Summary: Scripts for post-processing valgrind tool output -License: GPL-3.0-or-later +License: GPL-3.0-or-later AND (GPL-3.0-or-later OR MPL-2.0) # Most scripts can be used as is for post-processing a valgrind tool run. # But callgrind_control uses vgdb. Recommends: %{?scl_prefix}valgrind-gdb = %{epoch}:%{version}-%{release} @@ -257,7 +257,7 @@ Valgrind User Manual for details. %endif %prep -%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC1 +%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version} %patch -P1 -p1 %patch -P2 -p1 @@ -503,6 +503,10 @@ echo ===============END TESTING=============== %endif %changelog +* Fri Oct 24 2025 Mark Wielaard - 3.26.0-1 +- Valgrind 3.26.0 final +- Clarify License of valgrind-scripts. + * Sat Oct 18 2025 Mark Wielaard - 3.26.0-0.1.RC1 - Upstream 3.26.0-RC1 - Remove all VALGRIND_3_25_BRANCH and proposed upstream patches From 45259a9e71734e3432a45e78a5ab1e115a96d719 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 8 Jan 2026 14:52:33 +0100 Subject: [PATCH 21/30] 3.26.0-2 - Add VALGRIND_3_26_BRANCH patches - 0001-Prepare-NEWS-for-branch-3.26-fixes.patch - 0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch - 0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch - 0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch - 0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch - 0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch --- 0001-Prepare-NEWS-for-branch-3.26-fixes.patch | 32 ++ ...ind-3.26.0-tests-fail-to-build-on-up.patch | 125 +++++ ...lf-exe-overwrites-buffer-beyond-its-.patch | 520 ++++++++++++++++++ ...ssion-add-an-entry-for-__is_decorate.patch | 46 ++ ...dd-a-suppression-for-_dl_allocate_tl.patch | 30 + ...ble-linux-madvise-MADV_GUARD_INSTALL.patch | 95 ++++ valgrind.spec | 26 +- 7 files changed, 873 insertions(+), 1 deletion(-) create mode 100644 0001-Prepare-NEWS-for-branch-3.26-fixes.patch create mode 100644 0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch create mode 100644 0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch create mode 100644 0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch create mode 100644 0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch create mode 100644 0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch diff --git a/0001-Prepare-NEWS-for-branch-3.26-fixes.patch b/0001-Prepare-NEWS-for-branch-3.26-fixes.patch new file mode 100644 index 0000000..67adb1d --- /dev/null +++ b/0001-Prepare-NEWS-for-branch-3.26-fixes.patch @@ -0,0 +1,32 @@ +From 0f4968e8aaaacbb9700c09d88b20a195118f6ae4 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 7 Jan 2026 15:11:59 +0100 +Subject: [PATCH 1/6] Prepare NEWS for branch 3.26 fixes + +--- + NEWS | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/NEWS b/NEWS +index fdeebfaead90..d176b0aa2ebe 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,3 +1,15 @@ ++Branch 3.26 ++~~~~~~~~~~~ ++ ++* ==================== FIXED BUGS ==================== ++ ++The following bugs have been fixed or resolved on this branch. ++ ++To see details of a given bug, visit ++ https://bugs.kde.org/show_bug.cgi?id=XXXXXX ++where XXXXXX is the bug number as listed above. ++ ++ + Release 3.26.0 (24 Oct 2025) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +-- +2.52.0 + diff --git a/0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch b/0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch new file mode 100644 index 0000000..e20bb92 --- /dev/null +++ b/0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch @@ -0,0 +1,125 @@ +From fc9cf49c2f2e0e2282b000557df80ce2f755f191 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Wed, 12 Nov 2025 21:46:23 +0100 +Subject: [PATCH 2/6] Bug 511972 - valgrind-3.26.0 tests fail to build on + upcomig gcc-16: unrecognized command-line option + '-Wno-alloc-size-larger-than=18446744073709551615' + +Initial patch from Sergei Trofimovich, thanks. + +(cherry picked from commit 51c5973d9d1f096b9472df75638f2a53324fafed) +--- + NEWS | 4 ++++ + configure.ac | 4 ++-- + memcheck/tests/Makefile.am | 8 ++++---- + memcheck/tests/amd64-freebsd/Makefile.am | 2 +- + memcheck/tests/amd64-linux/Makefile.am | 2 +- + memcheck/tests/x86-freebsd/Makefile.am | 2 +- + 6 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/NEWS b/NEWS +index d176b0aa2ebe..4e6cb3de9125 100644 +--- a/NEWS ++++ b/NEWS +@@ -5,6 +5,10 @@ Branch 3.26 + + The following bugs have been fixed or resolved on this branch. + ++511972 valgrind-3.26.0 tests fail to build on upcomig gcc-16: ++ unrecognized command-line option ++ '-Wno-alloc-size-larger-than=18446744073709551615' ++ + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX + where XXXXXX is the bug number as listed above. +diff --git a/configure.ac b/configure.ac +index 371dcf235c7d..9d62a7d27a2c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2538,7 +2538,7 @@ fi + AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[ + AC_MSG_CHECKING([if gcc accepts -W$1]) + safe_CFLAGS=$CFLAGS +- CFLAGS="-W$1 -Werror" ++ CFLAGS="-W$1 -Wno-$1 -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [ + AC_SUBST([$2], [-Wno-$1]) + AC_MSG_RESULT([yes])], [ +@@ -2591,7 +2591,6 @@ AC_GCC_WARNING_SUBST_NO([unused-result], [FLAG_W_NO_UNUSED_RESULT]) + AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION]) + AC_GCC_WARNING_SUBST_NO([deprecated], [FLAG_W_NO_DEPRECATED]) + # OK for 32 and 64 bit +-AC_GCC_WARNING_SUBST_NO([alloc-size-larger-than=18446744073709551615], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN]) + AC_GCC_WARNING_SUBST_NO([alloc-size], [FLAG_W_NO_ALLOC_SIZE]) + + AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS]) +@@ -2605,6 +2604,7 @@ AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE]) + AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP]) + AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION]) + AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH]) ++AC_GCC_WARNING_SUBST([alloc-size-larger-than=18446744073709551616], [FLAG_W_ALLOC_SIZE_LARGER_THAN]) + + # as above, C++ flags + AC_DEFUN([AC_GXX_WARNING_SUBST_NO],[ +diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am +index 920f262a68cf..4bdca487aa51 100644 +--- a/memcheck/tests/Makefile.am ++++ b/memcheck/tests/Makefile.am +@@ -689,18 +689,18 @@ leak_cpp_interior_SOURCES = leak_cpp_interior.cpp + + # Suppress various gcc warnings which are correct, but for things + # we are actually testing for at runtime. +-accounting_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ ++accounting_CFLAGS = $(AM_CFLAGS) @FLAG_W_ALLOC_SIZE_LARGER_THAN@ + badfree_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_FREE_NONHEAP_OBJECT@ +-bug155125_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNUSED_RESULT@ @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ ++bug155125_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNUSED_RESULT@ @FLAG_W_ALLOC_SIZE_LARGER_THAN@ + bug472219_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +-calloc_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ ++calloc_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_ALLOC_SIZE_LARGER_THAN@ + malloc_usable_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ + mallinfo_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations + if VGCONF_OS_IS_SOLARIS + mallinfo_LDADD = -lmalloc + endif + mallinfo2_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations +-malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ @FLAG_W_NO_ALLOC_SIZE@ ++malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_ALLOC_SIZE_LARGER_THAN@ @FLAG_W_NO_ALLOC_SIZE@ + sbfragment_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations + if VGCONF_OS_IS_SOLARIS + sbfragment_LDADD = -lmalloc +diff --git a/memcheck/tests/amd64-freebsd/Makefile.am b/memcheck/tests/amd64-freebsd/Makefile.am +index 378446d4cf45..1eff95fce3b7 100644 +--- a/memcheck/tests/amd64-freebsd/Makefile.am ++++ b/memcheck/tests/amd64-freebsd/Makefile.am +@@ -24,5 +24,5 @@ AM_CCASFLAGS += @FLAG_M64@ + + posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ + posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +-reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ ++reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_ALLOC_SIZE_LARGER_THAN@ + +diff --git a/memcheck/tests/amd64-linux/Makefile.am b/memcheck/tests/amd64-linux/Makefile.am +index a3b5df5a6742..69a84ffdfc8f 100644 +--- a/memcheck/tests/amd64-linux/Makefile.am ++++ b/memcheck/tests/amd64-linux/Makefile.am +@@ -32,5 +32,5 @@ AM_CCASFLAGS += @FLAG_M64@ + + defcfaexpr_SOURCES = defcfaexpr.S + defcfaexpr_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@ +-reallocarray_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ ++reallocarray_CFLAGS = $(AM_CFLAGS) @FLAG_W_ALLOC_SIZE_LARGER_THAN@ + scalar_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +diff --git a/memcheck/tests/x86-freebsd/Makefile.am b/memcheck/tests/x86-freebsd/Makefile.am +index 8c48506c2be7..7839bb309588 100644 +--- a/memcheck/tests/x86-freebsd/Makefile.am ++++ b/memcheck/tests/x86-freebsd/Makefile.am +@@ -23,4 +23,4 @@ AM_CCASFLAGS += @FLAG_M32@ + + posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ + posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +-reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ ++reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_ALLOC_SIZE_LARGER_THAN@ +-- +2.52.0 + diff --git a/0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch b/0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch new file mode 100644 index 0000000..ca99ac1 --- /dev/null +++ b/0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch @@ -0,0 +1,520 @@ +From 7de247c998049db64c4df8cb8bc8e481493f3b8e Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Sat, 3 Jan 2026 18:24:34 +0100 +Subject: [PATCH 3/6] readlink("/proc/self/exe") overwrites buffer beyond its + return value + +https://bugs.kde.org/show_bug.cgi?id=514094 + +Squashed cherry-picks: + +Solaris: set VG_(resolved_exename) in load_client() + + Haven't needed it yet, but I would like to try using it in the + readlink syscall wrapper. + +(cherry picked from commit bf154d815a9fd7f4aaae97e31aa03cecf69448d4) + +Bug 514094 - readlink("/proc/self/exe") overwrites buffer beyond its return value + + Used the reproducer as the basis for a test on Solaris and Linux. + +(cherry picked from commit 5c0f5e604bc3a4e8822ea59c488c123af6284afd) + +readlink[at] syswrap: limit copy to bufsiz when path is proc self exe + +(cherry picked from commit bd9edb8fcd0a8692d865e08fab2a573a4cde4c16) + +Regtest: add missing readlinkat_self files + +(cherry picked from commit 987034c44105cdc2f6f8d84751135d23bd5c37b6) + +regtest: fix warning + + Added a nice const named variable then didn't use it + +(cherry picked from commit dae37ecd2692e0e5beba77c296c2648ebbf47637) + +Fix bug514094,vgtest typo in none/tests/Makefile.am + +(cherry picked from commit 294742a2d9f431fd2dcd73db161f67fb12ddd833) + +syswrap readlink and linux readlinkat: check that buf is accessible for proc self exe case + + Also update the t testcases to cover this. + +(cherry picked from commit 8d8023d107699c7c2d97acf2dcb77bae71c0b1cf) + +solaris readlinkat: check that buf is accessible for proc self path a.out + +(cherry picked from commit 827a1b8c307a2eafa001788565e14af3445f2151) +--- + .gitignore | 3 ++ + NEWS | 1 + + coregrind/m_initimg/initimg-solaris.c | 9 ++++ + coregrind/m_syswrap/syswrap-generic.c | 29 +++++++---- + coregrind/m_syswrap/syswrap-linux.c | 28 +++++++---- + coregrind/m_syswrap/syswrap-solaris.c | 13 +++-- + none/tests/Makefile.am | 3 ++ + none/tests/bug514094.c | 48 +++++++++++++++++++ + none/tests/bug514094.stderr.exp | 2 + + none/tests/bug514094.vgtest | 2 + + none/tests/linux/Makefile.am | 3 ++ + none/tests/linux/readlinkat_self.c | 34 +++++++++++++ + none/tests/linux/readlinkat_self.stderr.exp | 2 + + none/tests/linux/readlinkat_self.vgtest | 1 + + none/tests/solaris/Makefile.am | 3 ++ + none/tests/solaris/readlinkat_self.c | 34 +++++++++++++ + none/tests/solaris/readlinkat_self.stderr.exp | 2 + + none/tests/solaris/readlinkat_self.vgtest | 1 + + 18 files changed, 194 insertions(+), 24 deletions(-) + create mode 100644 none/tests/bug514094.c + create mode 100644 none/tests/bug514094.stderr.exp + create mode 100644 none/tests/bug514094.vgtest + create mode 100644 none/tests/linux/readlinkat_self.c + create mode 100644 none/tests/linux/readlinkat_self.stderr.exp + create mode 100644 none/tests/linux/readlinkat_self.vgtest + create mode 100644 none/tests/solaris/readlinkat_self.c + create mode 100644 none/tests/solaris/readlinkat_self.stderr.exp + create mode 100644 none/tests/solaris/readlinkat_self.vgtest + +diff --git a/NEWS b/NEWS +index 4e6cb3de9125..cca48f513138 100644 +--- a/NEWS ++++ b/NEWS +@@ -8,6 +8,7 @@ The following bugs have been fixed or resolved on this branch. + 511972 valgrind-3.26.0 tests fail to build on upcomig gcc-16: + unrecognized command-line option + '-Wno-alloc-size-larger-than=18446744073709551615' ++514094 readlink("/proc/self/exe") overwrites buffer beyond its return value + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/coregrind/m_initimg/initimg-solaris.c b/coregrind/m_initimg/initimg-solaris.c +index 79072f3a85df..bd2d822e5d20 100644 +--- a/coregrind/m_initimg/initimg-solaris.c ++++ b/coregrind/m_initimg/initimg-solaris.c +@@ -94,6 +94,15 @@ static void load_client(/*OUT*/ExeInfo *info, + /*NOTREACHED*/ + } + VG_(strcpy)(out_exe_name, exe_name); ++ if (VG_(resolved_exename) == NULL) { ++ HChar interp_name[VKI_PATH_MAX]; ++ if (VG_(try_get_interp)(exe_name, interp_name, VKI_PATH_MAX)) { ++ exe_name = interp_name; ++ } ++ HChar resolved_name[VKI_PATH_MAX]; ++ VG_(realpath)(exe_name, resolved_name); ++ VG_(resolved_exename) = VG_(strdup)("initimg-solaris.lc.1", resolved_name); ++ } + + /* Set initial brk values. */ + if (info->ldsoexec) { +diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c +index 37f312fe8f4b..f39dbcdba055 100644 +--- a/coregrind/m_syswrap/syswrap-generic.c ++++ b/coregrind/m_syswrap/syswrap-generic.c +@@ -5060,20 +5060,16 @@ POST(sys_poll) + + PRE(sys_readlink) + { +- FUSE_COMPATIBLE_MAY_BLOCK(); + PRINT("sys_readlink ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )", + ARG1, (char*)(Addr)ARG1, ARG2, (ULong)ARG3); + PRE_REG_READ3(long, "readlink", + const char *, path, char *, buf, int, bufsiz); + PRE_MEM_RASCIIZ( "readlink(path)", ARG1 ); + PRE_MEM_WRITE( "readlink(buf)", ARG2,ARG3 ); +-} + +-POST(sys_readlink) +-{ ++ Bool fuse_may_block = True; + #if defined(VGO_linux) || defined(VGO_solaris) + { +- Word saved = SYSNO; + #if defined(VGO_linux) + #define PID_EXEPATH "/proc/%d/exe" + #define SELF_EXEPATH "/proc/self/exe" +@@ -5092,14 +5088,27 @@ POST(sys_readlink) + VG_(sprintf)(name, PID_EXEPATH, VG_(getpid)()); + if (ML_(safe_to_deref)(arg1s, 1) + && (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, SELF_EXEPATH))) { +- VG_(sprintf)(name, SELF_EXEFD, VG_(cl_exec_fd)); +- SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name, +- ARG2, ARG3)); ++ HChar* out_name = (HChar*)ARG2; ++ SizeT res = VG_(strlen)(VG_(resolved_exename)); ++ res = VG_MIN(res, ARG3); ++ if (ML_(safe_to_deref)(out_name, res)) { ++ VG_(strncpy)(out_name, VG_(resolved_exename), res); ++ SET_STATUS_Success(res); ++ } else { ++ SET_STATUS_Failure(VKI_EFAULT); ++ } ++ fuse_may_block = False; + } + } + #endif +- if (SUCCESS && RES > 0) +- POST_MEM_WRITE( ARG2, RES ); ++ ++ if (fuse_may_block) ++ FUSE_COMPATIBLE_MAY_BLOCK(); ++} ++ ++POST(sys_readlink) ++{ ++ POST_MEM_WRITE( ARG2, RES ); + } + + PRE(sys_readv) +diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c +index e8b200385b8f..f1970cd8be9f 100644 +--- a/coregrind/m_syswrap/syswrap-linux.c ++++ b/coregrind/m_syswrap/syswrap-linux.c +@@ -6468,14 +6468,10 @@ PRE(sys_readlinkat) + ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "readlinkat", tid, status); + PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 ); + PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 ); +-} + +-POST(sys_readlinkat) +-{ ++ Bool fuse_may_block = True; + HChar name[30]; // large enough +- Word saved = SYSNO; + +- // @todo PJF why is this done in POST and not in PRE? + /* + * Handle the case where readlinkat is looking at /proc/self/exe or + * /proc//exe. +@@ -6484,13 +6480,25 @@ POST(sys_readlinkat) + if (ML_(safe_to_deref)((void*)(Addr)ARG2, 1) + && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0 + || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0)) { +- VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd)); +- SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, (UWord)name, +- ARG3, ARG4)); ++ HChar* out_name = (HChar*)ARG3; ++ SizeT res = VG_(strlen)(VG_(resolved_exename)); ++ res = VG_MIN(res, ARG4); ++ if (ML_(safe_to_deref)(out_name, res)) { ++ VG_(strncpy)(out_name, VG_(resolved_exename), res); ++ SET_STATUS_Success(res); ++ } else { ++ SET_STATUS_Failure(VKI_EFAULT); ++ } ++ fuse_may_block = False; + } + +- if (SUCCESS && RES > 0) +- POST_MEM_WRITE( ARG3, RES ); ++ if (fuse_may_block) ++ FUSE_COMPATIBLE_MAY_BLOCK(); ++} ++ ++POST(sys_readlinkat) ++{ ++ POST_MEM_WRITE( ARG3, RES ); + } + + PRE(sys_fchmodat) +diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c +index 2665633f435f..57af54fdc3be 100644 +--- a/coregrind/m_syswrap/syswrap-solaris.c ++++ b/coregrind/m_syswrap/syswrap-solaris.c +@@ -2295,7 +2295,6 @@ PRE(sys_readlinkat) + /* ssize_t readlinkat(int dfd, const char *path, char *buf, + size_t bufsiz); */ + HChar name[30]; // large enough +- Word saved = SYSNO; + + /* Interpret the first argument as 32-bit value even on 64-bit architecture. + This is different from Linux, for example, where glibc sign-extends it. */ +@@ -2317,9 +2316,15 @@ PRE(sys_readlinkat) + if (ML_(safe_to_deref)((void*)ARG2, 1) && + (!VG_(strcmp)((HChar*)ARG2, name) || + !VG_(strcmp)((HChar*)ARG2, "/proc/self/path/a.out"))) { +- VG_(sprintf)(name, "/proc/self/path/%d", VG_(cl_exec_fd)); +- SET_STATUS_from_SysRes(VG_(do_syscall4)(saved, dfd, (UWord)name, ARG3, +- ARG4)); ++ HChar* out_name = (HChar*)ARG3; ++ SizeT res = VG_(strlen)(VG_(resolved_exename)); ++ res = VG_MIN(res, ARG4); ++ if (ML_(safe_to_deref)(out_name, res)) { ++ VG_(strncpy)(out_name, VG_(resolved_exename), res); ++ SET_STATUS_Success(res); ++ } else { ++ SET_STATUS_Failure(VKI_EFAULT); ++ } + } + } + +diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am +index a95d66436df8..a5e03de77cbb 100644 +--- a/none/tests/Makefile.am ++++ b/none/tests/Makefile.am +@@ -111,6 +111,7 @@ EXTRA_DIST = \ + bug290061.vgtest bug290061.stderr.exp \ + bug491394.vgtest bug491394.stderr.exp \ + bug492678.vgtest bug492678.stderr.exp \ ++ bug514094.vgtest bug514094.stderr.exp \ + closeall.stderr.exp closeall.vgtest \ + cmdline0.stderr.exp cmdline0.stdout.exp cmdline0.vgtest \ + cmdline1.stderr.exp cmdline1.stdout.exp cmdline1.vgtest \ +@@ -287,6 +288,7 @@ check_PROGRAMS = \ + bug129866 bug234814 \ + bug290061 \ + bug492678 \ ++ bug514094 \ + closeall coolo_strlen \ + discard exec-sigmask execve faultstatus fcntl_setown \ + fdleak_cmsg fdleak_creat fdleak_doubleclose0 fdleak_dup fdleak_dup2 \ +@@ -392,6 +394,7 @@ bug290061_LDFLAGS = @FLAG_PIE@ + bug491394_LDADD = -lc + bug491394_LDFLAGS = -nostdlib -static + bug491394_CFLAGS = ${AM_CFLAGS} -Os ++bug514094_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_STRINGOP_OVERFLOW@ + execve_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_NONNULL@ + if VGCONF_OS_IS_SOLARIS + fcntl_setown_LDADD = -lsocket -lnsl +diff --git a/none/tests/bug514094.c b/none/tests/bug514094.c +new file mode 100644 +index 000000000000..a62a6406b722 +--- /dev/null ++++ b/none/tests/bug514094.c +@@ -0,0 +1,48 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "../../config.h" ++ ++int main(int argc, char** argv) ++{ ++ char buf[PATH_MAX]; ++ memset(buf, 0, PATH_MAX); ++#if defined(VGO_solaris) ++ int ret = readlink("/proc/self/path/a.out", buf, PATH_MAX); ++#else ++ // Linux, and maybe one day NetBSD ++ // other platforms excluded by .vgtest prereq ++ int ret = readlink("/proc/self/exe", buf, PATH_MAX); ++#endif ++ if (argc > 1) { ++ printf("ret = %d, buf = %.64s\n", ret, buf); ++ } ++ char resolved[PATH_MAX]; ++ realpath(argv[0], resolved); ++ assert(strcmp(resolved, buf) == 0); ++ ++ const size_t small_buf_size = 11; ++ char small_buf[small_buf_size]; ++ memset(small_buf, '#', small_buf_size); ++#if defined(VGO_solaris) ++ ret = readlink("/proc/self/path/a.out", small_buf, 10); ++#else ++ ret = readlink("/proc/self/exe", small_buf, 10); ++#endif ++ assert(strncmp(resolved, small_buf, 10) == 0); ++ assert(small_buf[10] == '#'); ++ ++#if defined(VGO_solaris) ++ ret = readlink("/proc/self/path/a.out", (char*)1, 100); ++#else ++ ret = readlink("/proc/self/exe", (char*)1, 100); ++#endif ++ assert(ret == -1); ++ assert(errno = EFAULT); ++} ++ +diff --git a/none/tests/bug514094.stderr.exp b/none/tests/bug514094.stderr.exp +new file mode 100644 +index 000000000000..139597f9cb07 +--- /dev/null ++++ b/none/tests/bug514094.stderr.exp +@@ -0,0 +1,2 @@ ++ ++ +diff --git a/none/tests/bug514094.vgtest b/none/tests/bug514094.vgtest +new file mode 100644 +index 000000000000..292428cb7696 +--- /dev/null ++++ b/none/tests/bug514094.vgtest +@@ -0,0 +1,2 @@ ++prereq: ../../tests/os_test solaris || ../../tests/os_test linux ++prog: bug514094 +diff --git a/none/tests/linux/Makefile.am b/none/tests/linux/Makefile.am +index 55426e2b2664..3692c6ff1f2a 100644 +--- a/none/tests/linux/Makefile.am ++++ b/none/tests/linux/Makefile.am +@@ -21,6 +21,7 @@ EXTRA_DIST = \ + mremap6.stderr.exp mremap6.vgtest \ + open_client.stderr.exp open_client.vgtest \ + pthread-stack.stderr.exp pthread-stack.vgtest \ ++ readlinkat_self.stderr.exp readlinkat_self.vgtest \ + stack-overflow.stderr.exp stack-overflow.vgtest + + check_PROGRAMS = \ +@@ -37,6 +38,7 @@ check_PROGRAMS = \ + mremap5 \ + mremap6 \ + pthread-stack \ ++ readlinkat_self \ + stack-overflow + + if HAVE_OPENAT2 +@@ -58,6 +60,7 @@ open_client_SOURCES = open_client.cpp + endif + clonev_LDADD = -lpthread + pthread_stack_LDADD = -lpthread ++readlinkat_self_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_STRINGOP_OVERFLOW@ + + stack_overflow_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ \ + @FLAG_W_NO_INFINITE_RECURSION@ +diff --git a/none/tests/linux/readlinkat_self.c b/none/tests/linux/readlinkat_self.c +new file mode 100644 +index 000000000000..586581a0d966 +--- /dev/null ++++ b/none/tests/linux/readlinkat_self.c +@@ -0,0 +1,34 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "../../config.h" ++ ++int main(int argc, char** argv) ++{ ++ char buf[PATH_MAX]; ++ memset(buf, 0, PATH_MAX); ++ int ret = readlinkat(99, "/proc/self/exe", buf, PATH_MAX); ++ if (argc > 1) { ++ printf("ret = %d, buf = %.64s\n", ret, buf); ++ } ++ char resolved[PATH_MAX]; ++ realpath(argv[0], resolved); ++ assert(strcmp(resolved, buf) == 0); ++ ++ const size_t small_buf_size = 11; ++ char small_buf[small_buf_size]; ++ memset(small_buf, '#', small_buf_size); ++ ret = readlinkat(100, "/proc/self/exe", small_buf, 10); ++ assert(strncmp(resolved, small_buf, 10) == 0); ++ assert(small_buf[10] == '#'); ++ ++ ret = readlinkat(101, "/proc/self/exe", (char*)1, 100); ++ assert(ret == -1); ++ assert(errno = EFAULT); ++} ++ +diff --git a/none/tests/linux/readlinkat_self.stderr.exp b/none/tests/linux/readlinkat_self.stderr.exp +new file mode 100644 +index 000000000000..139597f9cb07 +--- /dev/null ++++ b/none/tests/linux/readlinkat_self.stderr.exp +@@ -0,0 +1,2 @@ ++ ++ +diff --git a/none/tests/linux/readlinkat_self.vgtest b/none/tests/linux/readlinkat_self.vgtest +new file mode 100644 +index 000000000000..3b91da54c53d +--- /dev/null ++++ b/none/tests/linux/readlinkat_self.vgtest +@@ -0,0 +1 @@ ++prog: readlinkat_self +diff --git a/none/tests/solaris/Makefile.am b/none/tests/solaris/Makefile.am +index 861c9ff56222..c488c782de6d 100644 +--- a/none/tests/solaris/Makefile.am ++++ b/none/tests/solaris/Makefile.am +@@ -23,6 +23,7 @@ EXTRA_DIST = \ + proc_psinfo.stderr.exp proc_psinfo.stdout.exp proc_psinfo.vgtest \ + posix_spawn.stderr.exp posix_spawn.stdout.exp posix_spawn.vgtest \ + pthread-stack.stderr.exp pthread-stack.vgtest \ ++ readlinkat_self.stderr.exp readlinkat_self.vgtest \ + reserve_sysstat_addr.map reserve_sysstat_addr.stderr.exp reserve_sysstat_addr.vgtest \ + reserve_sysstat_zone_addr.map reserve_sysstat_zone_addr.stderr.exp reserve_sysstat_zone_addr.vgtest \ + resolv.stdout.exp resolv.stderr.exp resolv.vgtest \ +@@ -47,6 +48,7 @@ check_PROGRAMS = \ + proc_psinfo \ + posix_spawn \ + pthread-stack \ ++ readlinkat_self \ + resolv \ + sigresend \ + stack_overflow \ +@@ -57,6 +59,7 @@ AM_CFLAGS += $(AM_FLAG_M3264_PRI) + AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) + + pthread_stack_LDADD = -lpthread ++readlinkat_self_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_STRINGOP_OVERFLOW@ + resolv_LDADD = -lresolv + stack_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_INFINITE_RECURSION@ + stack_prot_LDFLAGS = -Wl,-M,/usr/lib/ld/map.noexstk +diff --git a/none/tests/solaris/readlinkat_self.c b/none/tests/solaris/readlinkat_self.c +new file mode 100644 +index 000000000000..ca60834aeb5e +--- /dev/null ++++ b/none/tests/solaris/readlinkat_self.c +@@ -0,0 +1,34 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "../../config.h" ++ ++int main(int argc, char** argv) ++{ ++ char buf[PATH_MAX]; ++ memset(buf, 0, PATH_MAX); ++ int ret = readlinkat(99, "/proc/self/path/a.out", buf, PATH_MAX); ++ if (argc > 1) { ++ printf("ret = %d, buf = %.64s\n", ret, buf); ++ } ++ char resolved[PATH_MAX]; ++ realpath(argv[0], resolved); ++ assert(strcmp(resolved, buf) == 0); ++ ++ const size_t small_buf_size = 11; ++ char small_buf[small_buf_size]; ++ memset(small_buf, '#', small_buf_size); ++ ret = readlinkat(100, "/proc/self/path/a.out", small_buf, 10); ++ assert(strncmp(resolved, small_buf, 10) == 0); ++ assert(small_buf[10] == '#'); ++ ++ ret = readlinkat(101, "/proc/self/path/a.out", (char*)1, 100); ++ assert(ret == -1); ++ assert(errno = EFAULT); ++} ++ +diff --git a/none/tests/solaris/readlinkat_self.stderr.exp b/none/tests/solaris/readlinkat_self.stderr.exp +new file mode 100644 +index 000000000000..139597f9cb07 +--- /dev/null ++++ b/none/tests/solaris/readlinkat_self.stderr.exp +@@ -0,0 +1,2 @@ ++ ++ +diff --git a/none/tests/solaris/readlinkat_self.vgtest b/none/tests/solaris/readlinkat_self.vgtest +new file mode 100644 +index 000000000000..3b91da54c53d +--- /dev/null ++++ b/none/tests/solaris/readlinkat_self.vgtest +@@ -0,0 +1 @@ ++prog: readlinkat_self +-- +2.52.0 + diff --git a/0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch b/0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch new file mode 100644 index 0000000..d2ae314 --- /dev/null +++ b/0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch @@ -0,0 +1,46 @@ +From 4a1d79be47ead6918053f649f66107b8d8df4310 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Mon, 1 Dec 2025 08:12:30 +0100 +Subject: [PATCH 4/6] Linux DRD suppression: add an entry for + __is_decorate_maps_enabled + +Seen on Fedora 43 + +(cherry picked from commit cfc8b0706a9a0fbf05525a0ce142e2bf4cc53fed) +--- + drd/tests/std_thread2.supp | 7 +++++++ + glibc-2.X-drd.supp.in | 6 ++++++ + 2 files changed, 13 insertions(+) + +diff --git a/drd/tests/std_thread2.supp b/drd/tests/std_thread2.supp +index 40741b06f889..39a201da9af7 100644 +--- a/drd/tests/std_thread2.supp ++++ b/drd/tests/std_thread2.supp +@@ -98,3 +98,10 @@ + drd:ConflictingAccess + fun:__set_vma_name + } ++ ++{ ++ drd-libc-__is_decorate_maps_enabled ++ drd:ConflictingAccess ++ fun:__is_decorate_maps_enabled ++} ++ +diff --git a/glibc-2.X-drd.supp.in b/glibc-2.X-drd.supp.in +index 419ff2256c92..6866904470d6 100644 +--- a/glibc-2.X-drd.supp.in ++++ b/glibc-2.X-drd.supp.in +@@ -369,3 +369,9 @@ + fun:_dl_exception_create_format + } + ++{ ++ drd-libc-__is_decorate_maps_enabled ++ drd:ConflictingAccess ++ fun:__is_decorate_maps_enabled ++} ++ +-- +2.52.0 + diff --git a/0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch b/0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch new file mode 100644 index 0000000..7e68f22 --- /dev/null +++ b/0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch @@ -0,0 +1,30 @@ +From c080f583dc41a779d339ffd2a08863bd05a80904 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Mon, 1 Dec 2025 08:18:56 +0100 +Subject: [PATCH 5/6] Linux Helgrind: add a suppression for + _dl_allocate_tls_init + +Seen on Fedora 43 amd64 + +(cherry picked from commit b599858486bb7db6d2ff3e6ddc4e7f71791d393d) +--- + glibc-2.X-helgrind.supp.in | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/glibc-2.X-helgrind.supp.in b/glibc-2.X-helgrind.supp.in +index 9b1ef9ae485b..61d4e1d724d0 100644 +--- a/glibc-2.X-helgrind.supp.in ++++ b/glibc-2.X-helgrind.supp.in +@@ -356,3 +356,9 @@ + obj:/usr/lib/*/libnss_mdns4*.so.* + } + ++{ ++ helgrind---_dl_allocate_tls_init ++ Helgrind:Race ++ fun:mempcpy ++ fun:_dl_allocate_tls_init ++} +-- +2.52.0 + diff --git a/0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch b/0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch new file mode 100644 index 0000000..eaf6a69 --- /dev/null +++ b/0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch @@ -0,0 +1,95 @@ +From dbdfc2b4522bb210786bddbc16e3ad855d5fa62a Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 7 Jan 2026 22:20:49 +0100 +Subject: [PATCH 6/6] Disable linux madvise MADV_GUARD_INSTALL + +glibc 2.42+ (with linux 6.13+) uses MADV_GUARD_INSTALL to setup stack +guard pages. valgrind currently isn't able to track this and such +guard pages also don't show up in /proc maps (only in /proc pagemap +since linux 6.14). For now valgrind fails a madvise MADV_GUARD_INSTALL +syscall with EINVAL. This causes glibc to fall back to mprotect +PROT_NONE which valgrind is able to track. + +https://bugs.kde.org/show_bug.cgi?id=511717 + +(cherry picked from commit 19a34d1d9376f459cf0a19feb39ea4ab27690390) +--- + NEWS | 14 ++++++++++++++ + coregrind/m_syswrap/syswrap-generic.c | 10 ++++++++++ + include/vki/vki-linux.h | 7 +++++++ + 3 files changed, 31 insertions(+) + +diff --git a/NEWS b/NEWS +index cca48f513138..28409915e1a1 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,6 +1,18 @@ + Branch 3.26 + ~~~~~~~~~~~ + ++* ==================== CORE CHANGES =================== ++ ++* linux madvise MADV_GUARD_INSTALL unsupported ++ ++ glibc 2.42+ (with linux 6.13+) uses MADV_GUARD_INSTALL to setup ++ stack guard pages. valgrind currently isn't able to track this and ++ such guard pages also don't show up in /proc maps (only in /proc ++ pagemap since linux 6.14). For now valgrind fails a madvise ++ MADV_GUARD_INSTALL syscall with EINVAL. This causes glibc to fall ++ back to mprotect PROT_NONE which valgrind is able to track. ++ See also https://bugs.kde.org/show_bug.cgi?id=514297 ++ + * ==================== FIXED BUGS ==================== + + The following bugs have been fixed or resolved on this branch. +@@ -8,6 +20,8 @@ The following bugs have been fixed or resolved on this branch. + 511972 valgrind-3.26.0 tests fail to build on upcomig gcc-16: + unrecognized command-line option + '-Wno-alloc-size-larger-than=18446744073709551615' ++511717 gdbserver (valgrind_read_memory) the 'impossible' happened: ++ Killed by fatal signal (SIGSEGV) + 514094 readlink("/proc/self/exe") overwrites buffer beyond its return value + + To see details of a given bug, visit +diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c +index f39dbcdba055..668acc4605a8 100644 +--- a/coregrind/m_syswrap/syswrap-generic.c ++++ b/coregrind/m_syswrap/syswrap-generic.c +@@ -3112,6 +3112,16 @@ PRE(sys_madvise) + ARG1, ARG2, SARG3); + PRE_REG_READ3(long, "madvise", + unsigned long, start, vki_size_t, length, int, advice); ++ /* Ugly hack to try to bypass the problem of guard pages not being ++ understood by valgrind aspace manager. ++ By making the syscall fail, we expect glibc to fallback ++ on implementing guard pages with mprotect PROT_NONE to ensure ++ the valgrind address space manager is not confused wrongly ++ believing the guard page is rw. */ ++#ifdef VKI_MADV_GUARD_INSTALL ++ if (ARG3 == VKI_MADV_GUARD_INSTALL) ++ SET_STATUS_Failure( VKI_EINVAL ); ++#endif + } + + #if HAVE_MREMAP +diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h +index 3f9272f4d18e..96c181a85775 100644 +--- a/include/vki/vki-linux.h ++++ b/include/vki/vki-linux.h +@@ -1364,6 +1364,13 @@ struct vki_seminfo { + #define VKI_MREMAP_MAYMOVE 1 + #define VKI_MREMAP_FIXED 2 + ++//---------------------------------------------------------------------- ++// Common madvise flags mman-common.h ++//---------------------------------------------------------------------- ++ ++#define VKI_MADV_GUARD_INSTALL 102 ++#define VKI_MADV_GUARD_REMOVE 103 ++ + //---------------------------------------------------------------------- + // From linux-2.6.31-rc4/include/linux/futex.h + //---------------------------------------------------------------------- +-- +2.52.0 + diff --git a/valgrind.spec b/valgrind.spec index d311364..5940d6c 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.26.0 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -85,6 +85,14 @@ Patch3: valgrind-3.26.0-some-stack-protector.patch # Add some -Wl,z,now. Patch4: valgrind-3.26.0-some-Wl-z-now.patch +# VALGRIND_3_26_BRANCH patches +Patch5: 0001-Prepare-NEWS-for-branch-3.26-fixes.patch +Patch6: 0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch +Patch7: 0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch +Patch8: 0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch +Patch9: 0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch +Patch10: 0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch + BuildRequires: make BuildRequires: glibc-devel @@ -264,6 +272,13 @@ Valgrind User Manual for details. %patch -P3 -p1 %patch -P4 -p1 +%patch -P5 -p1 +%patch -P6 -p1 +%patch -P7 -p1 +%patch -P8 -p1 +%patch -P9 -p1 +%patch -P10 -p1 + %build # LTO triggers undefined symbols in valgrind. But valgrind has a # --enable-lto configure time option that we will use instead. @@ -503,6 +518,15 @@ echo ===============END TESTING=============== %endif %changelog +* Thu Jan 8 2026 Mark Wielaard - 3.26.0-2 + - Add VALGRIND_3_26_BRANCH patches + - 0001-Prepare-NEWS-for-branch-3.26-fixes.patch + - 0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch + - 0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch + - 0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch + - 0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch + - 0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch + * Fri Oct 24 2025 Mark Wielaard - 3.26.0-1 - Valgrind 3.26.0 final - Clarify License of valgrind-scripts. From 338731caeafb9963a1193b9277e6aa54943d798f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 17 Jan 2026 19:46:40 +0000 Subject: [PATCH 22/30] Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild --- valgrind.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/valgrind.spec b/valgrind.spec index 5940d6c..f949b68 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.26.0 -Release: 2%{?dist} +Release: 3%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -518,6 +518,9 @@ echo ===============END TESTING=============== %endif %changelog +* Sat Jan 17 2026 Fedora Release Engineering - 1:3.26.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild + * Thu Jan 8 2026 Mark Wielaard - 3.26.0-2 - Add VALGRIND_3_26_BRANCH patches - 0001-Prepare-NEWS-for-branch-3.26-fixes.patch From 108613b01108bc10fa994e1d68be045026a7d5a5 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 26 Jan 2026 18:44:45 +0100 Subject: [PATCH 23/30] 3.26.0-3 - Add more VALGRIND_3_26_BRANCH patches - 0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch - 0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch --- ...sed-leak_summary-still_reachable-tag.patch | 41 +++++++++++++++++ ...tion-sr_isError-sr-failed-mmap-fd-po.patch | 45 +++++++++++++++++++ valgrind.spec | 10 +++++ 3 files changed, 96 insertions(+) create mode 100644 0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch create mode 100644 0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch diff --git a/0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch b/0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch new file mode 100644 index 0000000..9dfa61b --- /dev/null +++ b/0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch @@ -0,0 +1,41 @@ +From 0a95412527ecba22cdb0f96a905a7a5ce45a14bc Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Thu, 15 Jan 2026 08:44:52 +0100 +Subject: [PATCH 7/8] Bug 514613 - Unclosed leak_summary/still_reachable tag in + xml output + +(cherry picked from commit 758b0f55e878fd7bd9dcd1ff3e74f10a7a00a771) +--- + NEWS | 1 + + memcheck/mc_leakcheck.c | 3 ++- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index 28409915e1a1..164218c14e76 100644 +--- a/NEWS ++++ b/NEWS +@@ -23,6 +23,7 @@ The following bugs have been fixed or resolved on this branch. + 511717 gdbserver (valgrind_read_memory) the 'impossible' happened: + Killed by fatal signal (SIGSEGV) + 514094 readlink("/proc/self/exe") overwrites buffer beyond its return value ++514613 Unclosed leak_summary/still_reachable tag in xml output + + To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c +index 586bff448bfb..4df0b180d5d1 100644 +--- a/memcheck/mc_leakcheck.c ++++ b/memcheck/mc_leakcheck.c +@@ -1768,7 +1768,8 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) + umsg_or_xml(VG_(clo_xml) ? + " \n" + " %'lu%s\n" +- " %'lu%s\n" : ++ " %'lu%s\n" ++ " \n" : + " still reachable: %'lu%s bytes in %'lu%s blocks\n", + MC_(bytes_reachable), + DBY (MC_(bytes_reachable), old_bytes_reachable), +-- +2.52.0 + diff --git a/0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch b/0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch new file mode 100644 index 0000000..a895d77 --- /dev/null +++ b/0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch @@ -0,0 +1,45 @@ +From 2ddba5ddc12312386b019b4a785c80ce8633ba57 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Tue, 20 Jan 2026 07:44:31 +0100 +Subject: [PATCH 8/8] Bug 514206 - Assertion '!sr_isError(sr)' failed - mmap fd + points to an open descriptor to a PCI device + +(cherry picked from commit 38609f9b87eb6908a4a04ed5882db337edaec765) +--- + NEWS | 2 ++ + coregrind/m_debuginfo/debuginfo.c | 5 ++++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index 164218c14e76..a09cf7e1bba3 100644 +--- a/NEWS ++++ b/NEWS +@@ -23,6 +23,8 @@ The following bugs have been fixed or resolved on this branch. + 511717 gdbserver (valgrind_read_memory) the 'impossible' happened: + Killed by fatal signal (SIGSEGV) + 514094 readlink("/proc/self/exe") overwrites buffer beyond its return value ++514206 Assertion '!sr_isError(sr)' failed - mmap fd points to an open ++ descriptor to a PCI device + 514613 Unclosed leak_summary/still_reachable tag in xml output + + To see details of a given bug, visit +diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c +index 18152b9e25e4..196fe8d98811 100644 +--- a/coregrind/m_debuginfo/debuginfo.c ++++ b/coregrind/m_debuginfo/debuginfo.c +@@ -1177,8 +1177,11 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd ) + * --20208-- WARNING: Serious error when reading debug info + * --20208-- When reading debug info from /proc/xen/privcmd: + * --20208-- can't read file to inspect ELF header ++ * ++ * Also PCI devices, see bug 514206 + */ +- if (VG_(strncmp)(filename, "/proc/xen/", 10) == 0) ++ if (VG_(strncmp)(filename, "/proc/xen/", 10) == 0 || ++ VG_(strncmp)(filename, "/sys/devices/pci", 16) == 0) + return 0; + + if (debug) +-- +2.52.0 + diff --git a/valgrind.spec b/valgrind.spec index f949b68..9e8cb9f 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -92,6 +92,8 @@ Patch7: 0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch Patch8: 0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch Patch9: 0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch Patch10: 0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch +Patch11: 0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch +Patch12: 0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch BuildRequires: make BuildRequires: glibc-devel @@ -278,6 +280,8 @@ Valgrind User Manual for details. %patch -P8 -p1 %patch -P9 -p1 %patch -P10 -p1 +%patch -P11 -p1 +%patch -P12 -p1 %build # LTO triggers undefined symbols in valgrind. But valgrind has a @@ -518,6 +522,12 @@ echo ===============END TESTING=============== %endif %changelog + +* Mon Jan 26 2026 Mark Wielaard - 3.26.0-3 + - Add more VALGRIND_3_26_BRANCH patches + - 0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch + - 0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch + * Sat Jan 17 2026 Fedora Release Engineering - 1:3.26.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild From bfbac831c1f41ccec54db7b030ac99e58699c551 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 26 Jan 2026 19:15:57 +0100 Subject: [PATCH 24/30] 3.26.0-4 --- valgrind.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/valgrind.spec b/valgrind.spec index 9e8cb9f..e9ea8c3 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.26.0 -Release: 3%{?dist} +Release: 4%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -523,7 +523,7 @@ echo ===============END TESTING=============== %changelog -* Mon Jan 26 2026 Mark Wielaard - 3.26.0-3 +* Mon Jan 26 2026 Mark Wielaard - 3.26.0-4 - Add more VALGRIND_3_26_BRANCH patches - 0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch - 0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch From c84b5d90fd0adb3d34763cb70dfbb58f3f7072e5 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 29 Jan 2026 12:59:20 +0100 Subject: [PATCH 25/30] 3.26.0-5 - Add 0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch --- ...hable-xml-closing-tag-and-add-testca.patch | 352 ++++++++++++++++++ valgrind.spec | 9 +- 2 files changed, 360 insertions(+), 1 deletion(-) create mode 100644 0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch diff --git a/0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch b/0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch new file mode 100644 index 0000000..e773946 --- /dev/null +++ b/0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch @@ -0,0 +1,352 @@ +From a4e37741625163fe3e9fde5f21dc4d3e9167fd9a Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Thu, 29 Jan 2026 12:18:08 +0100 +Subject: [PATCH] Refix still_reachable xml closing tag and add testcases + +https://bugs.kde.org/show_bug.cgi?id=514613 +--- + memcheck/mc_leakcheck.c | 16 ++-- + memcheck/tests/Makefile.am | 14 ++- + memcheck/tests/nothing.c | 5 ++ + memcheck/tests/nothing_xml.stderr.exp | 0 + memcheck/tests/nothing_xml.vgtest | 4 + + memcheck/tests/simple_leak.c | 10 +++ + memcheck/tests/simple_leak_xml.stderr.exp | 0 + memcheck/tests/simple_leak_xml.vgtest | 4 + + memcheck/tests/simple_reachable.c | 9 ++ + .../tests/simple_reachable_xml.stderr.exp | 0 + memcheck/tests/simple_reachable_xml.vgtest | 4 + + memcheck/tests/xmas_tree.cpp | 90 +++++++++++++++++++ + memcheck/tests/xmas_tree_xml.stderr.exp | 0 + memcheck/tests/xmas_tree_xml.supp | 7 ++ + memcheck/tests/xmas_tree_xml.vgtest | 4 + + 16 files changed, 162 insertions(+), 9 deletions(-) + create mode 100644 memcheck/tests/nothing.c + create mode 100644 memcheck/tests/nothing_xml.stderr.exp + create mode 100644 memcheck/tests/nothing_xml.vgtest + create mode 100644 memcheck/tests/simple_leak.c + create mode 100644 memcheck/tests/simple_leak_xml.stderr.exp + create mode 100644 memcheck/tests/simple_leak_xml.vgtest + create mode 100644 memcheck/tests/simple_reachable.c + create mode 100644 memcheck/tests/simple_reachable_xml.stderr.exp + create mode 100644 memcheck/tests/simple_reachable_xml.vgtest + create mode 100644 memcheck/tests/xmas_tree.cpp + create mode 100644 memcheck/tests/xmas_tree_xml.stderr.exp + create mode 100644 memcheck/tests/xmas_tree_xml.supp + create mode 100644 memcheck/tests/xmas_tree_xml.vgtest + +diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c +index 4df0b180d5d1..b0056b65bd3e 100644 +--- a/memcheck/mc_leakcheck.c ++++ b/memcheck/mc_leakcheck.c +@@ -1768,23 +1768,23 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) + umsg_or_xml(VG_(clo_xml) ? + " \n" + " %'lu%s\n" +- " %'lu%s\n" +- " \n" : ++ " %'lu%s\n" : + " still reachable: %'lu%s bytes in %'lu%s blocks\n", + MC_(bytes_reachable), + DBY (MC_(bytes_reachable), old_bytes_reachable), + MC_(blocks_reachable), + DBL (MC_(blocks_reachable), old_blocks_reachable)); +- for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++) ++ for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++) { + if (old_blocks_heuristically_reachable[i] > 0 + || MC_(blocks_heuristically_reachable)[i] > 0) { + umsg_or_xml(VG_(clo_xml) ? "" : " of which " + "reachable via heuristic:\n"); + break; + } +- for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++) +- if (old_blocks_heuristically_reachable[i] > 0 +- || MC_(blocks_heuristically_reachable)[i] > 0) ++ } ++ for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++) { ++ if (old_blocks_heuristically_reachable[i] > 0 ++ || MC_(blocks_heuristically_reachable)[i] > 0) { + umsg_or_xml(VG_(clo_xml) ? + " \n" + " %ls\n" +@@ -1800,7 +1800,9 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) + MC_(blocks_heuristically_reachable)[i], + DBL (MC_(blocks_heuristically_reachable)[i], + old_blocks_heuristically_reachable[i])); +- if (VG_(clo_xml) && MC_(bytes_reachable)) { ++ } ++ } ++ if (VG_(clo_xml)) { + umsg_or_xml(" \n"); + } + umsg_or_xml(VG_(clo_xml) ? +diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am +index 4bdca487aa51..c8469f1265cb 100644 +--- a/memcheck/tests/Makefile.am ++++ b/memcheck/tests/Makefile.am +@@ -307,6 +307,7 @@ EXTRA_DIST = \ + new_nothrow.stderr.exp new_nothrow.vgtest \ + new_override.stderr.exp new_override.stdout.exp new_override.vgtest \ + noisy_child.vgtest noisy_child.stderr.exp noisy_child.stdout.exp \ ++ nothing_xml.vgtest nothing_xml.stderr.exp \ + null_socket.stderr.exp null_socket.vgtest \ + origin1-yes.vgtest origin1-yes.stdout.exp origin1-yes.stderr.exp \ + origin1-yes.stderr.exp-freebsd \ +@@ -403,6 +404,8 @@ EXTRA_DIST = \ + sigkill.stderr.exp-glibc-2.28 sigkill.vgtest \ + signal2.stderr.exp signal2.stdout.exp signal2.vgtest \ + sigprocmask.stderr.exp sigprocmask.stderr.exp2 sigprocmask.vgtest \ ++ simple_leak_xml.vgtest simple_reachable_xml.vgtest \ ++ simple_leak_xml.stderr.exp simple_reachable_xml.stderr.exp \ + sized_delete.stderr.exp sized_delete.stderr.exp-x86 sized_delete.vgtest \ + static_malloc.stderr.exp static_malloc.vgtest \ + stpncpy.vgtest stpncpy.stderr.exp stpncpy.stdout.exp \ +@@ -478,6 +481,7 @@ EXTRA_DIST = \ + wrapmallocstatic.vgtest wrapmallocstatic.stdout.exp \ + wrapmallocstatic.stderr.exp \ + writev1.stderr.exp writev1.stderr.exp-solaris writev1.vgtest \ ++ xmas_tree_xml.vgtest xmas_tree_xml.supp xmas_tree_xml.stderr.exp \ + xml1.stderr.exp xml1.stdout.exp xml1.vgtest xml1.stderr.exp-s390x-mvc + + check_PROGRAMS = \ +@@ -539,6 +543,7 @@ check_PROGRAMS = \ + mismatches new_override metadata \ + nanoleak_supp nanoleak2 new_nothrow \ + noisy_child \ ++ nothing \ + null_socket \ + origin1-yes origin2-not-quite origin3-no \ + origin4-many origin5-bz2 origin6-fp \ +@@ -556,7 +561,9 @@ check_PROGRAMS = \ + sbfragment \ + sendmsg \ + sh-mem sh-mem-random \ +- sigaltstack signal2 sigprocmask static_malloc sigkill \ ++ sigaltstack signal2 sigprocmask \ ++ simple_leak simple_reachable \ ++ static_malloc sigkill \ + strchr \ + str_tester \ + supp_unknown supp1 supp2 suppfree \ +@@ -575,7 +582,8 @@ check_PROGRAMS = \ + wmemcmp \ + wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \ + wrapmalloc wrapmallocso.so wrapmallocstatic \ +- writev1 ++ writev1 \ ++ xmas_tree + + if !SOLARIS_SUN_STUDIO_AS + # Sun Studio assembler fails on "IDENT too long" +@@ -950,3 +958,5 @@ endif + writev1_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_STRINGOP_OVERFLOW@ @FLAG_W_NO_STRINGOP_OVERREAD@ + xml1_CFLAGS = $(AM_CFLAGS) -D_GNU_SOURCE @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ + ++xmas_tree_SOURCES = xmas_tree.cpp ++xmas_tree_CXXFLAGS = ${AM_CXXFLAGS} @FLAG_W_NO_UNINITIALIZED@ +diff --git a/memcheck/tests/nothing.c b/memcheck/tests/nothing.c +new file mode 100644 +index 000000000000..2e424a58ded8 +--- /dev/null ++++ b/memcheck/tests/nothing.c +@@ -0,0 +1,5 @@ ++/* no errors, except Darwin */ ++int main() ++{ ++} ++ +diff --git a/memcheck/tests/nothing_xml.stderr.exp b/memcheck/tests/nothing_xml.stderr.exp +new file mode 100644 +index 000000000000..e69de29bb2d1 +diff --git a/memcheck/tests/nothing_xml.vgtest b/memcheck/tests/nothing_xml.vgtest +new file mode 100644 +index 000000000000..db2eca402af1 +--- /dev/null ++++ b/memcheck/tests/nothing_xml.vgtest +@@ -0,0 +1,4 @@ ++prereq: which xmllint > /dev/null ++prog: nothing ++args: | xmllint --noout - ++vgopts: --xml=yes --xml-fd=1 +diff --git a/memcheck/tests/simple_leak.c b/memcheck/tests/simple_leak.c +new file mode 100644 +index 000000000000..b94dade4c24c +--- /dev/null ++++ b/memcheck/tests/simple_leak.c +@@ -0,0 +1,10 @@ ++#include ++ ++static void *p; ++ ++int main () ++{ ++ p = malloc (1024); ++ p = NULL; ++} ++ +diff --git a/memcheck/tests/simple_leak_xml.stderr.exp b/memcheck/tests/simple_leak_xml.stderr.exp +new file mode 100644 +index 000000000000..e69de29bb2d1 +diff --git a/memcheck/tests/simple_leak_xml.vgtest b/memcheck/tests/simple_leak_xml.vgtest +new file mode 100644 +index 000000000000..9652b32764b8 +--- /dev/null ++++ b/memcheck/tests/simple_leak_xml.vgtest +@@ -0,0 +1,4 @@ ++prereq: which xmllint > /dev/null ++prog: simple_leak ++args: | xmllint --noout - ++vgopts: --xml=yes --xml-fd=1 +diff --git a/memcheck/tests/simple_reachable.c b/memcheck/tests/simple_reachable.c +new file mode 100644 +index 000000000000..4fe1adaf4556 +--- /dev/null ++++ b/memcheck/tests/simple_reachable.c +@@ -0,0 +1,9 @@ ++#include ++ ++static void *p; ++ ++int main () ++{ ++ p = malloc (1024); ++} ++ +diff --git a/memcheck/tests/simple_reachable_xml.stderr.exp b/memcheck/tests/simple_reachable_xml.stderr.exp +new file mode 100644 +index 000000000000..e69de29bb2d1 +diff --git a/memcheck/tests/simple_reachable_xml.vgtest b/memcheck/tests/simple_reachable_xml.vgtest +new file mode 100644 +index 000000000000..a64cb2ac5d69 +--- /dev/null ++++ b/memcheck/tests/simple_reachable_xml.vgtest +@@ -0,0 +1,4 @@ ++prereq: which xmllint > /dev/null ++prog: simple_reachable ++args: | xmllint --noout - ++vgopts: --xml=yes --xml-fd=1 +diff --git a/memcheck/tests/xmas_tree.cpp b/memcheck/tests/xmas_tree.cpp +new file mode 100644 +index 000000000000..680833b46dac +--- /dev/null ++++ b/memcheck/tests/xmas_tree.cpp +@@ -0,0 +1,90 @@ ++#include ++#include ++#include ++#include ++#include "../memcheck.h" ++ ++struct Ae ++{ ++ virtual ~Ae() ++ { ++ } ++}; ++struct Be ++{ ++ virtual ~Be() ++ { ++ } ++}; ++struct Ce : public Ae, public Be ++{ ++ virtual ~Ce() ++ { ++ } ++}; ++ ++void* reachable; ++Be *interior; ++ ++int suppress_me() ++{ ++ int qqq; ++ if (qqq) ++ return 2; ++ return 1; ++} ++ ++int main() ++{ ++ std::align_val_t misalign(static_cast(63U)); ++ std::align_val_t align(static_cast(64U)); ++ std::align_val_t align2(static_cast(32U)); ++ std::size_t size(32); ++ std::size_t badsize(42); ++ std::nothrow_t tag; ++ int count{0}; ++ ++ char *mem = static_cast(operator new[](size, tag)); ++ if (mem[31]) ++ ++count; ++ if (mem[32]) ++ ++count; ++ operator delete(mem, misalign, tag); ++ ++ mem = static_cast(operator new(size, align, tag)); ++ operator delete(mem, align2, tag); ++ ++ mem = static_cast(malloc(20)); ++ mem = static_cast(realloc(mem, 0)); ++ delete mem; ++ ++ mem = static_cast(operator new[](size)); ++ memcpy(mem+10, mem+5, 10); ++ operator delete[](mem, badsize); ++ ++ mem = static_cast(malloc(-1)); ++ ++ int fd{42}; ++ int bad; ++ fd += bad; ++ fd -= bad; ++ char* buf{nullptr}; ++ ++buf; ++ write(fd, buf, fd); ++ ++ int zzz; ++ VALGRIND_CHECK_MEM_IS_DEFINED(&zzz, 4); ++ ++ reachable = malloc(10); ++ mem = static_cast(malloc(20)); ++ ++ char* indirect = static_cast(malloc(30)); ++ memcpy(&mem[8], &indirect, sizeof(indirect)); ++ mem = nullptr; ++ ++ count += suppress_me(); ++ ++ interior = new Ce; // interior ptr. ++ ++ return count; ++} +diff --git a/memcheck/tests/xmas_tree_xml.stderr.exp b/memcheck/tests/xmas_tree_xml.stderr.exp +new file mode 100644 +index 000000000000..e69de29bb2d1 +diff --git a/memcheck/tests/xmas_tree_xml.supp b/memcheck/tests/xmas_tree_xml.supp +new file mode 100644 +index 000000000000..2643371609d3 +--- /dev/null ++++ b/memcheck/tests/xmas_tree_xml.supp +@@ -0,0 +1,7 @@ ++{ ++ Hello, suppression World! ++ Memcheck:Cond ++ fun:_Z11suppress_mev ++ fun:main ++} ++ +diff --git a/memcheck/tests/xmas_tree_xml.vgtest b/memcheck/tests/xmas_tree_xml.vgtest +new file mode 100644 +index 000000000000..5061ad12a466 +--- /dev/null ++++ b/memcheck/tests/xmas_tree_xml.vgtest +@@ -0,0 +1,4 @@ ++prereq: which xmllint > /dev/null ++prog: xmas_tree ++args: | xmllint --noout - ++vgopts: --xml=yes --xml-fd=1 --leak-check=full --suppressions=xmas_tree_xml.supp --leak-check-heuristics=multipleinheritance +-- +2.52.0 + diff --git a/valgrind.spec b/valgrind.spec index e9ea8c3..110d1a5 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.26.0 -Release: 4%{?dist} +Release: 5%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -95,6 +95,9 @@ Patch10: 0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch Patch11: 0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch Patch12: 0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch +# Refix for https://bugs.kde.org/show_bug.cgi?id=514613 +Patch100: 0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch + BuildRequires: make BuildRequires: glibc-devel @@ -283,6 +286,8 @@ Valgrind User Manual for details. %patch -P11 -p1 %patch -P12 -p1 +%patch -P100 -p1 + %build # LTO triggers undefined symbols in valgrind. But valgrind has a # --enable-lto configure time option that we will use instead. @@ -522,6 +527,8 @@ echo ===============END TESTING=============== %endif %changelog +* Thu Jan 29 2026 Mark Wielaard - 3.26.0-5 + - Add 0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch * Mon Jan 26 2026 Mark Wielaard - 3.26.0-4 - Add more VALGRIND_3_26_BRANCH patches From e0da26d095ebc69fc0923c39c3445a3e0ef7d964 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 14 Apr 2026 03:44:18 +0200 Subject: [PATCH 26/30] 3.27.0-0.1.RC1 - Upstream 3.27.0-RC1 - Remove all VALGRIND_3_26_BRANCH and proposed upstream patches --- .gitignore | 1 + 0001-Prepare-NEWS-for-branch-3.26-fixes.patch | 32 -- ...hable-xml-closing-tag-and-add-testca.patch | 352 ------------ ...ind-3.26.0-tests-fail-to-build-on-up.patch | 125 ----- ...lf-exe-overwrites-buffer-beyond-its-.patch | 520 ------------------ ...ssion-add-an-entry-for-__is_decorate.patch | 46 -- ...dd-a-suppression-for-_dl_allocate_tl.patch | 30 - ...ble-linux-madvise-MADV_GUARD_INSTALL.patch | 95 ---- ...sed-leak_summary-still_reachable-tag.patch | 41 -- ...tion-sr_isError-sr-failed-mmap-fd-po.patch | 45 -- sources | 2 +- valgrind-3.26.0-some-stack-protector.patch | 4 +- valgrind.spec | 36 +- 13 files changed, 12 insertions(+), 1317 deletions(-) delete mode 100644 0001-Prepare-NEWS-for-branch-3.26-fixes.patch delete mode 100644 0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch delete mode 100644 0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch delete mode 100644 0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch delete mode 100644 0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch delete mode 100644 0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch delete mode 100644 0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch delete mode 100644 0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch delete mode 100644 0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch diff --git a/.gitignore b/.gitignore index fb83280..15d202f 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ /valgrind-3.25.1.tar.bz2 /valgrind-3.26.0.RC1.tar.bz2 /valgrind-3.26.0.tar.bz2 +/valgrind-3.27.0.RC1.tar.bz2 diff --git a/0001-Prepare-NEWS-for-branch-3.26-fixes.patch b/0001-Prepare-NEWS-for-branch-3.26-fixes.patch deleted file mode 100644 index 67adb1d..0000000 --- a/0001-Prepare-NEWS-for-branch-3.26-fixes.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0f4968e8aaaacbb9700c09d88b20a195118f6ae4 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Wed, 7 Jan 2026 15:11:59 +0100 -Subject: [PATCH 1/6] Prepare NEWS for branch 3.26 fixes - ---- - NEWS | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/NEWS b/NEWS -index fdeebfaead90..d176b0aa2ebe 100644 ---- a/NEWS -+++ b/NEWS -@@ -1,3 +1,15 @@ -+Branch 3.26 -+~~~~~~~~~~~ -+ -+* ==================== FIXED BUGS ==================== -+ -+The following bugs have been fixed or resolved on this branch. -+ -+To see details of a given bug, visit -+ https://bugs.kde.org/show_bug.cgi?id=XXXXXX -+where XXXXXX is the bug number as listed above. -+ -+ - Release 3.26.0 (24 Oct 2025) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - --- -2.52.0 - diff --git a/0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch b/0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch deleted file mode 100644 index e773946..0000000 --- a/0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch +++ /dev/null @@ -1,352 +0,0 @@ -From a4e37741625163fe3e9fde5f21dc4d3e9167fd9a Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Thu, 29 Jan 2026 12:18:08 +0100 -Subject: [PATCH] Refix still_reachable xml closing tag and add testcases - -https://bugs.kde.org/show_bug.cgi?id=514613 ---- - memcheck/mc_leakcheck.c | 16 ++-- - memcheck/tests/Makefile.am | 14 ++- - memcheck/tests/nothing.c | 5 ++ - memcheck/tests/nothing_xml.stderr.exp | 0 - memcheck/tests/nothing_xml.vgtest | 4 + - memcheck/tests/simple_leak.c | 10 +++ - memcheck/tests/simple_leak_xml.stderr.exp | 0 - memcheck/tests/simple_leak_xml.vgtest | 4 + - memcheck/tests/simple_reachable.c | 9 ++ - .../tests/simple_reachable_xml.stderr.exp | 0 - memcheck/tests/simple_reachable_xml.vgtest | 4 + - memcheck/tests/xmas_tree.cpp | 90 +++++++++++++++++++ - memcheck/tests/xmas_tree_xml.stderr.exp | 0 - memcheck/tests/xmas_tree_xml.supp | 7 ++ - memcheck/tests/xmas_tree_xml.vgtest | 4 + - 16 files changed, 162 insertions(+), 9 deletions(-) - create mode 100644 memcheck/tests/nothing.c - create mode 100644 memcheck/tests/nothing_xml.stderr.exp - create mode 100644 memcheck/tests/nothing_xml.vgtest - create mode 100644 memcheck/tests/simple_leak.c - create mode 100644 memcheck/tests/simple_leak_xml.stderr.exp - create mode 100644 memcheck/tests/simple_leak_xml.vgtest - create mode 100644 memcheck/tests/simple_reachable.c - create mode 100644 memcheck/tests/simple_reachable_xml.stderr.exp - create mode 100644 memcheck/tests/simple_reachable_xml.vgtest - create mode 100644 memcheck/tests/xmas_tree.cpp - create mode 100644 memcheck/tests/xmas_tree_xml.stderr.exp - create mode 100644 memcheck/tests/xmas_tree_xml.supp - create mode 100644 memcheck/tests/xmas_tree_xml.vgtest - -diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c -index 4df0b180d5d1..b0056b65bd3e 100644 ---- a/memcheck/mc_leakcheck.c -+++ b/memcheck/mc_leakcheck.c -@@ -1768,23 +1768,23 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) - umsg_or_xml(VG_(clo_xml) ? - " \n" - " %'lu%s\n" -- " %'lu%s\n" -- " \n" : -+ " %'lu%s\n" : - " still reachable: %'lu%s bytes in %'lu%s blocks\n", - MC_(bytes_reachable), - DBY (MC_(bytes_reachable), old_bytes_reachable), - MC_(blocks_reachable), - DBL (MC_(blocks_reachable), old_blocks_reachable)); -- for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++) -+ for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++) { - if (old_blocks_heuristically_reachable[i] > 0 - || MC_(blocks_heuristically_reachable)[i] > 0) { - umsg_or_xml(VG_(clo_xml) ? "" : " of which " - "reachable via heuristic:\n"); - break; - } -- for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++) -- if (old_blocks_heuristically_reachable[i] > 0 -- || MC_(blocks_heuristically_reachable)[i] > 0) -+ } -+ for (i = 0; i < N_LEAK_CHECK_HEURISTICS; i++) { -+ if (old_blocks_heuristically_reachable[i] > 0 -+ || MC_(blocks_heuristically_reachable)[i] > 0) { - umsg_or_xml(VG_(clo_xml) ? - " \n" - " %ls\n" -@@ -1800,7 +1800,9 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) - MC_(blocks_heuristically_reachable)[i], - DBL (MC_(blocks_heuristically_reachable)[i], - old_blocks_heuristically_reachable[i])); -- if (VG_(clo_xml) && MC_(bytes_reachable)) { -+ } -+ } -+ if (VG_(clo_xml)) { - umsg_or_xml(" \n"); - } - umsg_or_xml(VG_(clo_xml) ? -diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am -index 4bdca487aa51..c8469f1265cb 100644 ---- a/memcheck/tests/Makefile.am -+++ b/memcheck/tests/Makefile.am -@@ -307,6 +307,7 @@ EXTRA_DIST = \ - new_nothrow.stderr.exp new_nothrow.vgtest \ - new_override.stderr.exp new_override.stdout.exp new_override.vgtest \ - noisy_child.vgtest noisy_child.stderr.exp noisy_child.stdout.exp \ -+ nothing_xml.vgtest nothing_xml.stderr.exp \ - null_socket.stderr.exp null_socket.vgtest \ - origin1-yes.vgtest origin1-yes.stdout.exp origin1-yes.stderr.exp \ - origin1-yes.stderr.exp-freebsd \ -@@ -403,6 +404,8 @@ EXTRA_DIST = \ - sigkill.stderr.exp-glibc-2.28 sigkill.vgtest \ - signal2.stderr.exp signal2.stdout.exp signal2.vgtest \ - sigprocmask.stderr.exp sigprocmask.stderr.exp2 sigprocmask.vgtest \ -+ simple_leak_xml.vgtest simple_reachable_xml.vgtest \ -+ simple_leak_xml.stderr.exp simple_reachable_xml.stderr.exp \ - sized_delete.stderr.exp sized_delete.stderr.exp-x86 sized_delete.vgtest \ - static_malloc.stderr.exp static_malloc.vgtest \ - stpncpy.vgtest stpncpy.stderr.exp stpncpy.stdout.exp \ -@@ -478,6 +481,7 @@ EXTRA_DIST = \ - wrapmallocstatic.vgtest wrapmallocstatic.stdout.exp \ - wrapmallocstatic.stderr.exp \ - writev1.stderr.exp writev1.stderr.exp-solaris writev1.vgtest \ -+ xmas_tree_xml.vgtest xmas_tree_xml.supp xmas_tree_xml.stderr.exp \ - xml1.stderr.exp xml1.stdout.exp xml1.vgtest xml1.stderr.exp-s390x-mvc - - check_PROGRAMS = \ -@@ -539,6 +543,7 @@ check_PROGRAMS = \ - mismatches new_override metadata \ - nanoleak_supp nanoleak2 new_nothrow \ - noisy_child \ -+ nothing \ - null_socket \ - origin1-yes origin2-not-quite origin3-no \ - origin4-many origin5-bz2 origin6-fp \ -@@ -556,7 +561,9 @@ check_PROGRAMS = \ - sbfragment \ - sendmsg \ - sh-mem sh-mem-random \ -- sigaltstack signal2 sigprocmask static_malloc sigkill \ -+ sigaltstack signal2 sigprocmask \ -+ simple_leak simple_reachable \ -+ static_malloc sigkill \ - strchr \ - str_tester \ - supp_unknown supp1 supp2 suppfree \ -@@ -575,7 +582,8 @@ check_PROGRAMS = \ - wmemcmp \ - wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \ - wrapmalloc wrapmallocso.so wrapmallocstatic \ -- writev1 -+ writev1 \ -+ xmas_tree - - if !SOLARIS_SUN_STUDIO_AS - # Sun Studio assembler fails on "IDENT too long" -@@ -950,3 +958,5 @@ endif - writev1_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_STRINGOP_OVERFLOW@ @FLAG_W_NO_STRINGOP_OVERREAD@ - xml1_CFLAGS = $(AM_CFLAGS) -D_GNU_SOURCE @FLAG_W_NO_UNINITIALIZED@ @FLAG_W_NO_USE_AFTER_FREE@ - -+xmas_tree_SOURCES = xmas_tree.cpp -+xmas_tree_CXXFLAGS = ${AM_CXXFLAGS} @FLAG_W_NO_UNINITIALIZED@ -diff --git a/memcheck/tests/nothing.c b/memcheck/tests/nothing.c -new file mode 100644 -index 000000000000..2e424a58ded8 ---- /dev/null -+++ b/memcheck/tests/nothing.c -@@ -0,0 +1,5 @@ -+/* no errors, except Darwin */ -+int main() -+{ -+} -+ -diff --git a/memcheck/tests/nothing_xml.stderr.exp b/memcheck/tests/nothing_xml.stderr.exp -new file mode 100644 -index 000000000000..e69de29bb2d1 -diff --git a/memcheck/tests/nothing_xml.vgtest b/memcheck/tests/nothing_xml.vgtest -new file mode 100644 -index 000000000000..db2eca402af1 ---- /dev/null -+++ b/memcheck/tests/nothing_xml.vgtest -@@ -0,0 +1,4 @@ -+prereq: which xmllint > /dev/null -+prog: nothing -+args: | xmllint --noout - -+vgopts: --xml=yes --xml-fd=1 -diff --git a/memcheck/tests/simple_leak.c b/memcheck/tests/simple_leak.c -new file mode 100644 -index 000000000000..b94dade4c24c ---- /dev/null -+++ b/memcheck/tests/simple_leak.c -@@ -0,0 +1,10 @@ -+#include -+ -+static void *p; -+ -+int main () -+{ -+ p = malloc (1024); -+ p = NULL; -+} -+ -diff --git a/memcheck/tests/simple_leak_xml.stderr.exp b/memcheck/tests/simple_leak_xml.stderr.exp -new file mode 100644 -index 000000000000..e69de29bb2d1 -diff --git a/memcheck/tests/simple_leak_xml.vgtest b/memcheck/tests/simple_leak_xml.vgtest -new file mode 100644 -index 000000000000..9652b32764b8 ---- /dev/null -+++ b/memcheck/tests/simple_leak_xml.vgtest -@@ -0,0 +1,4 @@ -+prereq: which xmllint > /dev/null -+prog: simple_leak -+args: | xmllint --noout - -+vgopts: --xml=yes --xml-fd=1 -diff --git a/memcheck/tests/simple_reachable.c b/memcheck/tests/simple_reachable.c -new file mode 100644 -index 000000000000..4fe1adaf4556 ---- /dev/null -+++ b/memcheck/tests/simple_reachable.c -@@ -0,0 +1,9 @@ -+#include -+ -+static void *p; -+ -+int main () -+{ -+ p = malloc (1024); -+} -+ -diff --git a/memcheck/tests/simple_reachable_xml.stderr.exp b/memcheck/tests/simple_reachable_xml.stderr.exp -new file mode 100644 -index 000000000000..e69de29bb2d1 -diff --git a/memcheck/tests/simple_reachable_xml.vgtest b/memcheck/tests/simple_reachable_xml.vgtest -new file mode 100644 -index 000000000000..a64cb2ac5d69 ---- /dev/null -+++ b/memcheck/tests/simple_reachable_xml.vgtest -@@ -0,0 +1,4 @@ -+prereq: which xmllint > /dev/null -+prog: simple_reachable -+args: | xmllint --noout - -+vgopts: --xml=yes --xml-fd=1 -diff --git a/memcheck/tests/xmas_tree.cpp b/memcheck/tests/xmas_tree.cpp -new file mode 100644 -index 000000000000..680833b46dac ---- /dev/null -+++ b/memcheck/tests/xmas_tree.cpp -@@ -0,0 +1,90 @@ -+#include -+#include -+#include -+#include -+#include "../memcheck.h" -+ -+struct Ae -+{ -+ virtual ~Ae() -+ { -+ } -+}; -+struct Be -+{ -+ virtual ~Be() -+ { -+ } -+}; -+struct Ce : public Ae, public Be -+{ -+ virtual ~Ce() -+ { -+ } -+}; -+ -+void* reachable; -+Be *interior; -+ -+int suppress_me() -+{ -+ int qqq; -+ if (qqq) -+ return 2; -+ return 1; -+} -+ -+int main() -+{ -+ std::align_val_t misalign(static_cast(63U)); -+ std::align_val_t align(static_cast(64U)); -+ std::align_val_t align2(static_cast(32U)); -+ std::size_t size(32); -+ std::size_t badsize(42); -+ std::nothrow_t tag; -+ int count{0}; -+ -+ char *mem = static_cast(operator new[](size, tag)); -+ if (mem[31]) -+ ++count; -+ if (mem[32]) -+ ++count; -+ operator delete(mem, misalign, tag); -+ -+ mem = static_cast(operator new(size, align, tag)); -+ operator delete(mem, align2, tag); -+ -+ mem = static_cast(malloc(20)); -+ mem = static_cast(realloc(mem, 0)); -+ delete mem; -+ -+ mem = static_cast(operator new[](size)); -+ memcpy(mem+10, mem+5, 10); -+ operator delete[](mem, badsize); -+ -+ mem = static_cast(malloc(-1)); -+ -+ int fd{42}; -+ int bad; -+ fd += bad; -+ fd -= bad; -+ char* buf{nullptr}; -+ ++buf; -+ write(fd, buf, fd); -+ -+ int zzz; -+ VALGRIND_CHECK_MEM_IS_DEFINED(&zzz, 4); -+ -+ reachable = malloc(10); -+ mem = static_cast(malloc(20)); -+ -+ char* indirect = static_cast(malloc(30)); -+ memcpy(&mem[8], &indirect, sizeof(indirect)); -+ mem = nullptr; -+ -+ count += suppress_me(); -+ -+ interior = new Ce; // interior ptr. -+ -+ return count; -+} -diff --git a/memcheck/tests/xmas_tree_xml.stderr.exp b/memcheck/tests/xmas_tree_xml.stderr.exp -new file mode 100644 -index 000000000000..e69de29bb2d1 -diff --git a/memcheck/tests/xmas_tree_xml.supp b/memcheck/tests/xmas_tree_xml.supp -new file mode 100644 -index 000000000000..2643371609d3 ---- /dev/null -+++ b/memcheck/tests/xmas_tree_xml.supp -@@ -0,0 +1,7 @@ -+{ -+ Hello, suppression World! -+ Memcheck:Cond -+ fun:_Z11suppress_mev -+ fun:main -+} -+ -diff --git a/memcheck/tests/xmas_tree_xml.vgtest b/memcheck/tests/xmas_tree_xml.vgtest -new file mode 100644 -index 000000000000..5061ad12a466 ---- /dev/null -+++ b/memcheck/tests/xmas_tree_xml.vgtest -@@ -0,0 +1,4 @@ -+prereq: which xmllint > /dev/null -+prog: xmas_tree -+args: | xmllint --noout - -+vgopts: --xml=yes --xml-fd=1 --leak-check=full --suppressions=xmas_tree_xml.supp --leak-check-heuristics=multipleinheritance --- -2.52.0 - diff --git a/0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch b/0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch deleted file mode 100644 index e20bb92..0000000 --- a/0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch +++ /dev/null @@ -1,125 +0,0 @@ -From fc9cf49c2f2e0e2282b000557df80ce2f755f191 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Wed, 12 Nov 2025 21:46:23 +0100 -Subject: [PATCH 2/6] Bug 511972 - valgrind-3.26.0 tests fail to build on - upcomig gcc-16: unrecognized command-line option - '-Wno-alloc-size-larger-than=18446744073709551615' - -Initial patch from Sergei Trofimovich, thanks. - -(cherry picked from commit 51c5973d9d1f096b9472df75638f2a53324fafed) ---- - NEWS | 4 ++++ - configure.ac | 4 ++-- - memcheck/tests/Makefile.am | 8 ++++---- - memcheck/tests/amd64-freebsd/Makefile.am | 2 +- - memcheck/tests/amd64-linux/Makefile.am | 2 +- - memcheck/tests/x86-freebsd/Makefile.am | 2 +- - 6 files changed, 13 insertions(+), 9 deletions(-) - -diff --git a/NEWS b/NEWS -index d176b0aa2ebe..4e6cb3de9125 100644 ---- a/NEWS -+++ b/NEWS -@@ -5,6 +5,10 @@ Branch 3.26 - - The following bugs have been fixed or resolved on this branch. - -+511972 valgrind-3.26.0 tests fail to build on upcomig gcc-16: -+ unrecognized command-line option -+ '-Wno-alloc-size-larger-than=18446744073709551615' -+ - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX - where XXXXXX is the bug number as listed above. -diff --git a/configure.ac b/configure.ac -index 371dcf235c7d..9d62a7d27a2c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -2538,7 +2538,7 @@ fi - AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[ - AC_MSG_CHECKING([if gcc accepts -W$1]) - safe_CFLAGS=$CFLAGS -- CFLAGS="-W$1 -Werror" -+ CFLAGS="-W$1 -Wno-$1 -Werror" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [ - AC_SUBST([$2], [-Wno-$1]) - AC_MSG_RESULT([yes])], [ -@@ -2591,7 +2591,6 @@ AC_GCC_WARNING_SUBST_NO([unused-result], [FLAG_W_NO_UNUSED_RESULT]) - AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION]) - AC_GCC_WARNING_SUBST_NO([deprecated], [FLAG_W_NO_DEPRECATED]) - # OK for 32 and 64 bit --AC_GCC_WARNING_SUBST_NO([alloc-size-larger-than=18446744073709551615], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN]) - AC_GCC_WARNING_SUBST_NO([alloc-size], [FLAG_W_NO_ALLOC_SIZE]) - - AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS]) -@@ -2605,6 +2604,7 @@ AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE]) - AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP]) - AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION]) - AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH]) -+AC_GCC_WARNING_SUBST([alloc-size-larger-than=18446744073709551616], [FLAG_W_ALLOC_SIZE_LARGER_THAN]) - - # as above, C++ flags - AC_DEFUN([AC_GXX_WARNING_SUBST_NO],[ -diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am -index 920f262a68cf..4bdca487aa51 100644 ---- a/memcheck/tests/Makefile.am -+++ b/memcheck/tests/Makefile.am -@@ -689,18 +689,18 @@ leak_cpp_interior_SOURCES = leak_cpp_interior.cpp - - # Suppress various gcc warnings which are correct, but for things - # we are actually testing for at runtime. --accounting_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ -+accounting_CFLAGS = $(AM_CFLAGS) @FLAG_W_ALLOC_SIZE_LARGER_THAN@ - badfree_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_FREE_NONHEAP_OBJECT@ --bug155125_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNUSED_RESULT@ @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ -+bug155125_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNUSED_RESULT@ @FLAG_W_ALLOC_SIZE_LARGER_THAN@ - bug472219_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ --calloc_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ -+calloc_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_ALLOC_SIZE_LARGER_THAN@ - malloc_usable_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@ - mallinfo_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations - if VGCONF_OS_IS_SOLARIS - mallinfo_LDADD = -lmalloc - endif - mallinfo2_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations --malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ @FLAG_W_NO_ALLOC_SIZE@ -+malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_ALLOC_SIZE_LARGER_THAN@ @FLAG_W_NO_ALLOC_SIZE@ - sbfragment_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations - if VGCONF_OS_IS_SOLARIS - sbfragment_LDADD = -lmalloc -diff --git a/memcheck/tests/amd64-freebsd/Makefile.am b/memcheck/tests/amd64-freebsd/Makefile.am -index 378446d4cf45..1eff95fce3b7 100644 ---- a/memcheck/tests/amd64-freebsd/Makefile.am -+++ b/memcheck/tests/amd64-freebsd/Makefile.am -@@ -24,5 +24,5 @@ AM_CCASFLAGS += @FLAG_M64@ - - posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ - posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ --reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ -+reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_ALLOC_SIZE_LARGER_THAN@ - -diff --git a/memcheck/tests/amd64-linux/Makefile.am b/memcheck/tests/amd64-linux/Makefile.am -index a3b5df5a6742..69a84ffdfc8f 100644 ---- a/memcheck/tests/amd64-linux/Makefile.am -+++ b/memcheck/tests/amd64-linux/Makefile.am -@@ -32,5 +32,5 @@ AM_CCASFLAGS += @FLAG_M64@ - - defcfaexpr_SOURCES = defcfaexpr.S - defcfaexpr_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@ --reallocarray_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ -+reallocarray_CFLAGS = $(AM_CFLAGS) @FLAG_W_ALLOC_SIZE_LARGER_THAN@ - scalar_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ -diff --git a/memcheck/tests/x86-freebsd/Makefile.am b/memcheck/tests/x86-freebsd/Makefile.am -index 8c48506c2be7..7839bb309588 100644 ---- a/memcheck/tests/x86-freebsd/Makefile.am -+++ b/memcheck/tests/x86-freebsd/Makefile.am -@@ -23,4 +23,4 @@ AM_CCASFLAGS += @FLAG_M32@ - - posix_fallocate_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ - posix_fadvise_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ --reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ -+reallocarray_CFLAGS = ${AM_CFLAGS} @FLAG_W_ALLOC_SIZE_LARGER_THAN@ --- -2.52.0 - diff --git a/0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch b/0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch deleted file mode 100644 index ca99ac1..0000000 --- a/0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch +++ /dev/null @@ -1,520 +0,0 @@ -From 7de247c998049db64c4df8cb8bc8e481493f3b8e Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Sat, 3 Jan 2026 18:24:34 +0100 -Subject: [PATCH 3/6] readlink("/proc/self/exe") overwrites buffer beyond its - return value - -https://bugs.kde.org/show_bug.cgi?id=514094 - -Squashed cherry-picks: - -Solaris: set VG_(resolved_exename) in load_client() - - Haven't needed it yet, but I would like to try using it in the - readlink syscall wrapper. - -(cherry picked from commit bf154d815a9fd7f4aaae97e31aa03cecf69448d4) - -Bug 514094 - readlink("/proc/self/exe") overwrites buffer beyond its return value - - Used the reproducer as the basis for a test on Solaris and Linux. - -(cherry picked from commit 5c0f5e604bc3a4e8822ea59c488c123af6284afd) - -readlink[at] syswrap: limit copy to bufsiz when path is proc self exe - -(cherry picked from commit bd9edb8fcd0a8692d865e08fab2a573a4cde4c16) - -Regtest: add missing readlinkat_self files - -(cherry picked from commit 987034c44105cdc2f6f8d84751135d23bd5c37b6) - -regtest: fix warning - - Added a nice const named variable then didn't use it - -(cherry picked from commit dae37ecd2692e0e5beba77c296c2648ebbf47637) - -Fix bug514094,vgtest typo in none/tests/Makefile.am - -(cherry picked from commit 294742a2d9f431fd2dcd73db161f67fb12ddd833) - -syswrap readlink and linux readlinkat: check that buf is accessible for proc self exe case - - Also update the t testcases to cover this. - -(cherry picked from commit 8d8023d107699c7c2d97acf2dcb77bae71c0b1cf) - -solaris readlinkat: check that buf is accessible for proc self path a.out - -(cherry picked from commit 827a1b8c307a2eafa001788565e14af3445f2151) ---- - .gitignore | 3 ++ - NEWS | 1 + - coregrind/m_initimg/initimg-solaris.c | 9 ++++ - coregrind/m_syswrap/syswrap-generic.c | 29 +++++++---- - coregrind/m_syswrap/syswrap-linux.c | 28 +++++++---- - coregrind/m_syswrap/syswrap-solaris.c | 13 +++-- - none/tests/Makefile.am | 3 ++ - none/tests/bug514094.c | 48 +++++++++++++++++++ - none/tests/bug514094.stderr.exp | 2 + - none/tests/bug514094.vgtest | 2 + - none/tests/linux/Makefile.am | 3 ++ - none/tests/linux/readlinkat_self.c | 34 +++++++++++++ - none/tests/linux/readlinkat_self.stderr.exp | 2 + - none/tests/linux/readlinkat_self.vgtest | 1 + - none/tests/solaris/Makefile.am | 3 ++ - none/tests/solaris/readlinkat_self.c | 34 +++++++++++++ - none/tests/solaris/readlinkat_self.stderr.exp | 2 + - none/tests/solaris/readlinkat_self.vgtest | 1 + - 18 files changed, 194 insertions(+), 24 deletions(-) - create mode 100644 none/tests/bug514094.c - create mode 100644 none/tests/bug514094.stderr.exp - create mode 100644 none/tests/bug514094.vgtest - create mode 100644 none/tests/linux/readlinkat_self.c - create mode 100644 none/tests/linux/readlinkat_self.stderr.exp - create mode 100644 none/tests/linux/readlinkat_self.vgtest - create mode 100644 none/tests/solaris/readlinkat_self.c - create mode 100644 none/tests/solaris/readlinkat_self.stderr.exp - create mode 100644 none/tests/solaris/readlinkat_self.vgtest - -diff --git a/NEWS b/NEWS -index 4e6cb3de9125..cca48f513138 100644 ---- a/NEWS -+++ b/NEWS -@@ -8,6 +8,7 @@ The following bugs have been fixed or resolved on this branch. - 511972 valgrind-3.26.0 tests fail to build on upcomig gcc-16: - unrecognized command-line option - '-Wno-alloc-size-larger-than=18446744073709551615' -+514094 readlink("/proc/self/exe") overwrites buffer beyond its return value - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/coregrind/m_initimg/initimg-solaris.c b/coregrind/m_initimg/initimg-solaris.c -index 79072f3a85df..bd2d822e5d20 100644 ---- a/coregrind/m_initimg/initimg-solaris.c -+++ b/coregrind/m_initimg/initimg-solaris.c -@@ -94,6 +94,15 @@ static void load_client(/*OUT*/ExeInfo *info, - /*NOTREACHED*/ - } - VG_(strcpy)(out_exe_name, exe_name); -+ if (VG_(resolved_exename) == NULL) { -+ HChar interp_name[VKI_PATH_MAX]; -+ if (VG_(try_get_interp)(exe_name, interp_name, VKI_PATH_MAX)) { -+ exe_name = interp_name; -+ } -+ HChar resolved_name[VKI_PATH_MAX]; -+ VG_(realpath)(exe_name, resolved_name); -+ VG_(resolved_exename) = VG_(strdup)("initimg-solaris.lc.1", resolved_name); -+ } - - /* Set initial brk values. */ - if (info->ldsoexec) { -diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c -index 37f312fe8f4b..f39dbcdba055 100644 ---- a/coregrind/m_syswrap/syswrap-generic.c -+++ b/coregrind/m_syswrap/syswrap-generic.c -@@ -5060,20 +5060,16 @@ POST(sys_poll) - - PRE(sys_readlink) - { -- FUSE_COMPATIBLE_MAY_BLOCK(); - PRINT("sys_readlink ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x, %llu )", - ARG1, (char*)(Addr)ARG1, ARG2, (ULong)ARG3); - PRE_REG_READ3(long, "readlink", - const char *, path, char *, buf, int, bufsiz); - PRE_MEM_RASCIIZ( "readlink(path)", ARG1 ); - PRE_MEM_WRITE( "readlink(buf)", ARG2,ARG3 ); --} - --POST(sys_readlink) --{ -+ Bool fuse_may_block = True; - #if defined(VGO_linux) || defined(VGO_solaris) - { -- Word saved = SYSNO; - #if defined(VGO_linux) - #define PID_EXEPATH "/proc/%d/exe" - #define SELF_EXEPATH "/proc/self/exe" -@@ -5092,14 +5088,27 @@ POST(sys_readlink) - VG_(sprintf)(name, PID_EXEPATH, VG_(getpid)()); - if (ML_(safe_to_deref)(arg1s, 1) - && (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, SELF_EXEPATH))) { -- VG_(sprintf)(name, SELF_EXEFD, VG_(cl_exec_fd)); -- SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name, -- ARG2, ARG3)); -+ HChar* out_name = (HChar*)ARG2; -+ SizeT res = VG_(strlen)(VG_(resolved_exename)); -+ res = VG_MIN(res, ARG3); -+ if (ML_(safe_to_deref)(out_name, res)) { -+ VG_(strncpy)(out_name, VG_(resolved_exename), res); -+ SET_STATUS_Success(res); -+ } else { -+ SET_STATUS_Failure(VKI_EFAULT); -+ } -+ fuse_may_block = False; - } - } - #endif -- if (SUCCESS && RES > 0) -- POST_MEM_WRITE( ARG2, RES ); -+ -+ if (fuse_may_block) -+ FUSE_COMPATIBLE_MAY_BLOCK(); -+} -+ -+POST(sys_readlink) -+{ -+ POST_MEM_WRITE( ARG2, RES ); - } - - PRE(sys_readv) -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index e8b200385b8f..f1970cd8be9f 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -6468,14 +6468,10 @@ PRE(sys_readlinkat) - ML_(fd_at_check_allowed)(SARG1, (const HChar*)ARG2, "readlinkat", tid, status); - PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 ); - PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 ); --} - --POST(sys_readlinkat) --{ -+ Bool fuse_may_block = True; - HChar name[30]; // large enough -- Word saved = SYSNO; - -- // @todo PJF why is this done in POST and not in PRE? - /* - * Handle the case where readlinkat is looking at /proc/self/exe or - * /proc//exe. -@@ -6484,13 +6480,25 @@ POST(sys_readlinkat) - if (ML_(safe_to_deref)((void*)(Addr)ARG2, 1) - && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0 - || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0)) { -- VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd)); -- SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, (UWord)name, -- ARG3, ARG4)); -+ HChar* out_name = (HChar*)ARG3; -+ SizeT res = VG_(strlen)(VG_(resolved_exename)); -+ res = VG_MIN(res, ARG4); -+ if (ML_(safe_to_deref)(out_name, res)) { -+ VG_(strncpy)(out_name, VG_(resolved_exename), res); -+ SET_STATUS_Success(res); -+ } else { -+ SET_STATUS_Failure(VKI_EFAULT); -+ } -+ fuse_may_block = False; - } - -- if (SUCCESS && RES > 0) -- POST_MEM_WRITE( ARG3, RES ); -+ if (fuse_may_block) -+ FUSE_COMPATIBLE_MAY_BLOCK(); -+} -+ -+POST(sys_readlinkat) -+{ -+ POST_MEM_WRITE( ARG3, RES ); - } - - PRE(sys_fchmodat) -diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c -index 2665633f435f..57af54fdc3be 100644 ---- a/coregrind/m_syswrap/syswrap-solaris.c -+++ b/coregrind/m_syswrap/syswrap-solaris.c -@@ -2295,7 +2295,6 @@ PRE(sys_readlinkat) - /* ssize_t readlinkat(int dfd, const char *path, char *buf, - size_t bufsiz); */ - HChar name[30]; // large enough -- Word saved = SYSNO; - - /* Interpret the first argument as 32-bit value even on 64-bit architecture. - This is different from Linux, for example, where glibc sign-extends it. */ -@@ -2317,9 +2316,15 @@ PRE(sys_readlinkat) - if (ML_(safe_to_deref)((void*)ARG2, 1) && - (!VG_(strcmp)((HChar*)ARG2, name) || - !VG_(strcmp)((HChar*)ARG2, "/proc/self/path/a.out"))) { -- VG_(sprintf)(name, "/proc/self/path/%d", VG_(cl_exec_fd)); -- SET_STATUS_from_SysRes(VG_(do_syscall4)(saved, dfd, (UWord)name, ARG3, -- ARG4)); -+ HChar* out_name = (HChar*)ARG3; -+ SizeT res = VG_(strlen)(VG_(resolved_exename)); -+ res = VG_MIN(res, ARG4); -+ if (ML_(safe_to_deref)(out_name, res)) { -+ VG_(strncpy)(out_name, VG_(resolved_exename), res); -+ SET_STATUS_Success(res); -+ } else { -+ SET_STATUS_Failure(VKI_EFAULT); -+ } - } - } - -diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am -index a95d66436df8..a5e03de77cbb 100644 ---- a/none/tests/Makefile.am -+++ b/none/tests/Makefile.am -@@ -111,6 +111,7 @@ EXTRA_DIST = \ - bug290061.vgtest bug290061.stderr.exp \ - bug491394.vgtest bug491394.stderr.exp \ - bug492678.vgtest bug492678.stderr.exp \ -+ bug514094.vgtest bug514094.stderr.exp \ - closeall.stderr.exp closeall.vgtest \ - cmdline0.stderr.exp cmdline0.stdout.exp cmdline0.vgtest \ - cmdline1.stderr.exp cmdline1.stdout.exp cmdline1.vgtest \ -@@ -287,6 +288,7 @@ check_PROGRAMS = \ - bug129866 bug234814 \ - bug290061 \ - bug492678 \ -+ bug514094 \ - closeall coolo_strlen \ - discard exec-sigmask execve faultstatus fcntl_setown \ - fdleak_cmsg fdleak_creat fdleak_doubleclose0 fdleak_dup fdleak_dup2 \ -@@ -392,6 +394,7 @@ bug290061_LDFLAGS = @FLAG_PIE@ - bug491394_LDADD = -lc - bug491394_LDFLAGS = -nostdlib -static - bug491394_CFLAGS = ${AM_CFLAGS} -Os -+bug514094_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_STRINGOP_OVERFLOW@ - execve_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_NONNULL@ - if VGCONF_OS_IS_SOLARIS - fcntl_setown_LDADD = -lsocket -lnsl -diff --git a/none/tests/bug514094.c b/none/tests/bug514094.c -new file mode 100644 -index 000000000000..a62a6406b722 ---- /dev/null -+++ b/none/tests/bug514094.c -@@ -0,0 +1,48 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "../../config.h" -+ -+int main(int argc, char** argv) -+{ -+ char buf[PATH_MAX]; -+ memset(buf, 0, PATH_MAX); -+#if defined(VGO_solaris) -+ int ret = readlink("/proc/self/path/a.out", buf, PATH_MAX); -+#else -+ // Linux, and maybe one day NetBSD -+ // other platforms excluded by .vgtest prereq -+ int ret = readlink("/proc/self/exe", buf, PATH_MAX); -+#endif -+ if (argc > 1) { -+ printf("ret = %d, buf = %.64s\n", ret, buf); -+ } -+ char resolved[PATH_MAX]; -+ realpath(argv[0], resolved); -+ assert(strcmp(resolved, buf) == 0); -+ -+ const size_t small_buf_size = 11; -+ char small_buf[small_buf_size]; -+ memset(small_buf, '#', small_buf_size); -+#if defined(VGO_solaris) -+ ret = readlink("/proc/self/path/a.out", small_buf, 10); -+#else -+ ret = readlink("/proc/self/exe", small_buf, 10); -+#endif -+ assert(strncmp(resolved, small_buf, 10) == 0); -+ assert(small_buf[10] == '#'); -+ -+#if defined(VGO_solaris) -+ ret = readlink("/proc/self/path/a.out", (char*)1, 100); -+#else -+ ret = readlink("/proc/self/exe", (char*)1, 100); -+#endif -+ assert(ret == -1); -+ assert(errno = EFAULT); -+} -+ -diff --git a/none/tests/bug514094.stderr.exp b/none/tests/bug514094.stderr.exp -new file mode 100644 -index 000000000000..139597f9cb07 ---- /dev/null -+++ b/none/tests/bug514094.stderr.exp -@@ -0,0 +1,2 @@ -+ -+ -diff --git a/none/tests/bug514094.vgtest b/none/tests/bug514094.vgtest -new file mode 100644 -index 000000000000..292428cb7696 ---- /dev/null -+++ b/none/tests/bug514094.vgtest -@@ -0,0 +1,2 @@ -+prereq: ../../tests/os_test solaris || ../../tests/os_test linux -+prog: bug514094 -diff --git a/none/tests/linux/Makefile.am b/none/tests/linux/Makefile.am -index 55426e2b2664..3692c6ff1f2a 100644 ---- a/none/tests/linux/Makefile.am -+++ b/none/tests/linux/Makefile.am -@@ -21,6 +21,7 @@ EXTRA_DIST = \ - mremap6.stderr.exp mremap6.vgtest \ - open_client.stderr.exp open_client.vgtest \ - pthread-stack.stderr.exp pthread-stack.vgtest \ -+ readlinkat_self.stderr.exp readlinkat_self.vgtest \ - stack-overflow.stderr.exp stack-overflow.vgtest - - check_PROGRAMS = \ -@@ -37,6 +38,7 @@ check_PROGRAMS = \ - mremap5 \ - mremap6 \ - pthread-stack \ -+ readlinkat_self \ - stack-overflow - - if HAVE_OPENAT2 -@@ -58,6 +60,7 @@ open_client_SOURCES = open_client.cpp - endif - clonev_LDADD = -lpthread - pthread_stack_LDADD = -lpthread -+readlinkat_self_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_STRINGOP_OVERFLOW@ - - stack_overflow_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ \ - @FLAG_W_NO_INFINITE_RECURSION@ -diff --git a/none/tests/linux/readlinkat_self.c b/none/tests/linux/readlinkat_self.c -new file mode 100644 -index 000000000000..586581a0d966 ---- /dev/null -+++ b/none/tests/linux/readlinkat_self.c -@@ -0,0 +1,34 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "../../config.h" -+ -+int main(int argc, char** argv) -+{ -+ char buf[PATH_MAX]; -+ memset(buf, 0, PATH_MAX); -+ int ret = readlinkat(99, "/proc/self/exe", buf, PATH_MAX); -+ if (argc > 1) { -+ printf("ret = %d, buf = %.64s\n", ret, buf); -+ } -+ char resolved[PATH_MAX]; -+ realpath(argv[0], resolved); -+ assert(strcmp(resolved, buf) == 0); -+ -+ const size_t small_buf_size = 11; -+ char small_buf[small_buf_size]; -+ memset(small_buf, '#', small_buf_size); -+ ret = readlinkat(100, "/proc/self/exe", small_buf, 10); -+ assert(strncmp(resolved, small_buf, 10) == 0); -+ assert(small_buf[10] == '#'); -+ -+ ret = readlinkat(101, "/proc/self/exe", (char*)1, 100); -+ assert(ret == -1); -+ assert(errno = EFAULT); -+} -+ -diff --git a/none/tests/linux/readlinkat_self.stderr.exp b/none/tests/linux/readlinkat_self.stderr.exp -new file mode 100644 -index 000000000000..139597f9cb07 ---- /dev/null -+++ b/none/tests/linux/readlinkat_self.stderr.exp -@@ -0,0 +1,2 @@ -+ -+ -diff --git a/none/tests/linux/readlinkat_self.vgtest b/none/tests/linux/readlinkat_self.vgtest -new file mode 100644 -index 000000000000..3b91da54c53d ---- /dev/null -+++ b/none/tests/linux/readlinkat_self.vgtest -@@ -0,0 +1 @@ -+prog: readlinkat_self -diff --git a/none/tests/solaris/Makefile.am b/none/tests/solaris/Makefile.am -index 861c9ff56222..c488c782de6d 100644 ---- a/none/tests/solaris/Makefile.am -+++ b/none/tests/solaris/Makefile.am -@@ -23,6 +23,7 @@ EXTRA_DIST = \ - proc_psinfo.stderr.exp proc_psinfo.stdout.exp proc_psinfo.vgtest \ - posix_spawn.stderr.exp posix_spawn.stdout.exp posix_spawn.vgtest \ - pthread-stack.stderr.exp pthread-stack.vgtest \ -+ readlinkat_self.stderr.exp readlinkat_self.vgtest \ - reserve_sysstat_addr.map reserve_sysstat_addr.stderr.exp reserve_sysstat_addr.vgtest \ - reserve_sysstat_zone_addr.map reserve_sysstat_zone_addr.stderr.exp reserve_sysstat_zone_addr.vgtest \ - resolv.stdout.exp resolv.stderr.exp resolv.vgtest \ -@@ -47,6 +48,7 @@ check_PROGRAMS = \ - proc_psinfo \ - posix_spawn \ - pthread-stack \ -+ readlinkat_self \ - resolv \ - sigresend \ - stack_overflow \ -@@ -57,6 +59,7 @@ AM_CFLAGS += $(AM_FLAG_M3264_PRI) - AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) - - pthread_stack_LDADD = -lpthread -+readlinkat_self_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_STRINGOP_OVERFLOW@ - resolv_LDADD = -lresolv - stack_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_INFINITE_RECURSION@ - stack_prot_LDFLAGS = -Wl,-M,/usr/lib/ld/map.noexstk -diff --git a/none/tests/solaris/readlinkat_self.c b/none/tests/solaris/readlinkat_self.c -new file mode 100644 -index 000000000000..ca60834aeb5e ---- /dev/null -+++ b/none/tests/solaris/readlinkat_self.c -@@ -0,0 +1,34 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "../../config.h" -+ -+int main(int argc, char** argv) -+{ -+ char buf[PATH_MAX]; -+ memset(buf, 0, PATH_MAX); -+ int ret = readlinkat(99, "/proc/self/path/a.out", buf, PATH_MAX); -+ if (argc > 1) { -+ printf("ret = %d, buf = %.64s\n", ret, buf); -+ } -+ char resolved[PATH_MAX]; -+ realpath(argv[0], resolved); -+ assert(strcmp(resolved, buf) == 0); -+ -+ const size_t small_buf_size = 11; -+ char small_buf[small_buf_size]; -+ memset(small_buf, '#', small_buf_size); -+ ret = readlinkat(100, "/proc/self/path/a.out", small_buf, 10); -+ assert(strncmp(resolved, small_buf, 10) == 0); -+ assert(small_buf[10] == '#'); -+ -+ ret = readlinkat(101, "/proc/self/path/a.out", (char*)1, 100); -+ assert(ret == -1); -+ assert(errno = EFAULT); -+} -+ -diff --git a/none/tests/solaris/readlinkat_self.stderr.exp b/none/tests/solaris/readlinkat_self.stderr.exp -new file mode 100644 -index 000000000000..139597f9cb07 ---- /dev/null -+++ b/none/tests/solaris/readlinkat_self.stderr.exp -@@ -0,0 +1,2 @@ -+ -+ -diff --git a/none/tests/solaris/readlinkat_self.vgtest b/none/tests/solaris/readlinkat_self.vgtest -new file mode 100644 -index 000000000000..3b91da54c53d ---- /dev/null -+++ b/none/tests/solaris/readlinkat_self.vgtest -@@ -0,0 +1 @@ -+prog: readlinkat_self --- -2.52.0 - diff --git a/0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch b/0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch deleted file mode 100644 index d2ae314..0000000 --- a/0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 4a1d79be47ead6918053f649f66107b8d8df4310 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Mon, 1 Dec 2025 08:12:30 +0100 -Subject: [PATCH 4/6] Linux DRD suppression: add an entry for - __is_decorate_maps_enabled - -Seen on Fedora 43 - -(cherry picked from commit cfc8b0706a9a0fbf05525a0ce142e2bf4cc53fed) ---- - drd/tests/std_thread2.supp | 7 +++++++ - glibc-2.X-drd.supp.in | 6 ++++++ - 2 files changed, 13 insertions(+) - -diff --git a/drd/tests/std_thread2.supp b/drd/tests/std_thread2.supp -index 40741b06f889..39a201da9af7 100644 ---- a/drd/tests/std_thread2.supp -+++ b/drd/tests/std_thread2.supp -@@ -98,3 +98,10 @@ - drd:ConflictingAccess - fun:__set_vma_name - } -+ -+{ -+ drd-libc-__is_decorate_maps_enabled -+ drd:ConflictingAccess -+ fun:__is_decorate_maps_enabled -+} -+ -diff --git a/glibc-2.X-drd.supp.in b/glibc-2.X-drd.supp.in -index 419ff2256c92..6866904470d6 100644 ---- a/glibc-2.X-drd.supp.in -+++ b/glibc-2.X-drd.supp.in -@@ -369,3 +369,9 @@ - fun:_dl_exception_create_format - } - -+{ -+ drd-libc-__is_decorate_maps_enabled -+ drd:ConflictingAccess -+ fun:__is_decorate_maps_enabled -+} -+ --- -2.52.0 - diff --git a/0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch b/0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch deleted file mode 100644 index 7e68f22..0000000 --- a/0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch +++ /dev/null @@ -1,30 +0,0 @@ -From c080f583dc41a779d339ffd2a08863bd05a80904 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Mon, 1 Dec 2025 08:18:56 +0100 -Subject: [PATCH 5/6] Linux Helgrind: add a suppression for - _dl_allocate_tls_init - -Seen on Fedora 43 amd64 - -(cherry picked from commit b599858486bb7db6d2ff3e6ddc4e7f71791d393d) ---- - glibc-2.X-helgrind.supp.in | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/glibc-2.X-helgrind.supp.in b/glibc-2.X-helgrind.supp.in -index 9b1ef9ae485b..61d4e1d724d0 100644 ---- a/glibc-2.X-helgrind.supp.in -+++ b/glibc-2.X-helgrind.supp.in -@@ -356,3 +356,9 @@ - obj:/usr/lib/*/libnss_mdns4*.so.* - } - -+{ -+ helgrind---_dl_allocate_tls_init -+ Helgrind:Race -+ fun:mempcpy -+ fun:_dl_allocate_tls_init -+} --- -2.52.0 - diff --git a/0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch b/0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch deleted file mode 100644 index eaf6a69..0000000 --- a/0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch +++ /dev/null @@ -1,95 +0,0 @@ -From dbdfc2b4522bb210786bddbc16e3ad855d5fa62a Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Wed, 7 Jan 2026 22:20:49 +0100 -Subject: [PATCH 6/6] Disable linux madvise MADV_GUARD_INSTALL - -glibc 2.42+ (with linux 6.13+) uses MADV_GUARD_INSTALL to setup stack -guard pages. valgrind currently isn't able to track this and such -guard pages also don't show up in /proc maps (only in /proc pagemap -since linux 6.14). For now valgrind fails a madvise MADV_GUARD_INSTALL -syscall with EINVAL. This causes glibc to fall back to mprotect -PROT_NONE which valgrind is able to track. - -https://bugs.kde.org/show_bug.cgi?id=511717 - -(cherry picked from commit 19a34d1d9376f459cf0a19feb39ea4ab27690390) ---- - NEWS | 14 ++++++++++++++ - coregrind/m_syswrap/syswrap-generic.c | 10 ++++++++++ - include/vki/vki-linux.h | 7 +++++++ - 3 files changed, 31 insertions(+) - -diff --git a/NEWS b/NEWS -index cca48f513138..28409915e1a1 100644 ---- a/NEWS -+++ b/NEWS -@@ -1,6 +1,18 @@ - Branch 3.26 - ~~~~~~~~~~~ - -+* ==================== CORE CHANGES =================== -+ -+* linux madvise MADV_GUARD_INSTALL unsupported -+ -+ glibc 2.42+ (with linux 6.13+) uses MADV_GUARD_INSTALL to setup -+ stack guard pages. valgrind currently isn't able to track this and -+ such guard pages also don't show up in /proc maps (only in /proc -+ pagemap since linux 6.14). For now valgrind fails a madvise -+ MADV_GUARD_INSTALL syscall with EINVAL. This causes glibc to fall -+ back to mprotect PROT_NONE which valgrind is able to track. -+ See also https://bugs.kde.org/show_bug.cgi?id=514297 -+ - * ==================== FIXED BUGS ==================== - - The following bugs have been fixed or resolved on this branch. -@@ -8,6 +20,8 @@ The following bugs have been fixed or resolved on this branch. - 511972 valgrind-3.26.0 tests fail to build on upcomig gcc-16: - unrecognized command-line option - '-Wno-alloc-size-larger-than=18446744073709551615' -+511717 gdbserver (valgrind_read_memory) the 'impossible' happened: -+ Killed by fatal signal (SIGSEGV) - 514094 readlink("/proc/self/exe") overwrites buffer beyond its return value - - To see details of a given bug, visit -diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c -index f39dbcdba055..668acc4605a8 100644 ---- a/coregrind/m_syswrap/syswrap-generic.c -+++ b/coregrind/m_syswrap/syswrap-generic.c -@@ -3112,6 +3112,16 @@ PRE(sys_madvise) - ARG1, ARG2, SARG3); - PRE_REG_READ3(long, "madvise", - unsigned long, start, vki_size_t, length, int, advice); -+ /* Ugly hack to try to bypass the problem of guard pages not being -+ understood by valgrind aspace manager. -+ By making the syscall fail, we expect glibc to fallback -+ on implementing guard pages with mprotect PROT_NONE to ensure -+ the valgrind address space manager is not confused wrongly -+ believing the guard page is rw. */ -+#ifdef VKI_MADV_GUARD_INSTALL -+ if (ARG3 == VKI_MADV_GUARD_INSTALL) -+ SET_STATUS_Failure( VKI_EINVAL ); -+#endif - } - - #if HAVE_MREMAP -diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h -index 3f9272f4d18e..96c181a85775 100644 ---- a/include/vki/vki-linux.h -+++ b/include/vki/vki-linux.h -@@ -1364,6 +1364,13 @@ struct vki_seminfo { - #define VKI_MREMAP_MAYMOVE 1 - #define VKI_MREMAP_FIXED 2 - -+//---------------------------------------------------------------------- -+// Common madvise flags mman-common.h -+//---------------------------------------------------------------------- -+ -+#define VKI_MADV_GUARD_INSTALL 102 -+#define VKI_MADV_GUARD_REMOVE 103 -+ - //---------------------------------------------------------------------- - // From linux-2.6.31-rc4/include/linux/futex.h - //---------------------------------------------------------------------- --- -2.52.0 - diff --git a/0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch b/0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch deleted file mode 100644 index 9dfa61b..0000000 --- a/0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0a95412527ecba22cdb0f96a905a7a5ce45a14bc Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Thu, 15 Jan 2026 08:44:52 +0100 -Subject: [PATCH 7/8] Bug 514613 - Unclosed leak_summary/still_reachable tag in - xml output - -(cherry picked from commit 758b0f55e878fd7bd9dcd1ff3e74f10a7a00a771) ---- - NEWS | 1 + - memcheck/mc_leakcheck.c | 3 ++- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/NEWS b/NEWS -index 28409915e1a1..164218c14e76 100644 ---- a/NEWS -+++ b/NEWS -@@ -23,6 +23,7 @@ The following bugs have been fixed or resolved on this branch. - 511717 gdbserver (valgrind_read_memory) the 'impossible' happened: - Killed by fatal signal (SIGSEGV) - 514094 readlink("/proc/self/exe") overwrites buffer beyond its return value -+514613 Unclosed leak_summary/still_reachable tag in xml output - - To see details of a given bug, visit - https://bugs.kde.org/show_bug.cgi?id=XXXXXX -diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c -index 586bff448bfb..4df0b180d5d1 100644 ---- a/memcheck/mc_leakcheck.c -+++ b/memcheck/mc_leakcheck.c -@@ -1768,7 +1768,8 @@ static void print_results(ThreadId tid, LeakCheckParams* lcp) - umsg_or_xml(VG_(clo_xml) ? - " \n" - " %'lu%s\n" -- " %'lu%s\n" : -+ " %'lu%s\n" -+ " \n" : - " still reachable: %'lu%s bytes in %'lu%s blocks\n", - MC_(bytes_reachable), - DBY (MC_(bytes_reachable), old_bytes_reachable), --- -2.52.0 - diff --git a/0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch b/0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch deleted file mode 100644 index a895d77..0000000 --- a/0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 2ddba5ddc12312386b019b4a785c80ce8633ba57 Mon Sep 17 00:00:00 2001 -From: Paul Floyd -Date: Tue, 20 Jan 2026 07:44:31 +0100 -Subject: [PATCH 8/8] Bug 514206 - Assertion '!sr_isError(sr)' failed - mmap fd - points to an open descriptor to a PCI device - -(cherry picked from commit 38609f9b87eb6908a4a04ed5882db337edaec765) ---- - NEWS | 2 ++ - coregrind/m_debuginfo/debuginfo.c | 5 ++++- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/NEWS b/NEWS -index 164218c14e76..a09cf7e1bba3 100644 ---- a/NEWS -+++ b/NEWS -@@ -23,6 +23,8 @@ The following bugs have been fixed or resolved on this branch. - 511717 gdbserver (valgrind_read_memory) the 'impossible' happened: - Killed by fatal signal (SIGSEGV) - 514094 readlink("/proc/self/exe") overwrites buffer beyond its return value -+514206 Assertion '!sr_isError(sr)' failed - mmap fd points to an open -+ descriptor to a PCI device - 514613 Unclosed leak_summary/still_reachable tag in xml output - - To see details of a given bug, visit -diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c -index 18152b9e25e4..196fe8d98811 100644 ---- a/coregrind/m_debuginfo/debuginfo.c -+++ b/coregrind/m_debuginfo/debuginfo.c -@@ -1177,8 +1177,11 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd ) - * --20208-- WARNING: Serious error when reading debug info - * --20208-- When reading debug info from /proc/xen/privcmd: - * --20208-- can't read file to inspect ELF header -+ * -+ * Also PCI devices, see bug 514206 - */ -- if (VG_(strncmp)(filename, "/proc/xen/", 10) == 0) -+ if (VG_(strncmp)(filename, "/proc/xen/", 10) == 0 || -+ VG_(strncmp)(filename, "/sys/devices/pci", 16) == 0) - return 0; - - if (debug) --- -2.52.0 - diff --git a/sources b/sources index 10021d6..b14cfb8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.26.0.tar.bz2) = 80ebf9197be602fdd4aad0e9277e6ef2fd25ede9cecb6e6d159f6f062c13f62ad907c6b6e7000e82b3404d8b4f9e7bf15813f60d9fed414c7b713a4280c82898 +SHA512 (valgrind-3.27.0.RC1.tar.bz2) = f7b4b7976b4455baf91fcee27398402fceb9171e366758e45ccddfb25ee4b2ee56bfc8cf9f3c18550ec7929c5ed6f14f41df530911bb87d6941d29d682017ded diff --git a/valgrind-3.26.0-some-stack-protector.patch b/valgrind-3.26.0-some-stack-protector.patch index a2907a1..ca00eac 100644 --- a/valgrind-3.26.0-some-stack-protector.patch +++ b/valgrind-3.26.0-some-stack-protector.patch @@ -42,8 +42,8 @@ diff --git a/configure.ac b/configure.ac index 90fafaf1c557..84a3d22c5bff 100644 --- a/configure.ac +++ b/configure.ac -@@ -2764,24 +2764,24 @@ AC_LANG(C) - AM_CONDITIONAL([HAVE_ALIGNED_CXX_ALLOC], [test x$ac_have_aligned_cxx_alloc = xyes]) +@@ -3004,24 +3004,24 @@ + fi # does this compiler support -fno-stack-protector ? -AC_MSG_CHECKING([if gcc accepts -fno-stack-protector]) diff --git a/valgrind.spec b/valgrind.spec index 110d1a5..982fd2d 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.26.0 -Release: 5%{?dist} +Version: 3.27.0 +Release: 0.1.RC1%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -71,7 +71,7 @@ URL: https://www.valgrind.org/ # So those will already have their full symbol table. %undefine _include_minidebuginfo -Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.tar.bz2 +Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC1.tar.bz2 # Needs investigation and pushing upstream Patch1: valgrind-3.9.0-cachegrind-improvements.patch @@ -85,19 +85,6 @@ Patch3: valgrind-3.26.0-some-stack-protector.patch # Add some -Wl,z,now. Patch4: valgrind-3.26.0-some-Wl-z-now.patch -# VALGRIND_3_26_BRANCH patches -Patch5: 0001-Prepare-NEWS-for-branch-3.26-fixes.patch -Patch6: 0002-Bug-511972-valgrind-3.26.0-tests-fail-to-build-on-up.patch -Patch7: 0003-readlink-proc-self-exe-overwrites-buffer-beyond-its-.patch -Patch8: 0004-Linux-DRD-suppression-add-an-entry-for-__is_decorate.patch -Patch9: 0005-Linux-Helgrind-add-a-suppression-for-_dl_allocate_tl.patch -Patch10: 0006-Disable-linux-madvise-MADV_GUARD_INSTALL.patch -Patch11: 0007-Bug-514613-Unclosed-leak_summary-still_reachable-tag.patch -Patch12: 0008-Bug-514206-Assertion-sr_isError-sr-failed-mmap-fd-po.patch - -# Refix for https://bugs.kde.org/show_bug.cgi?id=514613 -Patch100: 0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch - BuildRequires: make BuildRequires: glibc-devel @@ -270,24 +257,13 @@ Valgrind User Manual for details. %endif %prep -%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version} +%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC1 %patch -P1 -p1 %patch -P2 -p1 %patch -P3 -p1 %patch -P4 -p1 -%patch -P5 -p1 -%patch -P6 -p1 -%patch -P7 -p1 -%patch -P8 -p1 -%patch -P9 -p1 -%patch -P10 -p1 -%patch -P11 -p1 -%patch -P12 -p1 - -%patch -P100 -p1 - %build # LTO triggers undefined symbols in valgrind. But valgrind has a # --enable-lto configure time option that we will use instead. @@ -527,6 +503,10 @@ echo ===============END TESTING=============== %endif %changelog +* Mon Apr 13 2026 Mark Wielaard - 3.27.0-0.1.RC1 +- Upstream 3.27.0-RC1 +- Remove all VALGRIND_3_26_BRANCH and proposed upstream patches + * Thu Jan 29 2026 Mark Wielaard - 3.26.0-5 - Add 0001-Refix-still_reachable-xml-closing-tag-and-add-testca.patch From aee12d025ed4eb32de128e5b2f2e634da8af99f0 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 18 Apr 2026 03:40:19 +0200 Subject: [PATCH 27/30] 3.27.0-0.1.RC2 - Upstream 3.27.0-RC2 --- .gitignore | 1 + sources | 2 +- valgrind.spec | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 15d202f..e32bf93 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ /valgrind-3.26.0.RC1.tar.bz2 /valgrind-3.26.0.tar.bz2 /valgrind-3.27.0.RC1.tar.bz2 +/valgrind-3.27.0.RC2.tar.bz2 diff --git a/sources b/sources index b14cfb8..bb9471a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.27.0.RC1.tar.bz2) = f7b4b7976b4455baf91fcee27398402fceb9171e366758e45ccddfb25ee4b2ee56bfc8cf9f3c18550ec7929c5ed6f14f41df530911bb87d6941d29d682017ded +SHA512 (valgrind-3.27.0.RC2.tar.bz2) = a4d1dd42df05e1cf177ac24875fe450d52f62205df2195f9a5906320779190f6a8afcf7374ea8943ee97289e99f1a20da3772757f229d1dfb6718e291e8aae24 diff --git a/valgrind.spec b/valgrind.spec index 982fd2d..5750ef3 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.27.0 -Release: 0.1.RC1%{?dist} +Release: 0.1.RC2%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -71,7 +71,7 @@ URL: https://www.valgrind.org/ # So those will already have their full symbol table. %undefine _include_minidebuginfo -Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC1.tar.bz2 +Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC2.tar.bz2 # Needs investigation and pushing upstream Patch1: valgrind-3.9.0-cachegrind-improvements.patch @@ -257,7 +257,7 @@ Valgrind User Manual for details. %endif %prep -%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC1 +%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC2 %patch -P1 -p1 %patch -P2 -p1 @@ -503,6 +503,9 @@ echo ===============END TESTING=============== %endif %changelog +* Fri Apr 17 2026 Mark Wielaard - 3.27.0-0.1.RC2 +- Upstream 3.27.0-RC2 + * Mon Apr 13 2026 Mark Wielaard - 3.27.0-0.1.RC1 - Upstream 3.27.0-RC1 - Remove all VALGRIND_3_26_BRANCH and proposed upstream patches From 8ecc39bb1a33490717afad522c72dc2871a102aa Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 21 Apr 2026 01:01:18 +0200 Subject: [PATCH 28/30] 3.27.0-1 - Valgrind 3.27.0 final --- .gitignore | 1 + sources | 2 +- valgrind.spec | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e32bf93..2bf1e65 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,4 @@ /valgrind-3.26.0.tar.bz2 /valgrind-3.27.0.RC1.tar.bz2 /valgrind-3.27.0.RC2.tar.bz2 +/valgrind-3.27.0.tar.bz2 diff --git a/sources b/sources index bb9471a..dc7e11f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.27.0.RC2.tar.bz2) = a4d1dd42df05e1cf177ac24875fe450d52f62205df2195f9a5906320779190f6a8afcf7374ea8943ee97289e99f1a20da3772757f229d1dfb6718e291e8aae24 +SHA512 (valgrind-3.27.0.tar.bz2) = a171d95426835604a426e77b3745a05ab1557972fceb513e2caa76e71192c9763fe4c2190249a2312ae3a94511ee2aefa9a926858c11a724b8d95f497b083cf3 diff --git a/valgrind.spec b/valgrind.spec index 5750ef3..932cfc5 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.27.0 -Release: 0.1.RC2%{?dist} +Release: 1%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -71,7 +71,7 @@ URL: https://www.valgrind.org/ # So those will already have their full symbol table. %undefine _include_minidebuginfo -Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC2.tar.bz2 +Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.tar.bz2 # Needs investigation and pushing upstream Patch1: valgrind-3.9.0-cachegrind-improvements.patch @@ -257,7 +257,7 @@ Valgrind User Manual for details. %endif %prep -%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC2 +%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version} %patch -P1 -p1 %patch -P2 -p1 @@ -503,6 +503,9 @@ echo ===============END TESTING=============== %endif %changelog +* Mon Apr 20 2026 Mark Wielaard - 3.27.0-1 +- Valgrind 3.27.0 final + * Fri Apr 17 2026 Mark Wielaard - 3.27.0-0.1.RC2 - Upstream 3.27.0-RC2 From 8c75266e08674d64863d8c905144063b0072ef22 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 20 May 2026 15:17:12 +0200 Subject: [PATCH 29/30] 3.27.1-1 - Valgrind 3.27.1 final --- .gitignore | 1 + sources | 2 +- valgrind.spec | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2bf1e65..1b94371 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,4 @@ /valgrind-3.27.0.RC1.tar.bz2 /valgrind-3.27.0.RC2.tar.bz2 /valgrind-3.27.0.tar.bz2 +/valgrind-3.27.1.tar.bz2 diff --git a/sources b/sources index dc7e11f..f885857 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (valgrind-3.27.0.tar.bz2) = a171d95426835604a426e77b3745a05ab1557972fceb513e2caa76e71192c9763fe4c2190249a2312ae3a94511ee2aefa9a926858c11a724b8d95f497b083cf3 +SHA512 (valgrind-3.27.1.tar.bz2) = 4522e345fe31bc10478f21ab261cf7b3e509d80fe98fd0c7c9778ac9a9f90e1d8fa6e54a37c2e23114c01c95131035103fc1e78661710d7f45f5d564a31c1015 diff --git a/valgrind.spec b/valgrind.spec index 932cfc5..5633fc2 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -2,7 +2,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind -Version: 3.27.0 +Version: 3.27.1 Release: 1%{?dist} Epoch: 1 @@ -503,6 +503,9 @@ echo ===============END TESTING=============== %endif %changelog +* Wed May 20 2026 Mark Wielaard - 3.27.1-1 +- Valgrind 3.27.1 final + * Mon Apr 20 2026 Mark Wielaard - 3.27.0-1 - Valgrind 3.27.0 final From a44e0e250a4a4255a40434b36aa091aeaa603736 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jul 2026 08:21:24 +0000 Subject: [PATCH 30/30] Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild --- valgrind.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/valgrind.spec b/valgrind.spec index 5633fc2..f620ab3 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Dynamic analysis tools to detect memory or thread bugs and profile Name: %{?scl_prefix}valgrind Version: 3.27.1 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 1 # This ignores licenses that are only found in the test or perf sources @@ -503,6 +503,9 @@ echo ===============END TESTING=============== %endif %changelog +* Fri Jul 17 2026 Fedora Release Engineering - 1:3.27.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild + * Wed May 20 2026 Mark Wielaard - 3.27.1-1 - Valgrind 3.27.1 final