aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2024-05-06 10:02:53 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2024-05-06 22:16:37 +0200
commit5ae58eb1e9a3cbda73c760c2a6ca5e00c520681f (patch)
tree9a84607fbefa87567a0934639a7b897309e9d1f6
parentcad60e892512184041495170fd93abed1c037393 (diff)
main/valgrind: upgrade to 3.23.0
re-enable tests on all architectures fixes https://gitlab.alpinelinux.org/alpine/aports/-/issues/16085
-rw-r--r--main/valgrind/0001-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch136
-rw-r--r--main/valgrind/APKBUILD21
-rw-r--r--main/valgrind/fix-tests-musl-armv7.patch14
-rw-r--r--main/valgrind/fix-tests-musl-s390x.patch57
4 files changed, 78 insertions, 150 deletions
diff --git a/main/valgrind/0001-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch b/main/valgrind/0001-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch
deleted file mode 100644
index 1f6ae07b50b..00000000000
--- a/main/valgrind/0001-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch
+++ /dev/null
@@ -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.44.0
-
diff --git a/main/valgrind/APKBUILD b/main/valgrind/APKBUILD
index 4ba0bcd6271..626d6dcc518 100644
--- a/main/valgrind/APKBUILD
+++ b/main/valgrind/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=valgrind
-pkgver=3.22.0
-pkgrel=1
+pkgver=3.23.0
+pkgrel=0
pkgdesc="Tool to help find memory-management problems in programs"
url="https://valgrind.org/"
# armv6/riscv64 not supported upstream
@@ -17,18 +17,10 @@ makedepends="sed perl linux-headers"
options="!strip"
subpackages="$pkgname-scripts $pkgname-dev $pkgname-doc"
source="https://sourceware.org/pub/valgrind/valgrind-$pkgver.tar.bz2
- 0001-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch
+ fix-tests-musl-s390x.patch
+ fix-tests-musl-armv7.patch
"
-# Valgrind 3.19.0 added support for compiling the tests on musl.
-# However, it seems they haven't tested this on many architectures.
-# Disable check on architectures where it doesn't work for now.
-#
-# TODO: Report upstream.
-case "$CARCH" in
-aarch64|s390x|armv7|x86) options="$options !check"
-esac
-
build() {
export CFLAGS="${CFLAGS/-fno-plt} -fno-stack-protector -no-pie -U_FORTIFY_SOURCE"
./configure \
@@ -72,6 +64,7 @@ scripts() {
}
sha512sums="
-2904c13f68245bbafcea70998c6bd20725271300a7e94b6751ca00916943595fc3fac8557da7ea8db31b54a43f092823a0a947bc142829da811d074e1fe49777 valgrind-3.22.0.tar.bz2
-250cac58cd1710d4d9a6a24b9acc596fa01e4d2255b98b46b8ed5c7af9e658489a69b51ca7e7d17ebf5b2a9023f561391e149311c20e99607d6b7e471110cbe5 0001-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch
+27d038faaaf6154cace2df18c3573291393548ba0738dbb6aba58eab6324c5beaa95fc5f3c0271663ca071baf829b15d806f7e81074f7cf087bef20ea0ed3117 valgrind-3.23.0.tar.bz2
+a6c5a33d0d5c09cc65c6c62456e213006560b20f37db0a24bf218c5bd2eb3275541494866699d15bbbc2672292122cb6f6d67176b0f37ba1dec37211c584c480 fix-tests-musl-s390x.patch
+5e0f6b10081318fc5630a7500d490ff5e9b2832889158ecb40a4f310f8be6fcbd8a8744be96742341eba952a0994e407db091673a69d111fae3e132e0ea6ca72 fix-tests-musl-armv7.patch
"
diff --git a/main/valgrind/fix-tests-musl-armv7.patch b/main/valgrind/fix-tests-musl-armv7.patch
new file mode 100644
index 00000000000..cf7a6a1437e
--- /dev/null
+++ b/main/valgrind/fix-tests-musl-armv7.patch
@@ -0,0 +1,14 @@
+diff --git a/memcheck/tests/linux/timerfd-syscall.c b/memcheck/tests/linux/timerfd-syscall.c
+index 61d75b5..1721249 100644
+--- a/memcheck/tests/linux/timerfd-syscall.c
++++ b/memcheck/tests/linux/timerfd-syscall.c
+@@ -78,6 +78,9 @@
+ #elif defined(__s390x__)
+ #define __NR_timerfd_settime 320
+ #define __NR_timerfd_gettime 321
++#elif defined(__arm__) && defined(__NR_timerfd_settime64) && defined(__NR_timerfd_gettime64)
++#define __NR_timerfd_settime __NR_timerfd_settime64
++#define __NR_timerfd_gettime __NR_timerfd_gettime64
+ #else
+ #error Cannot detect your architecture!
+ #endif
diff --git a/main/valgrind/fix-tests-musl-s390x.patch b/main/valgrind/fix-tests-musl-s390x.patch
new file mode 100644
index 00000000000..73e57f54850
--- /dev/null
+++ b/main/valgrind/fix-tests-musl-s390x.patch
@@ -0,0 +1,57 @@
+diff --git a/none/tests/s390x/ex_sig.c b/none/tests/s390x/ex_sig.c
+index 9ff33fc..b5aaa7a 100644
+--- a/none/tests/s390x/ex_sig.c
++++ b/none/tests/s390x/ex_sig.c
+@@ -1,5 +1,7 @@
+ #include <features.h>
++#ifdef __GLIBC__
+ #include <fpu_control.h>
++#endif
+ #include <signal.h>
+ #include <sys/types.h>
+ #include <signal.h>
+diff --git a/none/tests/s390x/test_sig.c b/none/tests/s390x/test_sig.c
+index b24dbbe..b93088b 100644
+--- a/none/tests/s390x/test_sig.c
++++ b/none/tests/s390x/test_sig.c
+@@ -1,5 +1,7 @@
+ #include <features.h>
++#ifdef __GLIBC__
+ #include <fpu_control.h>
++#endif
+ #include <signal.h>
+ #include <sys/types.h>
+ #include <signal.h>
+diff --git a/none/tests/s390x/traps.c b/none/tests/s390x/traps.c
+index 86874c3..ce1fc74 100644
+--- a/none/tests/s390x/traps.c
++++ b/none/tests/s390x/traps.c
+@@ -1,5 +1,7 @@
+ #include <features.h>
++#ifdef __GLIBC__
+ #include <fpu_control.h>
++#endif
+ #include <signal.h>
+ #include <sys/types.h>
+ #include <signal.h>
+diff --git a/tests/s390x_features.c b/tests/s390x_features.c
+index 507f3ab..40774de 100644
+--- a/tests/s390x_features.c
++++ b/tests/s390x_features.c
+@@ -48,12 +48,16 @@ jmp_buf env;
+ // of the CPU facility list. To read the HWCAP, use 'getauxval' if available --
+ // which should be the case with glibc versions >= 2.16. A system with an older
+ // glibc is unlikely to support any of these features anyhow.
++#ifdef __GLIBC__
+ #if __GLIBC_PREREQ(2, 16)
+ #include <sys/auxv.h>
+ #define GET_HWCAP() getauxval(AT_HWCAP)
+ #else
+ #define GET_HWCAP() 0UL
+ #endif
++#else
++#define GET_HWCAP() 0UL
++#endif
+
+ /* Number of double words needed to store all facility bits. */
+ #define S390_NUM_FACILITY_DW 3