summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/valgrind
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/valgrind')
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-Return-a-valid-exit_code-from-vg_regtest.patch7
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-configure-Drop-setting-mcpu-cortex-a8-on-arm.patch40
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-docs-Disable-manual-validation.patch7
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch40
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-memcheck-tests-Fix-timerfd-syscall-test.patch16
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-tests-arm-Use-O-instead-of-O0.patch34
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-valgrind-monitor.py-regular-expressions-should-use-r.patch64
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0002-Bug-476548-valgrind-3.22.0-fails-on-assertion-when-l.patch147
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0003-Add-fchmodat2-syscall-on-linux.patch221
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0004-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch137
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/Added-support-for-PPC-instructions-mfatbu-mfatbl.patch14
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/s390x_vec_op_t.patch9
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch7
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/valgrind-make-ld-XXX.so-strlen-intercept-optional.patch7
-rw-r--r--meta/recipes-devtools/valgrind/valgrind_3.23.0.bb (renamed from meta/recipes-devtools/valgrind/valgrind_3.22.0.bb)14
15 files changed, 104 insertions, 660 deletions
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-Return-a-valid-exit_code-from-vg_regtest.patch b/meta/recipes-devtools/valgrind/valgrind/0001-Return-a-valid-exit_code-from-vg_regtest.patch
index e7af5efecc..832a1c3d6e 100644
--- a/meta/recipes-devtools/valgrind/valgrind/0001-Return-a-valid-exit_code-from-vg_regtest.patch
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-Return-a-valid-exit_code-from-vg_regtest.patch
@@ -10,11 +10,9 @@ Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com>
10 tests/vg_regtest.in | 1 + 10 tests/vg_regtest.in | 1 +
11 1 file changed, 1 insertion(+) 11 1 file changed, 1 insertion(+)
12 12
13diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in
14index 909af3be8..f2799c4e3 100755
15--- a/tests/vg_regtest.in 13--- a/tests/vg_regtest.in
16+++ b/tests/vg_regtest.in 14+++ b/tests/vg_regtest.in
17@@ -403,6 +403,7 @@ sub mysystem($) 15@@ -401,6 +401,7 @@ sub mysystem($)
18 exit 1; 16 exit 1;
19 } 17 }
20 } 18 }
@@ -22,6 +20,3 @@ index 909af3be8..f2799c4e3 100755
22 } 20 }
23 # if $keepunfiltered, copies $1 to $1.unfiltered.out 21 # if $keepunfiltered, copies $1 to $1.unfiltered.out
24 # renames $0 tp $1 22 # renames $0 tp $1
25--
262.17.0
27
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-configure-Drop-setting-mcpu-cortex-a8-on-arm.patch b/meta/recipes-devtools/valgrind/valgrind/0001-configure-Drop-setting-mcpu-cortex-a8-on-arm.patch
new file mode 100644
index 0000000000..63a1a58c04
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-configure-Drop-setting-mcpu-cortex-a8-on-arm.patch
@@ -0,0 +1,40 @@
1From b17b6d7d3a65c14f91f090f3f4f9898d6fa3a9e4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 10 May 2024 16:27:34 -0700
4Subject: [PATCH] configure: Drop setting mcpu=cortex-a8 on arm
5
6The -march settings from environment expresses the flags
7appropriately, moreover, this conflicts when using armhf
8without neon [1]
9
10[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928224
11
12Upstream-Status: Submitted [https://bugs.kde.org/show_bug.cgi?id=454346]
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 configure.ac | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/configure.ac b/configure.ac
19index 39d8b6d..d61b3a6 100755
20--- a/configure.ac
21+++ b/configure.ac
22@@ -275,13 +275,13 @@ case "${host_cpu}" in
23
24 armv8*)
25 AC_MSG_RESULT([ok (${host_cpu})])
26- VGCONF_PLATFORM_ARM_ARCH="-marm -mcpu=cortex-a8"
27+ VGCONF_PLATFORM_ARM_ARCH="-marm"
28 ARCH_MAX="arm"
29 ;;
30
31 armv7*)
32 AC_MSG_RESULT([ok (${host_cpu})])
33- VGCONF_PLATFORM_ARM_ARCH="-marm -mcpu=cortex-a8"
34+ VGCONF_PLATFORM_ARM_ARCH="-marm"
35 ARCH_MAX="arm"
36 ;;
37
38--
392.45.0
40
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-docs-Disable-manual-validation.patch b/meta/recipes-devtools/valgrind/valgrind/0001-docs-Disable-manual-validation.patch
index 256ddb0c34..eba569c884 100644
--- a/meta/recipes-devtools/valgrind/valgrind/0001-docs-Disable-manual-validation.patch
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-docs-Disable-manual-validation.patch
@@ -18,11 +18,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
18 docs/Makefile.am | 2 +- 18 docs/Makefile.am | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-) 19 1 file changed, 1 insertion(+), 1 deletion(-)
20 20
21diff --git a/docs/Makefile.am b/docs/Makefile.am
22index d4250e8..c500306 100644
23--- a/docs/Makefile.am 21--- a/docs/Makefile.am
24+++ b/docs/Makefile.am 22+++ b/docs/Makefile.am
25@@ -192,7 +192,7 @@ valid-manpages: $(MANPAGES_XML_FILES) 23@@ -194,7 +194,7 @@ valid-manpages: $(MANPAGES_XML_FILES)
26 touch $@; \ 24 touch $@; \
27 fi 25 fi
28 26
@@ -31,6 +29,3 @@ index d4250e8..c500306 100644
31 29
32 # The text version of the FAQ. 30 # The text version of the FAQ.
33 FAQ.txt: 31 FAQ.txt:
34--
352.34.1
36
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch b/meta/recipes-devtools/valgrind/valgrind/0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch
index 073713c139..7996fa6e8f 100644
--- a/meta/recipes-devtools/valgrind/valgrind/0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch
@@ -19,30 +19,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
19 none/tests/arm/Makefile.am | 18 +++++++++--------- 19 none/tests/arm/Makefile.am | 18 +++++++++---------
20 3 files changed, 15 insertions(+), 15 deletions(-) 20 3 files changed, 15 insertions(+), 15 deletions(-)
21 21
22diff --git a/Makefile.all.am b/Makefile.all.am
23index 02059a3..c7c4700 100644
24--- a/Makefile.all.am
25+++ b/Makefile.all.am
26@@ -197,11 +197,11 @@ AM_CCASFLAGS_PPC64LE_LINUX = @FLAG_M64@ -g
27
28 AM_FLAG_M3264_ARM_LINUX = @FLAG_M32@
29 AM_CFLAGS_ARM_LINUX = @FLAG_M32@ \
30- $(AM_CFLAGS_BASE) -marm -mcpu=cortex-a8
31+ $(AM_CFLAGS_BASE) -marm
32 AM_CFLAGS_PSO_ARM_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) \
33- -marm -mcpu=cortex-a8 $(AM_CFLAGS_PSO_BASE)
34+ -marm $(AM_CFLAGS_PSO_BASE)
35 AM_CCASFLAGS_ARM_LINUX = @FLAG_M32@ \
36- -marm -mcpu=cortex-a8 -g
37+ -marm -g
38
39 AM_FLAG_M3264_ARM64_LINUX = @FLAG_M64@
40 AM_CFLAGS_ARM64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE)
41diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am
42index df82169..07eb66a 100644
43--- a/helgrind/tests/Makefile.am 22--- a/helgrind/tests/Makefile.am
44+++ b/helgrind/tests/Makefile.am 23+++ b/helgrind/tests/Makefile.am
45@@ -189,9 +189,9 @@ if ! VGCONF_PLATFORMS_INCLUDE_X86_DARWIN 24@@ -223,9 +223,9 @@ if ! VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
46 endif 25 endif
47 26
48 if VGCONF_PLATFORMS_INCLUDE_ARM_LINUX 27 if VGCONF_PLATFORMS_INCLUDE_ARM_LINUX
@@ -55,11 +34,9 @@ index df82169..07eb66a 100644
55 else 34 else
56 annotate_hbefore_CFLAGS = $(AM_CFLAGS) 35 annotate_hbefore_CFLAGS = $(AM_CFLAGS)
57 tc07_hbl1_CFLAGS = $(AM_CFLAGS) 36 tc07_hbl1_CFLAGS = $(AM_CFLAGS)
58diff --git a/none/tests/arm/Makefile.am b/none/tests/arm/Makefile.am
59index 024eb6d..ccecb90 100644
60--- a/none/tests/arm/Makefile.am 37--- a/none/tests/arm/Makefile.am
61+++ b/none/tests/arm/Makefile.am 38+++ b/none/tests/arm/Makefile.am
62@@ -52,10 +52,10 @@ allexec_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_NONNULL@ 39@@ -56,10 +56,10 @@ allexec_CFLAGS = $(AM_CFLAGS) @FLAG_W_N
63 # need special helping w.r.t -mfpu and -mfloat-abi, though. 40 # need special helping w.r.t -mfpu and -mfloat-abi, though.
64 # Also force -O0 since -O takes hundreds of MB of memory 41 # Also force -O0 since -O takes hundreds of MB of memory
65 # for v6intThumb.c. 42 # for v6intThumb.c.
@@ -71,11 +48,11 @@ index 024eb6d..ccecb90 100644
71-v6media_CFLAGS = $(AM_CFLAGS) -g -O0 -mcpu=cortex-a8 -mthumb 48-v6media_CFLAGS = $(AM_CFLAGS) -g -O0 -mcpu=cortex-a8 -mthumb
72+v6media_CFLAGS = $(AM_CFLAGS) -g -O0 -mthumb 49+v6media_CFLAGS = $(AM_CFLAGS) -g -O0 -mthumb
73 50
74 v8crypto_a_CFLAGS = $(AM_CFLAGS) -g -O0 -mfpu=crypto-neon-fp-armv8 -marm 51 v8crypto_a_CFLAGS = $(AM_CFLAGS) -g -O0 -mfpu=crypto-neon-fp-armv8 -marm -march=armv8-a
75 v8crypto_t_CFLAGS = $(AM_CFLAGS) -g -O0 -mfpu=crypto-neon-fp-armv8 -mthumb 52 v8crypto_t_CFLAGS = $(AM_CFLAGS) -g -O0 -mfpu=crypto-neon-fp-armv8 -mthumb -march=armv8-a
76@@ -65,23 +65,23 @@ v8memory_a_CFLAGS = $(AM_CFLAGS) -g -O0 \ 53@@ -74,23 +74,23 @@ v8memory_t_CFLAGS = $(AM_CFLAGS) -g -O0
77 v8memory_t_CFLAGS = $(AM_CFLAGS) -g -O0 \ 54
78 -march=armv8-a -mfpu=crypto-neon-fp-armv8 -mthumb 55 vcvt_fixed_float_VFP_CFLAGS = $(AM_CFLAGS) -g -O0 -mcpu=cortex-a8 -mfpu=neon
79 56
80-vfp_CFLAGS = $(AM_CFLAGS) -g -O0 -mcpu=cortex-a8 \ 57-vfp_CFLAGS = $(AM_CFLAGS) -g -O0 -mcpu=cortex-a8 \
81+vfp_CFLAGS = $(AM_CFLAGS) -g -O0 \ 58+vfp_CFLAGS = $(AM_CFLAGS) -g -O0 \
@@ -103,6 +80,3 @@ index 024eb6d..ccecb90 100644
103+vcvt_fixed_float_VFP_CFLAGS = $(AM_CFLAGS) -g -mfpu=vfpv3 80+vcvt_fixed_float_VFP_CFLAGS = $(AM_CFLAGS) -g -mfpu=vfpv3
104 81
105 vfpv4_fma_CFLAGS = $(AM_CFLAGS) -g -O0 -march=armv7ve -mcpu=cortex-a15 -mfpu=vfpv4 -marm 82 vfpv4_fma_CFLAGS = $(AM_CFLAGS) -g -O0 -march=armv7ve -mcpu=cortex-a15 -mfpu=vfpv4 -marm
106--
1072.12.2
108
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-memcheck-tests-Fix-timerfd-syscall-test.patch b/meta/recipes-devtools/valgrind/valgrind/0001-memcheck-tests-Fix-timerfd-syscall-test.patch
index 15fbbe954f..29a9e95a90 100644
--- a/meta/recipes-devtools/valgrind/valgrind/0001-memcheck-tests-Fix-timerfd-syscall-test.patch
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-memcheck-tests-Fix-timerfd-syscall-test.patch
@@ -17,7 +17,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
17 17
18--- a/config.h.in 18--- a/config.h.in
19+++ b/config.h.in 19+++ b/config.h.in
20@@ -301,6 +301,9 @@ 20@@ -424,6 +424,9 @@
21 /* Define to 1 if you have the <sys/sysnvl.h> header file. */ 21 /* Define to 1 if you have the <sys/sysnvl.h> header file. */
22 #undef HAVE_SYS_SYSNVL_H 22 #undef HAVE_SYS_SYSNVL_H
23 23
@@ -29,7 +29,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
29 29
30--- a/configure.ac 30--- a/configure.ac
31+++ b/configure.ac 31+++ b/configure.ac
32@@ -4098,6 +4098,7 @@ AC_CHECK_HEADERS([ \ 32@@ -4881,6 +4881,7 @@ AC_CHECK_HEADERS([ \
33 sys/syscall.h \ 33 sys/syscall.h \
34 sys/sysnvl.h \ 34 sys/sysnvl.h \
35 sys/time.h \ 35 sys/time.h \
@@ -39,7 +39,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
39 39
40--- a/memcheck/tests/linux/timerfd-syscall.c 40--- a/memcheck/tests/linux/timerfd-syscall.c
41+++ b/memcheck/tests/linux/timerfd-syscall.c 41+++ b/memcheck/tests/linux/timerfd-syscall.c
42@@ -45,6 +45,9 @@ 42@@ -42,6 +42,9 @@
43 #if defined(HAVE_SYS_TIME_H) 43 #if defined(HAVE_SYS_TIME_H)
44 #include <sys/time.h> 44 #include <sys/time.h>
45 #endif 45 #endif
@@ -49,7 +49,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
49 #if defined(HAVE_SYS_TYPES_H) 49 #if defined(HAVE_SYS_TYPES_H)
50 #include <sys/types.h> 50 #include <sys/types.h>
51 #endif 51 #endif
52@@ -54,7 +57,8 @@ 52@@ -51,7 +54,8 @@
53 * timerfd_* system call numbers introduced in 2.6.23. These constants are 53 * timerfd_* system call numbers introduced in 2.6.23. These constants are
54 * not yet in the glibc 2.7 headers, that is why they are defined here. 54 * not yet in the glibc 2.7 headers, that is why they are defined here.
55 */ 55 */
@@ -59,7 +59,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
59 #if defined(__x86_64__) 59 #if defined(__x86_64__)
60 #define __NR_timerfd_create 283 60 #define __NR_timerfd_create 283
61 #elif defined(__i386__) 61 #elif defined(__i386__)
62@@ -67,8 +71,10 @@ 62@@ -64,8 +68,10 @@
63 #error Cannot detect your architecture! 63 #error Cannot detect your architecture!
64 #endif 64 #endif
65 #endif 65 #endif
@@ -71,7 +71,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
71 #if defined(__x86_64__) 71 #if defined(__x86_64__)
72 #define __NR_timerfd_settime 286 72 #define __NR_timerfd_settime 286
73 #define __NR_timerfd_gettime 287 73 #define __NR_timerfd_gettime 287
74@@ -85,7 +91,7 @@ 74@@ -82,7 +88,7 @@
75 #error Cannot detect your architecture! 75 #error Cannot detect your architecture!
76 #endif 76 #endif
77 #endif 77 #endif
@@ -80,7 +80,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
80 80
81 81
82 /* Definitions from include/linux/timerfd.h */ 82 /* Definitions from include/linux/timerfd.h */
83@@ -127,6 +133,7 @@ void set_timespec(struct timespec *tmr, 83@@ -124,6 +130,7 @@ void set_timespec(struct timespec *tmr,
84 tmr->tv_nsec = (long) (1000ULL * (ustime % 1000000ULL)); 84 tmr->tv_nsec = (long) (1000ULL * (ustime % 1000000ULL));
85 } 85 }
86 86
@@ -88,7 +88,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
88 int timerfd_create(int clockid, int flags) 88 int timerfd_create(int clockid, int flags)
89 { 89 {
90 return syscall(__NR_timerfd_create, clockid, flags); 90 return syscall(__NR_timerfd_create, clockid, flags);
91@@ -142,6 +149,7 @@ int timerfd_gettime(int ufc, struct itim 91@@ -139,6 +146,7 @@ int timerfd_gettime(int ufc, struct itim
92 { 92 {
93 return syscall(__NR_timerfd_gettime, ufc, otmr); 93 return syscall(__NR_timerfd_gettime, ufc, otmr);
94 } 94 }
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-tests-arm-Use-O-instead-of-O0.patch b/meta/recipes-devtools/valgrind/valgrind/0001-tests-arm-Use-O-instead-of-O0.patch
new file mode 100644
index 0000000000..2d28bcb6c4
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-tests-arm-Use-O-instead-of-O0.patch
@@ -0,0 +1,34 @@
1From 8e907753625faba3284925983ef8e83f8491aa76 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 10 May 2024 17:44:47 -0700
4Subject: [PATCH] tests/arm: Use -O instead of -O0
5
6GCC-14 fails to compile the testcase with -O2 [1]
7therefore workaround it by using -O1, which works
8and for OE/cross-compiling it is fine, -O0 is used
9to make these tests compile natively on an arm target
10and gcc would take less memory compiling with -O0
11-O would take a bit more memory but in cross compiling
12we have enough of it on build host.
13
14[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115042
15Upstream-Status: Inappropriate [WORKAROUND]
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 none/tests/arm/Makefile.am | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21--- a/none/tests/arm/Makefile.am
22+++ b/none/tests/arm/Makefile.am
23@@ -57,9 +57,9 @@ allexec_CFLAGS = $(AM_CFLAGS) @FLAG_W_N
24 # Also force -O0 since -O takes hundreds of MB of memory
25 # for v6intThumb.c.
26 v6intARM_CFLAGS = $(AM_CFLAGS) -g -O0 -marm
27-v6intThumb_CFLAGS = $(AM_CFLAGS) -g -O0 -mthumb
28+v6intThumb_CFLAGS = $(AM_CFLAGS) -g -O -mthumb
29
30-v6media_CFLAGS = $(AM_CFLAGS) -g -O0 -mthumb
31+v6media_CFLAGS = $(AM_CFLAGS) -g -O -mthumb
32
33 v8crypto_a_CFLAGS = $(AM_CFLAGS) -g -O0 -mfpu=crypto-neon-fp-armv8 -marm -march=armv8-a
34 v8crypto_t_CFLAGS = $(AM_CFLAGS) -g -O0 -mfpu=crypto-neon-fp-armv8 -mthumb -march=armv8-a
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-valgrind-monitor.py-regular-expressions-should-use-r.patch b/meta/recipes-devtools/valgrind/valgrind/0001-valgrind-monitor.py-regular-expressions-should-use-r.patch
deleted file mode 100644
index 80a8e3a10b..0000000000
--- a/meta/recipes-devtools/valgrind/valgrind/0001-valgrind-monitor.py-regular-expressions-should-use-r.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1From 027b649fdb831868e71be01cafdacc49a5f419ab Mon Sep 17 00:00:00 2001
2From: Mark Wielaard <mark@klomp.org>
3Date: Fri, 17 Nov 2023 14:01:21 +0100
4Subject: [PATCH 1/4] valgrind-monitor.py regular expressions should use raw
5 strings
6
7With python 3.12 gdb will produce the following SyntaxWarning when
8loading valgrind-monitor-def.py:
9
10 /usr/share/gdb/auto-load/valgrind-monitor-def.py:214:
11 SyntaxWarning: invalid escape sequence '\['
12 if re.fullmatch("^0x[0123456789ABCDEFabcdef]+\[[^\[\]]+\]$", arg_str):
13
14In a future python version this will become an SyntaxError.
15
16Use a raw strings for the regular expression.
17
18https://bugs.kde.org/show_bug.cgi?id=476708
19(cherry picked from commit 0fbfbe05028ad18efda786a256a2738d2c231ed4)
20
21Upstream-Status: Backport [https://sourceware.org/git/?p=valgrind.git;a=commit;h=027b649fdb831868e71be01cafdacc49a5f419ab]
22Signed-off-by: Khem Raj <raj.khem@gmail.com>
23---
24 NEWS | 13 +++++++++++++
25 coregrind/m_gdbserver/valgrind-monitor-def.py | 2 +-
26 2 files changed, 14 insertions(+), 1 deletion(-)
27
28diff --git a/NEWS b/NEWS
29index f11da4be8..ee5b4ff11 100644
30--- a/NEWS
31+++ b/NEWS
32@@ -1,3 +1,16 @@
33+Branch 3.22
34+~~~~~~~~~~~
35+
36+* ==================== FIXED BUGS ====================
37+
38+The following bugs have been fixed or resolved on this branch.
39+
40+476708 valgrind-monitor.py regular expressions should use raw strings
41+
42+To see details of a given bug, visit
43+ https://bugs.kde.org/show_bug.cgi?id=XXXXXX
44+where XXXXXX is the bug number as listed above.
45+
46 Release 3.22.0 (31 Oct 2023)
47 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48
49diff --git a/coregrind/m_gdbserver/valgrind-monitor-def.py b/coregrind/m_gdbserver/valgrind-monitor-def.py
50index b4e7b992d..d74b1590c 100644
51--- a/coregrind/m_gdbserver/valgrind-monitor-def.py
52+++ b/coregrind/m_gdbserver/valgrind-monitor-def.py
53@@ -211,7 +211,7 @@ class Valgrind_ADDR_LEN_opt(Valgrind_Command):
54 For compatibility reason with the Valgrind gdbserver monitor command,
55 we detect and accept usages such as 0x1234ABCD[10]."""
56 def invoke(self, arg_str : str, from_tty : bool) -> None:
57- if re.fullmatch("^0x[0123456789ABCDEFabcdef]+\[[^\[\]]+\]$", arg_str):
58+ if re.fullmatch(r"^0x[0123456789ABCDEFabcdef]+\[[^\[\]]+\]$", arg_str):
59 arg_str = arg_str.replace("[", " ")
60 arg_str = arg_str.replace("]", " ")
61 eval_execute_2(self, arg_str,
62--
632.44.0
64
diff --git a/meta/recipes-devtools/valgrind/valgrind/0002-Bug-476548-valgrind-3.22.0-fails-on-assertion-when-l.patch b/meta/recipes-devtools/valgrind/valgrind/0002-Bug-476548-valgrind-3.22.0-fails-on-assertion-when-l.patch
deleted file mode 100644
index 5759fa039a..0000000000
--- a/meta/recipes-devtools/valgrind/valgrind/0002-Bug-476548-valgrind-3.22.0-fails-on-assertion-when-l.patch
+++ /dev/null
@@ -1,147 +0,0 @@
1From 1d00e5ce0fb069911c4b525ec38289fb5d9021b0 Mon Sep 17 00:00:00 2001
2From: Paul Floyd <pjfloyd@wanadoo.fr>
3Date: Sat, 18 Nov 2023 08:49:34 +0100
4Subject: [PATCH 2/4] Bug 476548 - valgrind 3.22.0 fails on assertion when
5 loading debuginfo file produced by mold
6
7(cherry picked from commit 9ea4ae66707a4dcc6f4328e11911652e4418c585)
8
9Upstream-Status: Backport [https://sourceware.org/git/?p=valgrind.git;a=commit;h=1d00e5ce0fb069911c4b525ec38289fb5d9021b0]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 NEWS | 2 ++
13 coregrind/m_debuginfo/image.c | 14 +++++++++
14 coregrind/m_debuginfo/priv_image.h | 4 +++
15 coregrind/m_debuginfo/readelf.c | 49 ++++++++++++++++++++++++++++--
16 4 files changed, 66 insertions(+), 3 deletions(-)
17
18diff --git a/NEWS b/NEWS
19index ee5b4ff11..6cd13429a 100644
20--- a/NEWS
21+++ b/NEWS
22@@ -5,6 +5,8 @@ Branch 3.22
23
24 The following bugs have been fixed or resolved on this branch.
25
26+476548 valgrind 3.22.0 fails on assertion when loading debuginfo
27+ file produced by mold
28 476708 valgrind-monitor.py regular expressions should use raw strings
29
30 To see details of a given bug, visit
31diff --git a/coregrind/m_debuginfo/image.c b/coregrind/m_debuginfo/image.c
32index 02e509071..445f95555 100644
33--- a/coregrind/m_debuginfo/image.c
34+++ b/coregrind/m_debuginfo/image.c
35@@ -1221,6 +1221,20 @@ Int ML_(img_strcmp_c)(DiImage* img, DiOffT off1, const HChar* str2)
36 }
37 }
38
39+Int ML_(img_strcmp_n)(DiImage* img, DiOffT off1, const HChar* str2, Word n)
40+{
41+ ensure_valid(img, off1, 1, "ML_(img_strcmp_c)");
42+ while (n) {
43+ UChar c1 = get(img, off1);
44+ UChar c2 = *(const UChar*)str2;
45+ if (c1 < c2) return -1;
46+ if (c1 > c2) return 1;
47+ if (c1 == 0) return 0;
48+ off1++; str2++; --n;
49+ }
50+ return 0;
51+}
52+
53 UChar ML_(img_get_UChar)(DiImage* img, DiOffT offset)
54 {
55 ensure_valid(img, offset, 1, "ML_(img_get_UChar)");
56diff --git a/coregrind/m_debuginfo/priv_image.h b/coregrind/m_debuginfo/priv_image.h
57index a49846f14..c91e49f01 100644
58--- a/coregrind/m_debuginfo/priv_image.h
59+++ b/coregrind/m_debuginfo/priv_image.h
60@@ -115,6 +115,10 @@ Int ML_(img_strcmp)(DiImage* img, DiOffT off1, DiOffT off2);
61 cast to HChar before comparison. */
62 Int ML_(img_strcmp_c)(DiImage* img, DiOffT off1, const HChar* str2);
63
64+/* Do strncmp of a C string in the image vs a normal one. Chars are
65+ cast to HChar before comparison. */
66+Int ML_(img_strcmp_n)(DiImage* img, DiOffT off1, const HChar* str2, Word n);
67+
68 /* Do strlen of a C string in the image. */
69 SizeT ML_(img_strlen)(DiImage* img, DiOffT off);
70
71diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
72index fb64ed976..46f8c8343 100644
73--- a/coregrind/m_debuginfo/readelf.c
74+++ b/coregrind/m_debuginfo/readelf.c
75@@ -2501,8 +2501,7 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
76 di->rodata_avma += inrw1->bias;
77 di->rodata_bias = inrw1->bias;
78 di->rodata_debug_bias = inrw1->bias;
79- }
80- else {
81+ } else {
82 BAD(".rodata"); /* should not happen? */
83 }
84 di->rodata_present = True;
85@@ -2977,6 +2976,46 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
86 return retval;
87 }
88
89+static void find_rodata(Word i, Word shnum, DiImage* dimg, struct _DebugInfo* di, DiOffT shdr_dioff,
90+ UWord shdr_dent_szB, DiOffT shdr_strtab_dioff, PtrdiffT rw_dbias)
91+{
92+ ElfXX_Shdr a_shdr;
93+ ElfXX_Shdr a_extra_shdr;
94+ ML_(img_get)(&a_shdr, dimg,
95+ INDEX_BIS(shdr_dioff, i, shdr_dent_szB),
96+ sizeof(a_shdr));
97+ if (di->rodata_present &&
98+ 0 == ML_(img_strcmp_c)(dimg, shdr_strtab_dioff
99+ + a_shdr.sh_name, ".rodata")) {
100+ Word sh_size = a_shdr.sh_size;
101+ Word j;
102+ Word next_addr = a_shdr.sh_addr + a_shdr.sh_size;
103+ for (j = i + 1; j < shnum; ++j) {
104+ ML_(img_get)(&a_extra_shdr, dimg,
105+ INDEX_BIS(shdr_dioff, j, shdr_dent_szB),
106+ sizeof(a_shdr));
107+ if (0 == ML_(img_strcmp_n)(dimg, shdr_strtab_dioff
108+ + a_extra_shdr.sh_name, ".rodata", 7)) {
109+ if (a_extra_shdr.sh_addr ==
110+ VG_ROUNDUP(next_addr, a_extra_shdr.sh_addralign)) {
111+ sh_size = VG_ROUNDUP(sh_size, a_extra_shdr.sh_addralign) + a_extra_shdr.sh_size;
112+ }
113+ next_addr = a_extra_shdr.sh_addr + a_extra_shdr.sh_size;
114+ } else {
115+ break;
116+ }
117+ }
118+ vg_assert(di->rodata_size == sh_size);
119+ vg_assert(di->rodata_avma + a_shdr.sh_addr + rw_dbias);
120+ di->rodata_debug_svma = a_shdr.sh_addr;
121+ di->rodata_debug_bias = di->rodata_bias +
122+ di->rodata_svma - di->rodata_debug_svma;
123+ TRACE_SYMTAB("acquiring .rodata debug svma = %#lx .. %#lx\n",
124+ di->rodata_debug_svma,
125+ di->rodata_debug_svma + di->rodata_size - 1);
126+ TRACE_SYMTAB("acquiring .rodata debug bias = %#lx\n", (UWord)di->rodata_debug_bias);
127+ }
128+}
129 Bool ML_(read_elf_debug) ( struct _DebugInfo* di )
130 {
131 Word i, j;
132@@ -3391,7 +3430,11 @@ Bool ML_(read_elf_debug) ( struct _DebugInfo* di )
133 FIND(text, rx)
134 FIND(data, rw)
135 FIND(sdata, rw)
136- FIND(rodata, rw)
137+ // https://bugs.kde.org/show_bug.cgi?id=476548
138+ // special handling for rodata as adjacent
139+ // rodata sections may have been merged in ML_(read_elf_object)
140+ //FIND(rodata, rw)
141+ find_rodata(i, ehdr_dimg.e_shnum, dimg, di, shdr_dioff, shdr_dent_szB, shdr_strtab_dioff, rw_dbias);
142 FIND(bss, rw)
143 FIND(sbss, rw)
144
145--
1462.44.0
147
diff --git a/meta/recipes-devtools/valgrind/valgrind/0003-Add-fchmodat2-syscall-on-linux.patch b/meta/recipes-devtools/valgrind/valgrind/0003-Add-fchmodat2-syscall-on-linux.patch
deleted file mode 100644
index 2a09ca52b7..0000000000
--- a/meta/recipes-devtools/valgrind/valgrind/0003-Add-fchmodat2-syscall-on-linux.patch
+++ /dev/null
@@ -1,221 +0,0 @@
1From a43e62dddcf51ec6578a90c5988a41e856b44b05 Mon Sep 17 00:00:00 2001
2From: Mark Wielaard <mark@klomp.org>
3Date: Sat, 18 Nov 2023 21:17:02 +0100
4Subject: [PATCH 3/4] Add fchmodat2 syscall on linux
5
6fchmodat2 is a new syscall on linux 6.6. It is a variant of fchmodat
7that takes an extra flags argument.
8
9https://bugs.kde.org/show_bug.cgi?id=477198
10
11(cherry picked from commit 372d09fd9a8d76847c81092ebff71c80fd6c145d)
12
13Upstream-Status: Backport [https://sourceware.org/git/?p=valgrind.git;a=commit;h=a43e62dddcf51ec6578a90c5988a41e856b44b05]
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 NEWS | 1 +
17 coregrind/m_syswrap/priv_syswrap-linux.h | 3 +++
18 coregrind/m_syswrap/syswrap-amd64-linux.c | 2 ++
19 coregrind/m_syswrap/syswrap-arm-linux.c | 2 ++
20 coregrind/m_syswrap/syswrap-arm64-linux.c | 2 ++
21 coregrind/m_syswrap/syswrap-linux.c | 11 +++++++++++
22 coregrind/m_syswrap/syswrap-mips32-linux.c | 2 ++
23 coregrind/m_syswrap/syswrap-mips64-linux.c | 1 +
24 coregrind/m_syswrap/syswrap-nanomips-linux.c | 1 +
25 coregrind/m_syswrap/syswrap-ppc32-linux.c | 2 ++
26 coregrind/m_syswrap/syswrap-ppc64-linux.c | 2 ++
27 coregrind/m_syswrap/syswrap-s390x-linux.c | 2 ++
28 coregrind/m_syswrap/syswrap-x86-linux.c | 2 ++
29 include/vki/vki-scnums-shared-linux.h | 2 ++
30 14 files changed, 35 insertions(+)
31
32diff --git a/NEWS b/NEWS
33index 6cd13429a..da0f8c1aa 100644
34--- a/NEWS
35+++ b/NEWS
36@@ -8,6 +8,7 @@ The following bugs have been fixed or resolved on this branch.
37 476548 valgrind 3.22.0 fails on assertion when loading debuginfo
38 file produced by mold
39 476708 valgrind-monitor.py regular expressions should use raw strings
40+477198 Add fchmodat2 syscall on linux
41
42 To see details of a given bug, visit
43 https://bugs.kde.org/show_bug.cgi?id=XXXXXX
44diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h
45index 7c9decf5a..798c456c9 100644
46--- a/coregrind/m_syswrap/priv_syswrap-linux.h
47+++ b/coregrind/m_syswrap/priv_syswrap-linux.h
48@@ -331,6 +331,9 @@ DECL_TEMPLATE(linux, sys_openat2);
49 // Linux-specific (new in Linux 5.14)
50 DECL_TEMPLATE(linux, sys_memfd_secret);
51
52+// Since Linux 6.6
53+DECL_TEMPLATE(linux, sys_fchmodat2);
54+
55 /* ---------------------------------------------------------------------
56 Wrappers for sockets and ipc-ery. These are split into standalone
57 procedures because x86-linux hides them inside multiplexors
58diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
59index 008600798..fe17d118b 100644
60--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
61+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
62@@ -886,6 +886,8 @@ static SyscallTableEntry syscall_table[] = {
63 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
64
65 LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
66+
67+ LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
68 };
69
70 SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
71diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
72index 9a7a1e0d2..811931d3b 100644
73--- a/coregrind/m_syswrap/syswrap-arm-linux.c
74+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
75@@ -1059,6 +1059,8 @@ static SyscallTableEntry syscall_main_table[] = {
76 LINX_(__NR_faccessat2, sys_faccessat2), // 439
77
78 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
79+
80+ LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
81 };
82
83
84diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
85index 6af7bab83..3307bc2ca 100644
86--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
87+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
88@@ -840,6 +840,8 @@ static SyscallTableEntry syscall_main_table[] = {
89 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
90
91 LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
92+
93+ LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
94 };
95
96
97diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
98index d571fc327..efa47f2e6 100644
99--- a/coregrind/m_syswrap/syswrap-linux.c
100+++ b/coregrind/m_syswrap/syswrap-linux.c
101@@ -6059,6 +6059,17 @@ PRE(sys_fchmodat)
102 PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 );
103 }
104
105+PRE(sys_fchmodat2)
106+{
107+ PRINT("sys_fchmodat2 ( %ld, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %"
108+ FMT_REGWORD "u )",
109+ SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4);
110+ PRE_REG_READ4(long, "fchmodat2",
111+ int, dfd, const char *, path, vki_mode_t, mode,
112+ unsigned int, flags);
113+ PRE_MEM_RASCIIZ( "fchmodat2(pathname)", ARG2 );
114+}
115+
116 PRE(sys_faccessat)
117 {
118 PRINT("sys_faccessat ( %ld, %#" FMT_REGWORD "x(%s), %ld )",
119diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c
120index 6268a00dd..74a1f6eac 100644
121--- a/coregrind/m_syswrap/syswrap-mips32-linux.c
122+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c
123@@ -1143,6 +1143,8 @@ static SyscallTableEntry syscall_main_table[] = {
124 LINX_ (__NR_faccessat2, sys_faccessat2), // 439
125
126 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
127+
128+ LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
129 };
130
131 SyscallTableEntry* ML_(get_linux_syscall_entry) (UInt sysno)
132diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c
133index 6cdf25893..4e8508b7a 100644
134--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
135+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
136@@ -820,6 +820,7 @@ static SyscallTableEntry syscall_main_table[] = {
137 LINXY (__NR_close_range, sys_close_range),
138 LINX_ (__NR_faccessat2, sys_faccessat2),
139 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2),
140+ LINX_ (__NR_fchmodat2, sys_fchmodat2),
141 };
142
143 SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno )
144diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c
145index d724cde74..7859900c1 100644
146--- a/coregrind/m_syswrap/syswrap-nanomips-linux.c
147+++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c
148@@ -829,6 +829,7 @@ static SyscallTableEntry syscall_main_table[] = {
149 LINXY (__NR_close_range, sys_close_range),
150 LINX_ (__NR_faccessat2, sys_faccessat2),
151 LINXY (__NR_epoll_pwait2, sys_epoll_pwait2),
152+ LINX_ (__NR_fchmodat2, sys_fchmodat2),
153 };
154
155 SyscallTableEntry* ML_(get_linux_syscall_entry) (UInt sysno)
156diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c
157index c0cfef235..1e19116ee 100644
158--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
159+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
160@@ -1063,6 +1063,8 @@ static SyscallTableEntry syscall_table[] = {
161 LINX_(__NR_faccessat2, sys_faccessat2), // 439
162
163 LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441
164+
165+ LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
166 };
167
168 SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
169diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
170index f5976f30c..1097212a4 100644
171--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
172+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
173@@ -1032,6 +1032,8 @@ static SyscallTableEntry syscall_table[] = {
174 LINX_(__NR_faccessat2, sys_faccessat2), // 439
175
176 LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441
177+
178+ LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
179 };
180
181 SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
182diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
183index afba154e7..3588672c7 100644
184--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
185+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
186@@ -873,6 +873,8 @@ static SyscallTableEntry syscall_table[] = {
187 LINX_(__NR_faccessat2, sys_faccessat2), // 439
188
189 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
190+
191+ LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
192 };
193
194 SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
195diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
196index da4fd8fa2..58badc6b0 100644
197--- a/coregrind/m_syswrap/syswrap-x86-linux.c
198+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
199@@ -1658,6 +1658,8 @@ static SyscallTableEntry syscall_table[] = {
200 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
201
202 LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
203+
204+ LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
205 };
206
207 SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
208diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h
209index 542382b53..a4cd87149 100644
210--- a/include/vki/vki-scnums-shared-linux.h
211+++ b/include/vki/vki-scnums-shared-linux.h
212@@ -50,4 +50,6 @@
213
214 #define __NR_memfd_secret 447
215
216+#define __NR_fchmodat2 452
217+
218 #endif
219--
2202.44.0
221
diff --git a/meta/recipes-devtools/valgrind/valgrind/0004-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch b/meta/recipes-devtools/valgrind/valgrind/0004-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch
deleted file mode 100644
index 4e9185508a..0000000000
--- a/meta/recipes-devtools/valgrind/valgrind/0004-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch
+++ /dev/null
@@ -1,137 +0,0 @@
1From 41ff9aa49f6c54c66d0e6b37f265fd9cb0176057 Mon Sep 17 00:00:00 2001
2From: Paul Floyd <pjfloyd@wanadoo.fr>
3Date: Sun, 17 Dec 2023 14:18:51 +0100
4Subject: [PATCH 4/4] Bug 478624 - Valgrind incompatibility with binutils-2.42
5 on x86 with new nop patterns (unhandled instruction bytes: 0x2E 0x8D 0xB4
6 0x26)
7
8It was a bit of a struggle to get the testcase to build
9with both clang and gcc (oddly enough gcc was more difficult) so
10I just resorted to using .byte arrays.
11
12(cherry picked from commit d35005cef8ad8207542738812705ceabf137d7e0)
13
14Upstream-Status: Backport [https://sourceware.org/git/?p=valgrind.git;a=commit;h=41ff9aa49f6c54c66d0e6b37f265fd9cb0176057]
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 .gitignore | 1 +
18 NEWS | 2 ++
19 VEX/priv/guest_x86_toIR.c | 22 +++++++++++++-
20 none/tests/x86/Makefile.am | 2 ++
21 none/tests/x86/gnu_binutils_nop.c | 34 ++++++++++++++++++++++
22 none/tests/x86/gnu_binutils_nop.stderr.exp | 0
23 none/tests/x86/gnu_binutils_nop.vgtest | 2 ++
24 7 files changed, 62 insertions(+), 1 deletion(-)
25 create mode 100644 none/tests/x86/gnu_binutils_nop.c
26 create mode 100644 none/tests/x86/gnu_binutils_nop.stderr.exp
27 create mode 100644 none/tests/x86/gnu_binutils_nop.vgtest
28
29--- a/NEWS
30+++ b/NEWS
31@@ -9,6 +9,8 @@ The following bugs have been fixed or re
32 file produced by mold
33 476708 valgrind-monitor.py regular expressions should use raw strings
34 477198 Add fchmodat2 syscall on linux
35+478624 Valgrind incompatibility with binutils-2.42 on x86 with new nop patterns
36+ (unhandled instruction bytes: 0x2E 0x8D 0xB4 0x26)
37
38 To see details of a given bug, visit
39 https://bugs.kde.org/show_bug.cgi?id=XXXXXX
40--- a/VEX/priv/guest_x86_toIR.c
41+++ b/VEX/priv/guest_x86_toIR.c
42@@ -8198,7 +8198,7 @@ DisResult disInstr_X86_WRK (
43 delta += 5;
44 goto decode_success;
45 }
46- /* Don't barf on recent binutils padding,
47+ /* Don't barf on recent (2010) binutils padding,
48 all variants of which are: nopw %cs:0x0(%eax,%eax,1)
49 66 2e 0f 1f 84 00 00 00 00 00
50 66 66 2e 0f 1f 84 00 00 00 00 00
51@@ -8222,6 +8222,26 @@ DisResult disInstr_X86_WRK (
52 goto decode_success;
53 }
54 }
55+
56+ /* bug478624 GNU binutils uses a leal of esi into itself with
57+ a zero offset and CS prefix as an 8 byte no-op (Dec 2023).
58+ Since the CS prefix is hardly ever used we don't do much
59+ to decode it, just a few cases for conditional branches.
60+ So add handling here with other pseudo-no-ops.
61+ */
62+ if (code[0] == 0x2E && code[1] == 0x8D) {
63+ if (code[2] == 0x74 && code[3] == 0x26 && code[4] == 0x00) {
64+ DIP("leal %%cs:0(%%esi,%%eiz,1),%%esi\n");
65+ delta += 5;
66+ goto decode_success;
67+ }
68+ if (code[2] == 0xB4 && code[3] == 0x26 && code[4] == 0x00
69+ && code[5] == 0x00 && code[6] == 0x00 && code[7] == 0x00) {
70+ DIP("leal %%cs:0(%%esi,%%eiz,1),%%esi\n");
71+ delta += 8;
72+ goto decode_success;
73+ }
74+ }
75
76 // Intel CET requires the following opcodes to be treated as NOPs
77 // with any prefix and ModRM, SIB and disp combination:
78--- a/none/tests/x86/Makefile.am
79+++ b/none/tests/x86/Makefile.am
80@@ -52,6 +52,7 @@ EXTRA_DIST = \
81 fxtract.stdout.exp fxtract.stderr.exp fxtract.vgtest \
82 fxtract.stdout.exp-older-glibc \
83 getseg.stdout.exp getseg.stderr.exp getseg.vgtest \
84+ gnu_binutils_nop.stderr.exp gnu_binutils_nop.vgtest \
85 incdec_alt.stdout.exp incdec_alt.stderr.exp incdec_alt.vgtest \
86 int.stderr.exp int.stdout.exp int.disabled \
87 $(addsuffix .stderr.exp,$(INSN_TESTS)) \
88@@ -100,6 +101,7 @@ check_PROGRAMS = \
89 fpu_lazy_eflags \
90 fxtract \
91 getseg \
92+ gnu_binutils_nop \
93 incdec_alt \
94 $(INSN_TESTS) \
95 int \
96--- /dev/null
97+++ b/none/tests/x86/gnu_binutils_nop.c
98@@ -0,0 +1,34 @@
99+int main(void)
100+{
101+ // GNU binutils uses various opcodes as alternatives for nop
102+ // the idea is that it is faster to execute one large opcode
103+ // with no side-effects than multiple repetitions of the
104+ // single byte 'nop'. This gives more choice when code
105+ // needs to be padded.
106+
107+ // the following is based on
108+ // https://sourceware.org/cgit/binutils-gdb/tree/gas/config/tc-i386.c#n1256
109+
110+ // one byte
111+ __asm__ __volatile__("nop");
112+ // two bytes
113+ __asm__ __volatile__("xchg %ax,%ax");
114+ // three bytes
115+ //__asm__ __volatile__("leal 0(%esi),%esi");
116+ __asm__ __volatile__(".byte 0x8d,0x76,0x00");
117+ // four bytes
118+ //__asm__ __volatile__("leal 0(%esi,%eiz),%esi");
119+ __asm__ __volatile__(".byte 0x8d,0x74,0x26,0x00");
120+ // five bytes
121+ //__asm__ __volatile__("leal %cs:0(%esi,%eiz),%esi");
122+ __asm__ __volatile__(".byte 0x2e,0x8d,0x74,0x26,0x00");
123+ // six bytes
124+ //__asm__ __volatile__("leal 0L(%esi),%esi");
125+ __asm__ __volatile__(".byte 0x8d,0xb6,0x00,0x00,0x00,0x00");
126+ // seven bytes
127+ //__asm__ __volatile__("leal 0L(%esi,%eiz),%esi");
128+ __asm__ __volatile__(".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00");
129+ // eight bytes
130+ //__asm__ __volatile__("leal %cs:0L(%esi,%eiz),%esi");
131+ __asm__ __volatile__(".byte 0x2e,0x8d,0xb4,0x26,0x00,0x00,0x00,0x00");
132+}
133--- /dev/null
134+++ b/none/tests/x86/gnu_binutils_nop.vgtest
135@@ -0,0 +1,2 @@
136+prog: gnu_binutils_nop
137+vgopts: -q
diff --git a/meta/recipes-devtools/valgrind/valgrind/Added-support-for-PPC-instructions-mfatbu-mfatbl.patch b/meta/recipes-devtools/valgrind/valgrind/Added-support-for-PPC-instructions-mfatbu-mfatbl.patch
index 51cd3532d3..65de427d36 100644
--- a/meta/recipes-devtools/valgrind/valgrind/Added-support-for-PPC-instructions-mfatbu-mfatbl.patch
+++ b/meta/recipes-devtools/valgrind/valgrind/Added-support-for-PPC-instructions-mfatbu-mfatbl.patch
@@ -17,11 +17,9 @@ Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
17 VEX/priv/guest_ppc_toIR.c | 22 ++++++++++++++++++++++ 17 VEX/priv/guest_ppc_toIR.c | 22 ++++++++++++++++++++++
18 3 files changed, 42 insertions(+), 0 deletions(-) 18 3 files changed, 42 insertions(+), 0 deletions(-)
19 19
20diff --git a/VEX/priv/guest_ppc_defs.h b/VEX/priv/guest_ppc_defs.h
21index dd3c62e..11a34aa 100644
22--- a/VEX/priv/guest_ppc_defs.h 20--- a/VEX/priv/guest_ppc_defs.h
23+++ b/VEX/priv/guest_ppc_defs.h 21+++ b/VEX/priv/guest_ppc_defs.h
24@@ -146,6 +146,8 @@ extern UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt ); 22@@ -233,6 +233,8 @@ extern UInt ppc32g_dirtyhelper_MFSPR_268
25 23
26 extern UInt ppc32g_dirtyhelper_MFSPR_287 ( void ); 24 extern UInt ppc32g_dirtyhelper_MFSPR_287 ( void );
27 25
@@ -30,11 +28,9 @@ index dd3c62e..11a34aa 100644
30 extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst, 28 extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
31 UInt vD_idx, UInt sh, 29 UInt vD_idx, UInt sh,
32 UInt shift_right ); 30 UInt shift_right );
33diff --git a/VEX/priv/guest_ppc_helpers.c b/VEX/priv/guest_ppc_helpers.c
34index 11aa428..b49ea3f 100644
35--- a/VEX/priv/guest_ppc_helpers.c 31--- a/VEX/priv/guest_ppc_helpers.c
36+++ b/VEX/priv/guest_ppc_helpers.c 32+++ b/VEX/priv/guest_ppc_helpers.c
37@@ -119,6 +119,24 @@ UInt ppc32g_dirtyhelper_MFSPR_287 ( void ) 33@@ -118,6 +118,24 @@ UInt ppc32g_dirtyhelper_MFSPR_287 ( void
38 # endif 34 # endif
39 } 35 }
40 36
@@ -59,11 +55,9 @@ index 11aa428..b49ea3f 100644
59 55
60 /* CALLED FROM GENERATED CODE */ 56 /* CALLED FROM GENERATED CODE */
61 /* DIRTY HELPER (reads guest state, writes guest mem) */ 57 /* DIRTY HELPER (reads guest state, writes guest mem) */
62diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c
63index f8d220d..37c8974 100644
64--- a/VEX/priv/guest_ppc_toIR.c 58--- a/VEX/priv/guest_ppc_toIR.c
65+++ b/VEX/priv/guest_ppc_toIR.c 59+++ b/VEX/priv/guest_ppc_toIR.c
66@@ -5657,6 +5657,28 @@ static Bool dis_proc_ctl ( VexAbiInfo* vbi, UInt theInstr ) 60@@ -11875,6 +11875,28 @@ static Bool dis_proc_ctl ( const VexAbiI
67 break; 61 break;
68 } 62 }
69 63
@@ -92,5 +86,3 @@ index f8d220d..37c8974 100644
92 default: 86 default:
93 vex_printf("dis_proc_ctl(ppc)(mfspr,SPR)(0x%x)\n", SPR); 87 vex_printf("dis_proc_ctl(ppc)(mfspr,SPR)(0x%x)\n", SPR);
94 return False; 88 return False;
95--
961.7.0.4
diff --git a/meta/recipes-devtools/valgrind/valgrind/s390x_vec_op_t.patch b/meta/recipes-devtools/valgrind/valgrind/s390x_vec_op_t.patch
index bde1241dc7..3ab339d215 100644
--- a/meta/recipes-devtools/valgrind/valgrind/s390x_vec_op_t.patch
+++ b/meta/recipes-devtools/valgrind/valgrind/s390x_vec_op_t.patch
@@ -17,19 +17,14 @@ Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
17 VEX/priv/guest_s390_defs.h | 2 +- 17 VEX/priv/guest_s390_defs.h | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-) 18 1 file changed, 1 insertion(+), 1 deletion(-)
19 19
20diff --git a/VEX/priv/guest_s390_defs.h b/VEX/priv/guest_s390_defs.h
21index 9054290..dab8002 100644
22--- a/VEX/priv/guest_s390_defs.h 20--- a/VEX/priv/guest_s390_defs.h
23+++ b/VEX/priv/guest_s390_defs.h 21+++ b/VEX/priv/guest_s390_defs.h
24@@ -284,7 +284,7 @@ typedef enum { 22@@ -284,7 +284,7 @@ typedef enum {
25 S390_VEC_OP_VBPERM, 23 S390_VEC_OP_VCLFNL,
26 S390_VEC_OP_VMSL, 24 S390_VEC_OP_VCRNF,
27 S390_VEC_OP_LAST // supposed to be the last element in enum 25 S390_VEC_OP_LAST // supposed to be the last element in enum
28-} s390x_vec_op_t; 26-} s390x_vec_op_t;
29+}; 27+};
30 28
31 /* Arguments of s390x_dirtyhelper_vec_op(...) which are packed into one 29 /* Arguments of s390x_dirtyhelper_vec_op(...) which are packed into one
32 ULong variable. 30 ULong variable.
33--
342.29.2
35
diff --git a/meta/recipes-devtools/valgrind/valgrind/use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch b/meta/recipes-devtools/valgrind/valgrind/use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch
index f15d04b173..afca874d02 100644
--- a/meta/recipes-devtools/valgrind/valgrind/use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch
+++ b/meta/recipes-devtools/valgrind/valgrind/use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch
@@ -22,11 +22,9 @@ Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
22 none/tests/arm/Makefile.am | 6 ++++-- 22 none/tests/arm/Makefile.am | 6 ++++--
23 1 file changed, 4 insertions(+), 2 deletions(-) 23 1 file changed, 4 insertions(+), 2 deletions(-)
24 24
25diff --git a/none/tests/arm/Makefile.am b/none/tests/arm/Makefile.am
26index 4507a20..825290f 100644
27--- a/none/tests/arm/Makefile.am 25--- a/none/tests/arm/Makefile.am
28+++ b/none/tests/arm/Makefile.am 26+++ b/none/tests/arm/Makefile.am
29@@ -62,8 +62,10 @@ neon64_CFLAGS = $(AM_CFLAGS) -g -O0 -mcpu=cortex-a8 \ 27@@ -87,8 +87,10 @@ neon64_CFLAGS = $(AM_CFLAGS) -g -O0
30 -mfpu=neon \ 28 -mfpu=neon \
31 -mthumb 29 -mthumb
32 30
@@ -39,6 +37,3 @@ index 4507a20..825290f 100644
39+vcvt_fixed_float_VFP_CFLAGS = $(AM_CFLAGS) -g -mcpu=cortex-a8 -mfpu=vfpv3 37+vcvt_fixed_float_VFP_CFLAGS = $(AM_CFLAGS) -g -mcpu=cortex-a8 -mfpu=vfpv3
40+ 38+
41+vfpv4_fma_CFLAGS = $(AM_CFLAGS) -g -O0 -march=armv7ve -mcpu=cortex-a15 -mfpu=vfpv4 -marm 39+vfpv4_fma_CFLAGS = $(AM_CFLAGS) -g -O0 -march=armv7ve -mcpu=cortex-a15 -mfpu=vfpv4 -marm
42--
431.9.1
44
diff --git a/meta/recipes-devtools/valgrind/valgrind/valgrind-make-ld-XXX.so-strlen-intercept-optional.patch b/meta/recipes-devtools/valgrind/valgrind/valgrind-make-ld-XXX.so-strlen-intercept-optional.patch
index d04297dca8..0895473fc0 100644
--- a/meta/recipes-devtools/valgrind/valgrind/valgrind-make-ld-XXX.so-strlen-intercept-optional.patch
+++ b/meta/recipes-devtools/valgrind/valgrind/valgrind-make-ld-XXX.so-strlen-intercept-optional.patch
@@ -16,11 +16,9 @@ Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
16 coregrind/m_redir.c | 13 ++++++++++++- 16 coregrind/m_redir.c | 13 ++++++++++++-
17 1 file changed, 12 insertions(+), 1 deletion(-) 17 1 file changed, 12 insertions(+), 1 deletion(-)
18 18
19diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
20index ff35009..d7d6816 100644
21--- a/coregrind/m_redir.c 19--- a/coregrind/m_redir.c
22+++ b/coregrind/m_redir.c 20+++ b/coregrind/m_redir.c
23@@ -1275,7 +1275,18 @@ static void add_hardwired_spec (const HChar* sopatt, const HChar* fnpatt, 21@@ -1307,7 +1307,18 @@ static void add_hardwired_spec (const H
24 spec->to_addr = to_addr; 22 spec->to_addr = to_addr;
25 spec->isWrap = False; 23 spec->isWrap = False;
26 spec->isGlobal = False; 24 spec->isGlobal = False;
@@ -40,6 +38,3 @@ index ff35009..d7d6816 100644
40 /* VARIABLE PARTS */ 38 /* VARIABLE PARTS */
41 spec->mark = False; /* not significant */ 39 spec->mark = False; /* not significant */
42 spec->done = False; /* not significant */ 40 spec->done = False; /* not significant */
43--
441.9.1
45
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.22.0.bb b/meta/recipes-devtools/valgrind/valgrind_3.23.0.bb
index 563d99f0e2..ad9e26cb6b 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.22.0.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.23.0.bb
@@ -22,6 +22,7 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
22 file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \ 22 file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \
23 file://use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch \ 23 file://use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch \
24 file://avoid-neon-for-targets-which-don-t-support-it.patch \ 24 file://avoid-neon-for-targets-which-don-t-support-it.patch \
25 file://0001-configure-Drop-setting-mcpu-cortex-a8-on-arm.patch \
25 file://valgrind-make-ld-XXX.so-strlen-intercept-optional.patch \ 26 file://valgrind-make-ld-XXX.so-strlen-intercept-optional.patch \
26 file://0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch \ 27 file://0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch \
27 file://0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch \ 28 file://0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch \
@@ -33,12 +34,9 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
33 file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \ 34 file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \
34 file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ 35 file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
35 file://0001-docs-Disable-manual-validation.patch \ 36 file://0001-docs-Disable-manual-validation.patch \
36 file://0001-valgrind-monitor.py-regular-expressions-should-use-r.patch \ 37 file://0001-tests-arm-Use-O-instead-of-O0.patch \
37 file://0002-Bug-476548-valgrind-3.22.0-fails-on-assertion-when-l.patch \
38 file://0003-Add-fchmodat2-syscall-on-linux.patch \
39 file://0004-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch \
40 " 38 "
41SRC_URI[sha256sum] = "c811db5add2c5f729944caf47c4e7a65dcaabb9461e472b578765dd7bf6d2d4c" 39SRC_URI[sha256sum] = "c5c34a3380457b9b75606df890102e7df2c702b9420c2ebef9540f8b5d56264d"
42UPSTREAM_CHECK_REGEX = "valgrind-(?P<pver>\d+(\.\d+)+)\.tar" 40UPSTREAM_CHECK_REGEX = "valgrind-(?P<pver>\d+(\.\d+)+)\.tar"
43 41
44COMPATIBLE_HOST = '(i.86|x86_64|arm|aarch64|mips|powerpc|powerpc64).*-linux' 42COMPATIBLE_HOST = '(i.86|x86_64|arm|aarch64|mips|powerpc|powerpc64).*-linux'
@@ -196,9 +194,9 @@ do_install_ptest() {
196 194
197 # The scripts reference config.h so add it to the top ptest dir. 195 # The scripts reference config.h so add it to the top ptest dir.
198 cp ${B}/config.h ${D}${PTEST_PATH} 196 cp ${B}/config.h ${D}${PTEST_PATH}
199 install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH} 197 install -D ${UNPACKDIR}/remove-for-aarch64 ${D}${PTEST_PATH}
200 install -D ${WORKDIR}/remove-for-all ${D}${PTEST_PATH} 198 install -D ${UNPACKDIR}/remove-for-all ${D}${PTEST_PATH}
201 install -D ${WORKDIR}/taskset_nondeterministic_tests ${D}${PTEST_PATH} 199 install -D ${UNPACKDIR}/taskset_nondeterministic_tests ${D}${PTEST_PATH}
202 200
203 # Add an executable need by none/tests/bigcode 201 # Add an executable need by none/tests/bigcode
204 mkdir ${D}${PTEST_PATH}/perf 202 mkdir ${D}${PTEST_PATH}/perf