Compare commits

...
Sign in to create a new pull request.

3 commits

Author SHA1 Message Date
Mark Wielaard
b0575f8b27 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
2025-03-12 15:40:53 +01:00
Mark Wielaard
fa61831cd8 3.24.0-4 - Add 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch 2025-03-12 15:38:28 +01:00
Mark Wielaard
d0a2c45b3c 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
2025-03-12 15:33:18 +01:00
8 changed files with 655 additions and 1 deletions

View file

@ -0,0 +1,144 @@
From a2c30f44ac39eb36baa4e831b041fe7cdf25e481 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
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

View file

@ -0,0 +1,147 @@
From febe1ccef09f70777b086f938c03f3e71989a7c8 Mon Sep 17 00:00:00 2001
From: Paul Floyd <pjfloyd@wanadoo.fr>
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 <fcntl.h>
+
+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

View file

@ -0,0 +1,60 @@
From b732f86998e39ca8714330f487804428b54c481c Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
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

View file

@ -0,0 +1,70 @@
From 9e4b5f1cc9f09f61fd3fb0e5687d0fc5ef39f15d Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
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

View file

@ -0,0 +1,57 @@
From ec7335142384ec9da66871036803b96319b590eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
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

View file

@ -0,0 +1,101 @@
From 2c17a8a3e865816ee48e7f78148bbc7240c2a38c Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
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 <fweimer@redhat.com>
(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

View file

@ -0,0 +1,45 @@
From 7b2806871f15977db3a64a59f70d48f55ba3228e Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
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

View file

@ -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: 6%{?dist}
Epoch: 1
# This ignores licenses that are only found in the test or perf sources
@ -97,6 +97,14 @@ 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
BuildRequires: make
BuildRequires: glibc-devel
@ -247,6 +255,13 @@ Valgrind User Manual for details.
%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
%build
# LTO triggers undefined symbols in valgrind. But valgrind has a
@ -463,6 +478,21 @@ echo ===============END TESTING===============
%endif
%changelog
* Wed Mar 12 2025 Mark Wielaard <mjw@fedoraproject.org> - 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
* Wed Jan 15 2025 Mark Wielaard <mjw@fedoraproject.org> - 3.24.0-4
- Add 0015-ppc-test_dfp2-build-fix-for-GCC-15.patch
* Tue Jan 14 2025 Mark Wielaard <mjw@fedoraproject.org> - 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
* Tue Nov 26 2024 Mark Wielaard <mjw@fedoraproject.org> - 3.24.0-2
- Add VALGRIND_3_24_BRANCH patches
0001-Prepare-NEWS-for-branch-3.24-fixes.patch