- Upstream 3.23.0 final
- configure --enable-lto
- Remove all upstreamed patches
- Add BuildRequires: python3-devel for running testsuite.
- Update license tags to spdx

Resolves: #RHEL-29535
Routine Rebase of valgrind for RHEL10.0

Resolves: #RHEL-32735
valgrind: strcmp interceptor for ld-linux-x86-64.so.2 does not work
This commit is contained in:
Mark Wielaard 2024-04-27 01:46:55 +02:00
parent fedf3d4030
commit f5e9ad85ee
7 changed files with 30 additions and 527 deletions

1
.gitignore vendored
View File

@ -51,3 +51,4 @@
/valgrind-3.22.0.RC1.tar.bz2 /valgrind-3.22.0.RC1.tar.bz2
/valgrind-3.22.0.RC2.tar.bz2 /valgrind-3.22.0.RC2.tar.bz2
/valgrind-3.22.0.tar.bz2 /valgrind-3.22.0.tar.bz2
/valgrind-3.23.0.tar.bz2

View File

@ -1 +1 @@
SHA512 (valgrind-3.22.0.tar.bz2) = 2904c13f68245bbafcea70998c6bd20725271300a7e94b6751ca00916943595fc3fac8557da7ea8db31b54a43f092823a0a947bc142829da811d074e1fe49777 SHA512 (valgrind-3.23.0.tar.bz2) = 27d038faaaf6154cace2df18c3573291393548ba0738dbb6aba58eab6324c5beaa95fc5f3c0271663ca071baf829b15d806f7e81074f7cf087bef20ea0ed3117

View File

