* update valgrind to 3.22.0-3

This commit is contained in:
Alexander Baldeck 2024-02-24 12:52:31 +01:00
parent 186ead5439
commit 1afe1829f9
4 changed files with 440 additions and 12 deletions

View File

@ -1,5 +1,6 @@
# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Christian Heusel <gromit@archlinux.org>
# Contributor: Dan McGee <dan@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
@ -9,27 +10,34 @@
# whenever the tests shall run
#
# For a fresh build:
# $repo-x86_64-build -- -I ../../glibc/trunk/glibc-debug*.pkg.tar.zst
# $repo-x86_64-build
# ${repo}pkg
# pkgctl build -I ../../glibc/trunk/glibc-debug*.pkg.tar.zst
# pkgctl build
pkgname=valgrind
pkgver=3.22.0
pkgrel=1
pkgrel=3
pkgdesc='Tool to help find memory-management problems in programs'
arch=(x86_64 powerpc64le powerpc64 powerpc)
license=('GPL')
url='https://valgrind.org/'
depends=('glibc' 'perl' 'debuginfod')
makedepends=('gdb' 'docbook-xml' 'docbook-xsl' 'docbook-sgml')
checkdepends=('procps-ng')
optdepends=(
'python: cg_* scripts'
)
makedepends=('gdb' 'docbook-xml' 'docbook-xsl' 'docbook-sgml' 'libxslt')
makedepends_x86_64=('lib32-glibc' 'lib32-gcc-libs')
optdepends_x86_64=('lib32-glibc: 32-bit ABI support')
checkdepends=('procps-ng')
provides=('valgrind-multilib')
replaces=('valgrind-multilib')
options=('!emptydirs' '!strip')
source=(https://sourceware.org/pub/valgrind/valgrind-${pkgver}.tar.bz2{,.asc}
valgrind-3.7.0-respect-flags.patch
# https://sourceware.org/git/?p=valgrind.git;a=commit;h=372d09fd9a8d76847c81092ebff71c80fd6c145d
# dropped changes to NEWS as that did not apply
valgrind_3_22_0_s390x-linux_memfd_secret.patch
valgrind_3_22_0_fchmodat2_syscall.patch
elfv2-ppc64-be.patch)
validpgpkeys=(
0E9FFD0C16A1856CF9C7C690BA0166E698FA6035 # Julian Seward <jseward@acm.org>
@ -38,35 +46,41 @@ validpgpkeys=(
sha512sums=('2904c13f68245bbafcea70998c6bd20725271300a7e94b6751ca00916943595fc3fac8557da7ea8db31b54a43f092823a0a947bc142829da811d074e1fe49777'
'SKIP'
'e0cec39381cefeca09ae4794cca309dfac7c8693e6315e137e64f5c33684598726d41cfbb4edf764fe985503b13ff596184ca5fc32b159d500ec092e4cf8838c'
'6393ddf84eec93cc9b3e20f9c43a8f3ef37436980c9d91350ebd27d5c41057fe982308ba5d194feddaea4a75a4a9ef14fb404388cc9f4628edbe9ef58787afba'
'1e22b75b95252583774916dab9dcbc8663495107e15dd1ddf397744b288265fcffd1f456d306bc610989a1f650ae66a8ebeb84d253be312db2ab9fdc9fe1407f'
'1e38bfe7230bc43eb66caf630d4baa9a8a20de12856e799d687b6979551b57112427fa097af8ea1c341a9e9fd1d5cea40cb05f7a1a30e6d22049c55cd025f736')
b2sums=('80024371b3e70521996077fba24e233097a6190477ced1b311cd41fead687dcc2511ac0ef723792488f4af08867dff3e1f474816fda09c1604b89059e31c2514'
'SKIP'
'af556fdf3c02e37892bfe9afebc954cf2f1b2fa9b75c1caacfa9f3b456ebc02bf078475f9ee30079b3af5d150d41415a947c3d04235c1ea8412cf92b959c484a'
'5af1f467c8d22334e14e6c2878120550ce5f1e36b61f8180601b8673493a85cca8a0c3a804c281ab51fb04fe5e3706edeb897bbd5486f87d9143f472cd4c46b5'
'305234e118eeb389c95ca8afa45239b0386199dee6f5058a3ddca06a91b2069e1b9831ac5e31badf6d8bd0d43eef3f260d95b976a509d73284149a64d9ea0563'
'12368d1e8bf940597da0b61ebf3e3fd4876ff01959a228abe15d39a940c79b6822530e0fdaee9c847923b02389da851b0ad861533d7692cbb009170606445491')
options=(!lto) # https://bugs.kde.org/show_bug.cgi?id=338252
prepare() {
cd valgrind-${pkgver}
patch -Np1 < ../valgrind-3.7.0-respect-flags.patch
patch -Np1 < ../elfv2-ppc64-be.patch
sed -i 's|sgml/docbook/xsl-stylesheets|xml/docbook/xsl-stylesheets-1.79.2-nons|' docs/Makefile.am
# can be dropped with the next release, see
# https://gitlab.archlinux.org/archlinux/packaging/packages/valgrind/-/issues/2
patch -Np1 < ../valgrind_3_22_0_s390x-linux_memfd_secret.patch
patch -Np1 < ../valgrind_3_22_0_fchmodat2_syscall.patch
patch -Np1 < ../elfv2-ppc64-be.patch
autoreconf -ifv
}
build() {
# valgrind does not like some of our flags
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
CFLAGS=${CFLAGS/-fno-plt/}
CXXFLAGS=${CXXFLAGS/-fno-plt/}
cd valgrind-${pkgver}
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--libexecdir=/usr/lib \
--mandir=/usr/share/man
--mandir=/usr/share/man \
--enable-lto=yes
make
make -C docs man-pages
}

View File

@ -0,0 +1,185 @@
diff --git a/callgrind/callgrind_control.in b/callgrind/callgrind_control.in
index 083ffa29fc..bee6661efb 100644
--- a/callgrind/callgrind_control.in
+++ b/callgrind/callgrind_control.in
@@ -29,6 +29,12 @@ use File::Basename;
# vgdb_exe will be set to a vgdb found 'near' the callgrind_control file
my $vgdb_exe = "";
+my $vgdbPrefixOption = "";
+my $cmd = "";
+my %cmd;
+my %cmdline;
+my $pid = -1;
+my @pids = ();
sub getCallgrindPids {
@@ -50,6 +56,8 @@ sub getCallgrindPids {
close LIST;
}
+my $headerPrinted = 0;
+
sub printHeader {
if ($headerPrinted) { return; }
$headerPrinted = 1;
@@ -95,11 +103,17 @@ sub printHelp {
# Parts more or less copied from cg_annotate (author: Nicholas Nethercote)
#
+my $event = "";
+my $events = "";
+my %events = ();
+my @events = ();
+my @show_events = ();
+my @show_order = ();
+
sub prepareEvents {
@events = split(/\s+/, $events);
- %events = ();
- $n = 0;
+ my $n = 0;
foreach $event (@events) {
$events{$event} = $n;
$n++;
@@ -178,7 +192,7 @@ sub print_events ($)
{
my ($CC_col_widths) = @_;
- foreach my $i (@show_order) {
+ foreach my $i (@show_order) {
my $event = $events[$i];
my $event_width = length($event);
my $col_width = $CC_col_widths->[$i];
@@ -209,7 +223,7 @@ if (-x $controldir . "/vgdb") {
# To find the list of active pids, we need to have
# the --vgdb-prefix option if given.
-$vgdbPrefixOption = "";
+my $arg = "";
foreach $arg (@ARGV) {
if ($arg =~ /^--vgdb-prefix=.*$/) {
$vgdbPrefixOption=$arg;
@@ -219,15 +233,19 @@ foreach $arg (@ARGV) {
getCallgrindPids;
-$requestEvents = 0;
-$requestDump = 0;
-$switchInstr = 0;
-$headerPrinted = 0;
-$dumpHint = "";
+my $requestEvents = 0;
+my $requestDump = 0;
+my $switchInstr = 0;
+my $dumpHint = "";
+my $printBacktrace = 0;
+my $printStatus = 0;
+my $switchInstrMode = "";
+my $requestKill = "";
+my $requestZero = "";
-$verbose = 0;
+my $verbose = 0;
-%spids = ();
+my %spids = ();
foreach $arg (@ARGV) {
if ($arg =~ /^-/) {
if ($requestDump == 1) { $requestDump = 2; }
@@ -329,8 +347,8 @@ foreach $arg (@ARGV) {
}
if (defined $cmd{$arg}) { $spids{$arg} = 1; next; }
- $nameFound = 0;
- foreach $p (@pids) {
+ my $nameFound = 0;
+ foreach my $p (@pids) {
if ($cmd{$p} =~ /$arg$/) {
$nameFound = 1;
$spids{$p} = 1;
@@ -353,11 +371,11 @@ if (scalar @pids == 0) {
exit;
}
-@spids = keys %spids;
+my @spids = keys %spids;
if (scalar @spids >0) { @pids = @spids; }
-$vgdbCommand = "";
-$waitForAnswer = 0;
+my $vgdbCommand = "";
+my $waitForAnswer = 0;
if ($requestDump) {
$vgdbCommand = "dump";
if ($dumpHint ne "") { $vgdbCommand .= " ".$dumpHint; }
@@ -371,7 +389,7 @@ if ($printStatus || $printBacktrace || $requestEvents) {
}
foreach $pid (@pids) {
- $pidstr = "PID $pid: ";
+ my $pidstr = "PID $pid: ";
if ($pid >0) { print $pidstr.$cmdline{$pid}; }
if ($vgdbCommand eq "") {
@@ -385,24 +403,24 @@ foreach $pid (@pids) {
}
open RESULT, $vgdb_exe . " $vgdbPrefixOption --pid=$pid $vgdbCommand|";
- @tids = ();
- $ctid = 0;
- %fcount = ();
- %func = ();
- %calls = ();
- %events = ();
- @events = ();
- @threads = ();
- %totals = ();
-
- $exec_bbs = 0;
- $dist_bbs = 0;
- $exec_calls = 0;
- $dist_calls = 0;
- $dist_ctxs = 0;
- $dist_funcs = 0;
- $threads = "";
- $events = "";
+ my @tids = ();
+ my $tid;
+ my $ctid = 0;
+ my %fcount = ();
+ my %func = ();
+ my %calls = ();
+ my @threads = ();
+ my %totals = ();
+ my $totals_width = [];
+
+ my $exec_bbs = 0;
+ my $dist_bbs = 0;
+ my $exec_calls = 0;
+ my $dist_calls = 0;
+ my $dist_ctxs = 0;
+ my $dist_funcs = 0;
+ my $threads = "";
+ my $instrumentation = "";
while(<RESULT>) {
if (/function-(\d+)-(\d+): (.+)$/) {
@@ -485,10 +503,10 @@ foreach $pid (@pids) {
}
print "Backtrace for Thread $tid\n";
- $i = $fcount{$tid};
- $c = 0;
+ my $i = $fcount{$tid};
+ my $c = 0;
while($i>0 && $c<100) {
- $fc = substr(" $c",-2);
+ my $fc = substr(" $c",-2);
print " [$fc] ";
if ($requestEvents >0) {
print_CC($events{$tid,$i-1}, $totals_width);
--
2.39.3

View File

@ -0,0 +1,204 @@
From 372d09fd9a8d76847c81092ebff71c80fd6c145d Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Sat, 18 Nov 2023 21:17:02 +0100
Subject: [PATCH 1/1] 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
---
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 f13726bc0d..d50cdcc981 100644
--- a/coregrind/m_syswrap/priv_syswrap-linux.h
+++ b/coregrind/m_syswrap/priv_syswrap-linux.h
@@ -334,6 +334,9 @@ DECL_TEMPLATE(linux, sys_memfd_secret);
// Linux-specific (since Linux 5.6)
DECL_TEMPLATE(linux, sys_pidfd_getfd);
+// 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 8de4371e20..d93d937211 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 5a16ca124e..21fc066d6d 100644
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
@@ -1060,6 +1060,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 f80890bd0c..5a24dcaf39 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -841,6 +841,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 0cc6221976..01bbba0a6d 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -6077,6 +6077,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 e90809602c..ba0a453879 100644
--- a/coregrind/m_syswrap/syswrap-mips32-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c
@@ -1145,6 +1145,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 1452e6b74f..ead350719d 100644
--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
@@ -823,6 +823,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY (__NR_pidfd_getfd, sys_pidfd_getfd),
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 fad05702d2..b7eaa24ebc 100644
--- a/coregrind/m_syswrap/syswrap-nanomips-linux.c
+++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c
@@ -831,6 +831,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_pidfd_getfd, sys_pidfd_getfd),
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 53722fbf7f..7cb0221314 100644
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
@@ -1067,6 +1067,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 6a99673251..bd7fbb2c5a 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -1033,6 +1033,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 3238eef3ff..4f03f218eb 100644
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
@@ -876,6 +876,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-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
index c7eff0585c..f57b5395ca 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -1657,6 +1657,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 1bd4066703..068a2cd12b 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

@ -0,0 +1,25 @@
From ca88e1c63178186a1f6a0d0b1a4ba4ee895af323 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Sat, 18 Nov 2023 02:23:10 +0100
Subject: [PATCH] s390x-linux also has memfd_secret, syswrap it
---
coregrind/m_syswrap/syswrap-s390x-linux.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
index 7740bd61f6..3238eef3ff 100644
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
@@ -874,6 +874,8 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_faccessat2, sys_faccessat2), // 439
LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
+
+ LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
--
2.39.3