@ -1,206 +0,0 @@
From a43e62dddcf51ec6578a90c5988a41e856b44b05 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Sat, 18 Nov 2023 21:17:02 +0100
Subject: [PATCH] Add fchmodat2 syscall on linux
fchmodat2 is a new syscall on linux 6.6. It is a variant of fchmodat
that takes an extra flags argument.
https://bugs.kde.org/show_bug.cgi?id=477198
(cherry picked from commit 372d09fd9a8d76847c81092ebff71c80fd6c145d)
---
NEWS | 1 +
coregrind/m_syswrap/priv_syswrap-linux.h | 3 +++
coregrind/m_syswrap/syswrap-amd64-linux.c | 2 ++
coregrind/m_syswrap/syswrap-arm-linux.c | 2 ++
coregrind/m_syswrap/syswrap-arm64-linux.c | 2 ++
coregrind/m_syswrap/syswrap-linux.c | 11 +++++++++++
coregrind/m_syswrap/syswrap-mips32-linux.c | 2 ++
coregrind/m_syswrap/syswrap-mips64-linux.c | 1 +
coregrind/m_syswrap/syswrap-nanomips-linux.c | 1 +
coregrind/m_syswrap/syswrap-ppc32-linux.c | 2 ++
coregrind/m_syswrap/syswrap-ppc64-linux.c | 2 ++
coregrind/m_syswrap/syswrap-s390x-linux.c | 2 ++
coregrind/m_syswrap/syswrap-x86-linux.c | 2 ++
include/vki/vki-scnums-shared-linux.h | 2 ++
14 files changed, 35 insertions(+)
diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h
index 7c9decf5a..798c456c9 100644
--- a/coregrind/m_syswrap/priv_syswrap-linux.h
+++ b/coregrind/m_syswrap/priv_syswrap-linux.h
@@ -331,6 +331,9 @@ DECL_TEMPLATE(linux, sys_openat2);
// Linux-specific (new in Linux 5.14)
DECL_TEMPLATE(linux, sys_memfd_secret);
+// Since Linux 6.6
+DECL_TEMPLATE(linux, sys_fchmodat2);
+
/* ---------------------------------------------------------------------
Wrappers for sockets and ipc-ery. These are split into standalone
procedures because x86-linux hides them inside multiplexors
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
index 008600798..fe17d118b 100644
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
@@ -886,6 +886,8 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
+
+ LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
index 9a7a1e0d2..811931d3b 100644
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
@@ -1059,6 +1059,8 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+
+ 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 6af7bab83..3307bc2ca 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -840,6 +840,8 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
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 d571fc327..efa47f2e6 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -6059,6 +6059,17 @@ PRE(sys_fchmodat)
PRE_MEM_RASCIIZ( "fchmodat(path)", ARG2 );
}
+PRE(sys_fchmodat2)
+{
+ PRINT("sys_fchmodat2 ( %ld, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %"
+ FMT_REGWORD "u )",
+ SARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4);
+ PRE_REG_READ4(long, "fchmodat2",
+ int, dfd, const char *, path, vki_mode_t, mode,
+ unsigned int, flags);
+ PRE_MEM_RASCIIZ( "fchmodat2(pathname)", ARG2 );
+}
+
PRE(sys_faccessat)
{
PRINT("sys_faccessat ( %ld, %#" FMT_REGWORD "x(%s), %ld )",
diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c
index 6268a00dd..74a1f6eac 100644
--- a/coregrind/m_syswrap/syswrap-mips32-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c
@@ -1143,6 +1143,8 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_ (__NR_faccessat2, sys_faccessat2), // 439
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+
+ LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
};
SyscallTableEntry* ML_(get_linux_syscall_entry) (UInt sysno)
diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c
index 6cdf25893..4e8508b7a 100644
--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
@@ -820,6 +820,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY (__NR_close_range, sys_close_range),
LINX_ (__NR_faccessat2, sys_faccessat2),
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2),
+ LINX_ (__NR_fchmodat2, sys_fchmodat2),
};
SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c
index d724cde74..7859900c1 100644
--- a/coregrind/m_syswrap/syswrap-nanomips-linux.c
+++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c
@@ -829,6 +829,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY (__NR_close_range, sys_close_range),
LINX_ (__NR_faccessat2, sys_faccessat2),
LINXY (__NR_epoll_pwait2, sys_epoll_pwait2),
+ LINX_ (__NR_fchmodat2, sys_fchmodat2),
};
SyscallTableEntry* ML_(get_linux_syscall_entry) (UInt sysno)
diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c
index c0cfef235..1e19116ee 100644
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
@@ -1063,6 +1063,8 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+
+ LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
index f5976f30c..1097212a4 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -1032,6 +1032,8 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+
+ LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
index afba154e7..3588672c7 100644
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
@@ -873,6 +873,8 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+
+ LINX_ (__NR_fchmodat2, sys_fchmodat2), // 452
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
index da4fd8fa2..58badc6b0 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -1658,6 +1658,8 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
+
+ LINX_(__NR_fchmodat2, sys_fchmodat2), // 452
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h
index 542382b53..a4cd87149 100644
--- a/include/vki/vki-scnums-shared-linux.h
+++ b/include/vki/vki-scnums-shared-linux.h
@@ -50,4 +50,6 @@
#define __NR_memfd_secret 447
+#define __NR_fchmodat2 452
+
#endif
--
2.39.3

View File

@ -1,122 +0,0 @@
commit 1d00e5ce0fb069911c4b525ec38289fb5d9021b0
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date: Sat Nov 18 08:49:34 2023 +0100
Bug 476548 - valgrind 3.22.0 fails on assertion when loading debuginfo file produced by mold
(cherry picked from commit 9ea4ae66707a4dcc6f4328e11911652e4418c585)
diff --git a/coregrind/m_debuginfo/image.c b/coregrind/m_debuginfo/image.c
index 02e509071..445f95555 100644
--- a/coregrind/m_debuginfo/image.c
+++ b/coregrind/m_debuginfo/image.c
@@ -1221,6 +1221,20 @@ Int ML_(img_strcmp_c)(DiImage* img, DiOffT off1, const HChar* str2)
}
}
+Int ML_(img_strcmp_n)(DiImage* img, DiOffT off1, const HChar* str2, Word n)
+{
+ ensure_valid(img, off1, 1, "ML_(img_strcmp_c)");
+ while (n) {
+ UChar c1 = get(img, off1);
+ UChar c2 = *(const UChar*)str2;
+ if (c1 < c2) return -1;
+ if (c1 > c2) return 1;
+ if (c1 == 0) return 0;
+ off1++; str2++; --n;
+ }
+ return 0;
+}
+
UChar ML_(img_get_UChar)(DiImage* img, DiOffT offset)
{
ensure_valid(img, offset, 1, "ML_(img_get_UChar)");
diff --git a/coregrind/m_debuginfo/priv_image.h b/coregrind/m_debuginfo/priv_image.h
index a49846f14..c91e49f01 100644
--- a/coregrind/m_debuginfo/priv_image.h
+++ b/coregrind/m_debuginfo/priv_image.h
@@ -115,6 +115,10 @@ Int ML_(img_strcmp)(DiImage* img, DiOffT off1, DiOffT off2);
cast to HChar before comparison. */
Int ML_(img_strcmp_c)(DiImage* img, DiOffT off1, const HChar* str2);
+/* Do strncmp of a C string in the image vs a normal one. Chars are
+ cast to HChar before comparison. */
+Int ML_(img_strcmp_n)(DiImage* img, DiOffT off1, const HChar* str2, Word n);
+
/* Do strlen of a C string in the image. */
SizeT ML_(img_strlen)(DiImage* img, DiOffT off);
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
index fb64ed976..46f8c8343 100644
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -2501,8 +2501,7 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
di->rodata_avma += inrw1->bias;
di->rodata_bias = inrw1->bias;
di->rodata_debug_bias = inrw1->bias;
- }
- else {
+ } else {
BAD(".rodata"); /* should not happen? */
}
di->rodata_present = True;
@@ -2977,6 +2976,46 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
return retval;
}
+static void find_rodata(Word i, Word shnum, DiImage* dimg, struct _DebugInfo* di, DiOffT shdr_dioff,
+ UWord shdr_dent_szB, DiOffT shdr_strtab_dioff, PtrdiffT rw_dbias)
+{
+ ElfXX_Shdr a_shdr;
+ ElfXX_Shdr a_extra_shdr;
+ ML_(img_get)(&a_shdr, dimg,
+ INDEX_BIS(shdr_dioff, i, shdr_dent_szB),
+ sizeof(a_shdr));
+ if (di->rodata_present &&
+ 0 == ML_(img_strcmp_c)(dimg, shdr_strtab_dioff
+ + a_shdr.sh_name, ".rodata")) {
+ Word sh_size = a_shdr.sh_size;
+ Word j;
+ Word next_addr = a_shdr.sh_addr + a_shdr.sh_size;
+ for (j = i + 1; j < shnum; ++j) {
+ ML_(img_get)(&a_extra_shdr, dimg,
+ INDEX_BIS(shdr_dioff, j, shdr_dent_szB),
+ sizeof(a_shdr));
+ if (0 == ML_(img_strcmp_n)(dimg, shdr_strtab_dioff
+ + a_extra_shdr.sh_name, ".rodata", 7)) {
+ if (a_extra_shdr.sh_addr ==
+ VG_ROUNDUP(next_addr, a_extra_shdr.sh_addralign)) {
+ sh_size = VG_ROUNDUP(sh_size, a_extra_shdr.sh_addralign) + a_extra_shdr.sh_size;
+ }
+ next_addr = a_extra_shdr.sh_addr + a_extra_shdr.sh_size;
+ } else {
+ break;
+ }
+ }
+ vg_assert(di->rodata_size == sh_size);
+ vg_assert(di->rodata_avma + a_shdr.sh_addr + rw_dbias);
+ di->rodata_debug_svma = a_shdr.sh_addr;
+ di->rodata_debug_bias = di->rodata_bias +
+ di->rodata_svma - di->rodata_debug_svma;
+ TRACE_SYMTAB("acquiring .rodata debug svma = %#lx .. %#lx\n",
+ di->rodata_debug_svma,
+ di->rodata_debug_svma + di->rodata_size - 1);
+ TRACE_SYMTAB("acquiring .rodata debug bias = %#lx\n", (UWord)di->rodata_debug_bias);
+ }
+}
Bool ML_(read_elf_debug) ( struct _DebugInfo* di )
{
Word i, j;
@@ -3391,7 +3430,11 @@ Bool ML_(read_elf_debug) ( struct _DebugInfo* di )
FIND(text, rx)
FIND(data, rw)
FIND(sdata, rw)
- FIND(rodata, rw)
+ // https://bugs.kde.org/show_bug.cgi?id=476548
+ // special handling for rodata as adjacent
+ // rodata sections may have been merged in ML_(read_elf_object)
+ //FIND(rodata, rw)
+ find_rodata(i, ehdr_dimg.e_shnum, dimg, di, shdr_dioff, shdr_dent_szB, shdr_strtab_dioff, rw_dbias);
FIND(bss, rw)
FIND(sbss, rw)

View File

@ -1,32 +0,0 @@
commit 0fbfbe05028ad18efda786a256a2738d2c231ed4
Author: Mark Wielaard <mark@klomp.org>
Date: Fri Nov 17 13:31:52 2023 +0100
valgrind-monitor.py regular expressions should use raw strings
With python 3.12 gdb will produce the following SyntaxWarning when
loading valgrind-monitor-def.py:
/usr/share/gdb/auto-load/valgrind-monitor-def.py:214:
SyntaxWarning: invalid escape sequence '\['
if re.fullmatch("^0x[0123456789ABCDEFabcdef]+\[[^\[\]]+\]$", arg_str):
In a future python version this will become an SyntaxError.
Use a raw strings for the regular expression.
https://bugs.kde.org/show_bug.cgi?id=476708
diff --git a/coregrind/m_gdbserver/valgrind-monitor-def.py b/coregrind/m_gdbserver/valgrind-monitor-def.py
index b4e7b992d..d74b1590c 100644
--- a/coregrind/m_gdbserver/valgrind-monitor-def.py
+++ b/coregrind/m_gdbserver/valgrind-monitor-def.py
@@ -211,7 +211,7 @@ class Valgrind_ADDR_LEN_opt(Valgrind_Command):
For compatibility reason with the Valgrind gdbserver monitor command,
we detect and accept usages such as 0x1234ABCD[10]."""
def invoke(self, arg_str : str, from_tty : bool) -> None:
- if re.fullmatch("^0x[0123456789ABCDEFabcdef]+\[[^\[\]]+\]$", arg_str):
+ if re.fullmatch(r"^0x[0123456789ABCDEFabcdef]+\[[^\[\]]+\]$", arg_str):
arg_str = arg_str.replace("[", " ")
arg_str = arg_str.replace("]", " ")
eval_execute_2(self, arg_str,

View File

@ -1,136 +0,0 @@
From d35005cef8ad8207542738812705ceabf137d7e0 Mon Sep 17 00:00:00 2001
From: Paul Floyd <pjfloyd@wanadoo.fr>
Date: Sun, 17 Dec 2023 14:18:51 +0100
Subject: [PATCH] Bug 478624 - Valgrind incompatibility with binutils-2.42 on
x86 with new nop patterns (unhandled instruction bytes: 0x2E 0x8D 0xB4 0x26)
It was a bit of a struggle to get the testcase to build
with both clang and gcc (oddly enough gcc was more difficult) so
I just resorted to using .byte arrays.
---
.gitignore | 1 +
NEWS | 2 ++
VEX/priv/guest_x86_toIR.c | 22 +++++++++++++-
none/tests/x86/Makefile.am | 2 ++
none/tests/x86/gnu_binutils_nop.c | 34 ++++++++++++++++++++++
none/tests/x86/gnu_binutils_nop.stderr.exp | 0
none/tests/x86/gnu_binutils_nop.vgtest | 2 ++
7 files changed, 62 insertions(+), 1 deletion(-)
create mode 100644 none/tests/x86/gnu_binutils_nop.c
create mode 100644 none/tests/x86/gnu_binutils_nop.stderr.exp
create mode 100644 none/tests/x86/gnu_binutils_nop.vgtest
diff --git a/VEX/priv/guest_x86_toIR.c b/VEX/priv/guest_x86_toIR.c
index 5d6e6dc64..3b6efb387 100644
--- a/VEX/priv/guest_x86_toIR.c
+++ b/VEX/priv/guest_x86_toIR.c
@@ -8198,7 +8198,7 @@ DisResult disInstr_X86_WRK (
delta += 5;
goto decode_success;
}
- /* Don't barf on recent binutils padding,
+ /* Don't barf on recent (2010) binutils padding,
all variants of which are: nopw %cs:0x0(%eax,%eax,1)
66 2e 0f 1f 84 00 00 00 00 00
66 66 2e 0f 1f 84 00 00 00 00 00
@@ -8223,6 +8223,26 @@ DisResult disInstr_X86_WRK (
}
}
+ /* bug478624 GNU binutils uses a leal of esi into itself with
+ a zero offset and CS prefix as an 8 byte no-op (Dec 2023).
+ Since the CS prefix is hardly ever used we don't do much
+ to decode it, just a few cases for conditional branches.
+ So add handling here with other pseudo-no-ops.
+ */
+ if (code[0] == 0x2E && code[1] == 0x8D) {
+ if (code[2] == 0x74 && code[3] == 0x26 && code[4] == 0x00) {
+ DIP("leal %%cs:0(%%esi,%%eiz,1),%%esi\n");
+ delta += 5;
+ goto decode_success;
+ }
+ if (code[2] == 0xB4 && code[3] == 0x26 && code[4] == 0x00
+ && code[5] == 0x00 && code[6] == 0x00 && code[7] == 0x00) {
+ DIP("leal %%cs:0(%%esi,%%eiz,1),%%esi\n");
+ delta += 8;
+ goto decode_success;
+ }
+ }
+
// Intel CET requires the following opcodes to be treated as NOPs
// with any prefix and ModRM, SIB and disp combination:
// "0F 19", "0F 1C", "0F 1D", "0F 1E", "0F 1F"
diff --git a/none/tests/x86/Makefile.am b/none/tests/x86/Makefile.am
index 3ecd1ad3c..dbae86571 100644
--- a/none/tests/x86/Makefile.am
+++ b/none/tests/x86/Makefile.am
@@ -52,6 +52,7 @@ EXTRA_DIST = \
fxtract.stdout.exp fxtract.stderr.exp fxtract.vgtest \
fxtract.stdout.exp-older-glibc \
getseg.stdout.exp getseg.stderr.exp getseg.vgtest \
+ gnu_binutils_nop.stderr.exp gnu_binutils_nop.vgtest \
incdec_alt.stdout.exp incdec_alt.stderr.exp incdec_alt.vgtest \
int.stderr.exp int.stdout.exp int.disabled \
$(addsuffix .stderr.exp,$(INSN_TESTS)) \
@@ -100,6 +101,7 @@ check_PROGRAMS = \
fpu_lazy_eflags \
fxtract \
getseg \
+ gnu_binutils_nop \
incdec_alt \
$(INSN_TESTS) \
int \
diff --git a/none/tests/x86/gnu_binutils_nop.c b/none/tests/x86/gnu_binutils_nop.c
new file mode 100644
index 000000000..412a4c2cb
--- /dev/null
+++ b/none/tests/x86/gnu_binutils_nop.c
@@ -0,0 +1,34 @@
+int main(void)
+{
+ // GNU binutils uses various opcodes as alternatives for nop
+ // the idea is that it is faster to execute one large opcode
+ // with no side-effects than multiple repetitions of the
+ // single byte 'nop'. This gives more choice when code
+ // needs to be padded.
+
+ // the following is based on
+ // https://sourceware.org/cgit/binutils-gdb/tree/gas/config/tc-i386.c#n1256
+
+ // one byte
+ __asm__ __volatile__("nop");
+ // two bytes
+ __asm__ __volatile__("xchg %ax,%ax");
+ // three bytes
+ //__asm__ __volatile__("leal 0(%esi),%esi");
+ __asm__ __volatile__(".byte 0x8d,0x76,0x00");
+ // four bytes
+ //__asm__ __volatile__("leal 0(%esi,%eiz),%esi");
+ __asm__ __volatile__(".byte 0x8d,0x74,0x26,0x00");
+ // five bytes
+ //__asm__ __volatile__("leal %cs:0(%esi,%eiz),%esi");
+ __asm__ __volatile__(".byte 0x2e,0x8d,0x74,0x26,0x00");
+ // six bytes
+ //__asm__ __volatile__("leal 0L(%esi),%esi");
+ __asm__ __volatile__(".byte 0x8d,0xb6,0x00,0x00,0x00,0x00");
+ // seven bytes
+ //__asm__ __volatile__("leal 0L(%esi,%eiz),%esi");
+ __asm__ __volatile__(".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00");
+ // eight bytes
+ //__asm__ __volatile__("leal %cs:0L(%esi,%eiz),%esi");
+ __asm__ __volatile__(".byte 0x2e,0x8d,0xb4,0x26,0x00,0x00,0x00,0x00");
+}
diff --git a/none/tests/x86/gnu_binutils_nop.stderr.exp b/none/tests/x86/gnu_binutils_nop.stderr.exp
new file mode 100644
index 000000000..e69de29bb
diff --git a/none/tests/x86/gnu_binutils_nop.vgtest b/none/tests/x86/gnu_binutils_nop.vgtest
new file mode 100644
index 000000000..7f378dd53
--- /dev/null
+++ b/none/tests/x86/gnu_binutils_nop.vgtest
@@ -0,0 +1,2 @@
+prog: gnu_binutils_nop
+vgopts: -q
--
2.43.0

View File

@ -2,10 +2,17 @@
Summary: Dynamic analysis tools to detect memory or thread bugs and profile Summary: Dynamic analysis tools to detect memory or thread bugs and profile
Name: %{?scl_prefix}valgrind Name: %{?scl_prefix}valgrind
Version: 3.22.0 Version: 3.23.0
Release: 6%{?dist} Release: 1%{?dist}
Epoch: 1 Epoch: 1
License: GPLv2+ AND BSD
# This ignores licenses that are only found in the test or perf sources
# we only care about those license statements found in sources that end
# up in the binary packages. One piece of code for which we don't have
# 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
URL: https://www.valgrind.org/ URL: https://www.valgrind.org/
# Are we building for a Software Collection? # Are we building for a Software Collection?
@ -78,23 +85,6 @@ Patch3: valgrind-3.16.0-some-stack-protector.patch
# Add some -Wl,z,now. # Add some -Wl,z,now.
Patch4: valgrind-3.16.0-some-Wl-z-now.patch Patch4: valgrind-3.16.0-some-Wl-z-now.patch
# valgrind-monitor.py regular expressions should use raw strings
# https://bugs.kde.org/show_bug.cgi?id=476708
Patch5: valgrind-3.22.0-valgrind-monitor-python-re.patch
# valgrind 3.22.0 fails on assertion when loading debuginfo
# https://bugs.kde.org/show_bug.cgi?id=476548
Patch6: valgrind-3.22.0-rodata.patch
# Add fchmodat2 syscall on linux
# https://bugs.kde.org/show_bug.cgi?id=477198
Patch7: valgrind-3.22.0-fchmodat2.patch
# Valgrind incompatibility with binutils-2.42 on x86 with new nop patterns
# (unhandled instruction bytes: 0x2E 0x8D 0xB4 0x26)
# https://bugs.kde.org/show_bug.cgi?id=478624
Patch8: valgrind-3.22.0-x86-nop.patch
BuildRequires: make BuildRequires: make
BuildRequires: glibc-devel BuildRequires: glibc-devel
@ -133,6 +123,10 @@ BuildRequires: elfutils-debuginfod-client
Recommends: elfutils-debuginfod-client Recommends: elfutils-debuginfod-client
%endif %endif
# For running the testsuite.
# Some of the python scripts require python 3.9+
BuildRequires: python3-devel
%{?scl:Requires:%scl_runtime} %{?scl:Requires:%scl_runtime}
# We could use %%valgrind_arches as defined in redhat-rpm-config # We could use %%valgrind_arches as defined in redhat-rpm-config
@ -192,7 +186,7 @@ Summary: Development files for valgrind aware programs
# https://fedoraproject.org/wiki/Licensing:BSD#Hybrid_BSD_(half_BSD,_half_zlib) # https://fedoraproject.org/wiki/Licensing:BSD#Hybrid_BSD_(half_BSD,_half_zlib)
# But that doesnt have a SPDX identifier yet # But that doesnt have a SPDX identifier yet
# https://gitlab.com/fedora/legal/fedora-license-data/-/issues/422 # https://gitlab.com/fedora/legal/fedora-license-data/-/issues/422
License: BSD License: bzip2-1.0.6
Requires: %{?scl_prefix}valgrind = %{epoch}:%{version}-%{release} Requires: %{?scl_prefix}valgrind = %{epoch}:%{version}-%{release}
%description devel %description devel
@ -211,7 +205,8 @@ Header files and libraries for development of valgrind tools.
%if %{build_openmpi} %if %{build_openmpi}
%package openmpi %package openmpi
Summary: OpenMPI support for valgrind Summary: OpenMPI support for valgrind
License: BSD # See above, Hybrid-BSD like.
License: bzip2-1.0.6
Requires: %{?scl_prefix}valgrind = %{epoch}:%{version}-%{release} Requires: %{?scl_prefix}valgrind = %{epoch}:%{version}-%{release}
%description openmpi %description openmpi
@ -228,15 +223,10 @@ Valgrind User Manual for details.
%patch -P3 -p1 %patch -P3 -p1
%patch -P4 -p1 %patch -P4 -p1
%patch -P5 -p1
%patch -P6 -p1
%patch -P7 -p1
%patch -P8 -p1
%build %build
# LTO triggers undefined symbols in valgrind. Valgrind has a --enable-lto # LTO triggers undefined symbols in valgrind. But valgrind has a
# configure time option, but that doesn't seem to help. # --enable-lto configure time option that we will use instead.
# Disable LTO for now.
%define _lto_cflags %{nil} %define _lto_cflags %{nil}
# Some patches (might) touch Makefile.am or configure.ac files. # Some patches (might) touch Makefile.am or configure.ac files.
@ -297,7 +287,8 @@ export LDFLAGS
--with-mpicc=%{mpiccpath} \ --with-mpicc=%{mpiccpath} \
%{only_arch} \ %{only_arch} \
GDB=%{_bindir}/gdb \ GDB=%{_bindir}/gdb \
--with-gdbscripts-dir=%{_datadir}/gdb/auto-load --with-gdbscripts-dir=%{_datadir}/gdb/auto-load \
--enable-lto
%make_build %make_build
@ -448,6 +439,13 @@ echo ===============END TESTING===============
%endif %endif
%changelog %changelog
* Fri Apr 26 2024 Mark Wielaard <mjw@redhat.com> - 3.23.0-1
- Upstream 3.23.0 final
- configure --enable-lto
- Remove all upstreamed patches
- Add BuildRequires: python3-devel for running testsuite.
- Update license tags to spdx
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.22.0-6 * Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.22.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild