Upgrade to 3.22.0

This commit is contained in:
starlet-dx 2024-01-08 15:24:40 +08:00
parent dc6bc7aee0
commit adecb310dd
10 changed files with 9067 additions and 30494 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,154 +0,0 @@
From 3c8567894361a3373c573566cdf3615954c07f6f Mon Sep 17 00:00:00 2001
From: gaoxingwang <gaoxingwang@huawei.com>
Date: Wed, 9 Feb 2022 15:43:41 +0800
Subject: [PATCH] Generate a ENOSYS (sys_ni_syscall) for clone3 on all linux
arches
---
coregrind/m_syswrap/syswrap-amd64-linux.c | 1 +
coregrind/m_syswrap/syswrap-arm-linux.c | 1 +
coregrind/m_syswrap/syswrap-arm64-linux.c | 1 +
coregrind/m_syswrap/syswrap-mips32-linux.c | 1 +
coregrind/m_syswrap/syswrap-mips64-linux.c | 1 +
coregrind/m_syswrap/syswrap-nanomips-linux.c | 1 +
coregrind/m_syswrap/syswrap-ppc32-linux.c | 1 +
coregrind/m_syswrap/syswrap-ppc64-linux.c | 1 +
coregrind/m_syswrap/syswrap-s390x-linux.c | 1 +
coregrind/m_syswrap/syswrap-x86-linux.c | 1 +
include/vki/vki-scnums-shared-linux.h | 1 +
11 files changed, 11 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
index 0aef84a..d0d7efa 100644
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
@@ -873,6 +873,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
+ GENX_(__NR_clone3, sys_ni_syscall), // 435
};
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 db7ce10..ea703e3 100644
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
@@ -1042,6 +1042,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_futex_time64, sys_futex_time64), // 422
LINXY(__NR_sched_rr_get_interval_time64,
sys_sched_rr_get_interval_time64), // 423
+ GENX_(__NR_clone3, sys_ni_syscall), // 435
};
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
index 3ae8d86..9a9a1f9 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -825,6 +825,7 @@ static SyscallTableEntry syscall_main_table[] = {
// (__NR_pkey_free, sys_ni_syscall), // 290
LINXY(__NR_statx, sys_statx), // 397
+ GENX_(__NR_clone3, sys_ni_syscall), // 435
};
diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c
index c70bc21..8a7e395 100644
--- a/coregrind/m_syswrap/syswrap-mips32-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c
@@ -1127,6 +1127,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_futex_time64, sys_futex_time64), // 422
LINXY(__NR_sched_rr_get_interval_time64,
sys_sched_rr_get_interval_time64), // 423
+ GENX_(__NR_clone3, sys_ni_syscall), // 435
};
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 f6624bb..06f82e6 100644
--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
@@ -810,6 +810,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_ (__NR_syncfs, sys_syncfs),
LINXY (__NR_statx, sys_statx),
LINX_ (__NR_setns, sys_setns),
+ GENX_ (__NR_clone3, sys_ni_syscall),
};
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 35a11ba..80c1a6f 100644
--- a/coregrind/m_syswrap/syswrap-nanomips-linux.c
+++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c
@@ -820,6 +820,7 @@ static SyscallTableEntry syscall_main_table[] = {
// (__NR_pkey_mprotect, sys_ni_syscall),
// (__NR_pkey_alloc, sys_ni_syscall),
// (__NR_pkey_free, sys_ni_syscall),
+ GENX_ (__NR_clone3, sys_ni_syscall),
};
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 8f8eec3..260b8b4 100644
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
@@ -1044,6 +1044,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_futex_time64, sys_futex_time64), // 422
LINXY(__NR_sched_rr_get_interval_time64,
sys_sched_rr_get_interval_time64), // 423
+ GENX_(__NR_clone3, sys_ni_syscall), // 435
};
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 d65a664..f29f0a2 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -1010,6 +1010,7 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_pwritev2, sys_pwritev2), // 381
LINXY(__NR_statx, sys_statx), // 383
+ GENX_(__NR_clone3, sys_ni_syscall), // 435
};
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 7655b4b..e0c0d5d 100644
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
@@ -857,6 +857,7 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_pwritev2, sys_pwritev2), // 377
LINXY(__NR_statx, sys_statx), // 379
+ GENX_(__NR_clone3, sys_ni_syscall), // 435
};
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 e047e59..d432e32 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -1643,6 +1643,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register),// 427
+ GENX_(__NR_clone3, sys_ni_syscall), // 435
};
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 6221d5a..963cd8e 100644
--- a/include/vki/vki-scnums-shared-linux.h
+++ b/include/vki/vki-scnums-shared-linux.h
@@ -38,5 +38,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_clone3 435
#endif
--
2.27.0

View File

@ -0,0 +1,206 @@
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

@ -0,0 +1,122 @@
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

@ -0,0 +1,32 @@
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,15 +0,0 @@
--- valgrind/glibc-2.34567-NPTL-helgrind.supp.jj 2009-08-19 15:37:48.000000000 +0200
+++ valgrind/glibc-2.34567-NPTL-helgrind.supp 2009-10-21 16:46:31.000000000 +0200
@@ -88,6 +88,12 @@
obj:*/lib*/libpthread-2.*so*
}
{
+ helgrind-glibc2X-102a
+ Helgrind:Race
+ fun:mythread_wrapper
+ obj:*vgpreload_helgrind*.so
+}
+{
helgrind-glibc2X-103
Helgrind:Race
fun:pthread_cond_*@@GLIBC_2.*

View File

@ -1,203 +0,0 @@
From 64c0d0ffbe9ee5c1c4399bc998a2602c0848b70b Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Wed, 2 Mar 2022 21:07:09 -0500
Subject: [PATCH] valgrind: Implement linux rseq syscall as ENOSYS
This implements rseq for amd64, arm, arm64, ppc32, ppc64,
s390x and x86 linux as ENOSYS (without warning).
glibc will start using rseq to accelerate sched_getcpu, if
available. This would cause a warning from valgrind every
time a new thread is started.
Real rseq (restartable sequences) support is pretty hard, so
for now just explicitly return ENOSYS (just like we do for clone3).
https://sourceware.org/pipermail/libc-alpha/2021-December/133656.html
-----
conflicts:
context conflicts
---
coregrind/m_syswrap/syswrap-amd64-linux.c | 2 ++
coregrind/m_syswrap/syswrap-arm-linux.c | 1 +
coregrind/m_syswrap/syswrap-arm64-linux.c | 4 +++-
coregrind/m_syswrap/syswrap-ppc32-linux.c | 2 ++
coregrind/m_syswrap/syswrap-ppc64-linux.c | 3 +++
coregrind/m_syswrap/syswrap-s390x-linux.c | 3 +++
coregrind/m_syswrap/syswrap-x86-linux.c | 2 ++
include/vki/vki-scnums-arm-linux.h | 1 +
include/vki/vki-scnums-arm64-linux.h | 4 +++-
include/vki/vki-scnums-ppc32-linux.h | 1 +
include/vki/vki-scnums-ppc64-linux.h | 1 +
include/vki/vki-scnums-s390x-linux.h | 5 ++++-
12 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
index d0d7efa..5cd630f 100644
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
@@ -862,6 +862,8 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_statx, sys_statx), // 332
+ GENX_(__NR_rseq, sys_ni_syscall), // 334
+
LINX_(__NR_membarrier, sys_membarrier), // 324
LINX_(__NR_copy_file_range, sys_copy_file_range), // 326
diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
index ea703e3..8dbe3bc 100644
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
@@ -1020,6 +1020,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_(__NR_pwritev2, sys_pwritev2), // 393
LINXY(__NR_statx, sys_statx), // 397
+ GENX_(__NR_rseq, sys_ni_syscall), // 398
LINXY(__NR_clock_gettime64, sys_clock_gettime64), // 403
LINX_(__NR_clock_settime64, sys_clock_settime64), // 404
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
index 9a9a1f9..76e14fa 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -823,8 +823,10 @@ static SyscallTableEntry syscall_main_table[] = {
// (__NR_pkey_mprotect, sys_ni_syscall), // 288
// (__NR_pkey_alloc, sys_ni_syscall), // 289
// (__NR_pkey_free, sys_ni_syscall), // 290
+ LINXY(__NR_statx, sys_statx), // 291
+
+ GENX_(__NR_rseq, sys_ni_syscall), // 293
- LINXY(__NR_statx, sys_statx), // 397
GENX_(__NR_clone3, sys_ni_syscall), // 435
};
diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c
index 260b8b4..f07fb8e 100644
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
@@ -1023,6 +1023,8 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_statx, sys_statx), // 383
+ GENX_(__NR_rseq, sys_ni_syscall), // 387
+
LINXY(__NR_clock_gettime64, sys_clock_gettime64), // 403
LINX_(__NR_clock_settime64, sys_clock_settime64), // 404
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
index f29f0a2..106b56c 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -1010,6 +1010,9 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_pwritev2, sys_pwritev2), // 381
LINXY(__NR_statx, sys_statx), // 383
+
+ GENX_(__NR_rseq, sys_ni_syscall), // 387
+
GENX_(__NR_clone3, sys_ni_syscall), // 435
};
diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
index e0c0d5d..9756d23 100644
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
@@ -857,6 +857,9 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_pwritev2, sys_pwritev2), // 377
LINXY(__NR_statx, sys_statx), // 379
+
+ GENX_(__NR_rseq, sys_ni_syscall), // 381
+
GENX_(__NR_clone3, sys_ni_syscall), // 435
};
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
index d432e32..d29f82c 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -1618,6 +1618,8 @@ static SyscallTableEntry syscall_table[] = {
/* Explicitly not supported on i386 yet. */
GENX_(__NR_arch_prctl, sys_ni_syscall), // 384
+ GENX_(__NR_rseq, sys_ni_syscall), // 386
+
LINXY(__NR_clock_gettime64, sys_clock_gettime64), // 403
LINX_(__NR_clock_settime64, sys_clock_settime64), // 404
diff --git a/include/vki/vki-scnums-arm-linux.h b/include/vki/vki-scnums-arm-linux.h
index ff560e1..485db8b 100644
--- a/include/vki/vki-scnums-arm-linux.h
+++ b/include/vki/vki-scnums-arm-linux.h
@@ -432,6 +432,7 @@
#define __NR_pkey_alloc 395
#define __NR_pkey_free 396
#define __NR_statx 397
+#define __NR_rseq 398
diff --git a/include/vki/vki-scnums-arm64-linux.h b/include/vki/vki-scnums-arm64-linux.h
index 9aa3b2b..acdfb39 100644
--- a/include/vki/vki-scnums-arm64-linux.h
+++ b/include/vki/vki-scnums-arm64-linux.h
@@ -323,9 +323,11 @@
#define __NR_pkey_alloc 289
#define __NR_pkey_free 290
#define __NR_statx 291
+#define __NR_io_pgetevents 291
+#define __NR_rseq 293
#undef __NR_syscalls
-#define __NR_syscalls 292
+#define __NR_syscalls 294
///*
// * All syscalls below here should go away really,
diff --git a/include/vki/vki-scnums-ppc32-linux.h b/include/vki/vki-scnums-ppc32-linux.h
index 6987ad9..08fa77d 100644
--- a/include/vki/vki-scnums-ppc32-linux.h
+++ b/include/vki/vki-scnums-ppc32-linux.h
@@ -415,6 +415,7 @@
#define __NR_pkey_alloc 384
#define __NR_pkey_free 385
#define __NR_pkey_mprotect 386
+#define __NR_rseq 387
#endif /* __VKI_SCNUMS_PPC32_LINUX_H */
diff --git a/include/vki/vki-scnums-ppc64-linux.h b/include/vki/vki-scnums-ppc64-linux.h
index 6827964..507117b 100644
--- a/include/vki/vki-scnums-ppc64-linux.h
+++ b/include/vki/vki-scnums-ppc64-linux.h
@@ -407,6 +407,7 @@
#define __NR_pkey_alloc 384
#define __NR_pkey_free 385
#define __NR_pkey_mprotect 386
+#define __NR_pkey_rseq 387
#endif /* __VKI_SCNUMS_PPC64_LINUX_H */
diff --git a/include/vki/vki-scnums-s390x-linux.h b/include/vki/vki-scnums-s390x-linux.h
index f386170..51cc572 100644
--- a/include/vki/vki-scnums-s390x-linux.h
+++ b/include/vki/vki-scnums-s390x-linux.h
@@ -340,8 +340,11 @@
#define __NR_s390_guarded_storage 378
#define __NR_statx 379
#define __NR_s390_sthyi 380
+#define __NR_kexec_file_load 381
+#define __NR_io_pgetevents 382
+#define __NR_rseq 383
-#define NR_syscalls 381
+#define NR_syscalls 384
/*
* There are some system calls that are not present on 64 bit, some
--
2.27.0

View File

@ -1,75 +0,0 @@
From c8c53b2ea49142f4e764520e0af71c0d48bbf00a Mon Sep 17 00:00:00 2001
From: Feiyang Chen <chenfeiyang@loongson.cn>
Date: Tue, 3 Jan 2023 11:17:29 +0800
Subject: [PATCH] valgrind: Sync LoongArch with glibc 2.36
---
coregrind/vgdb-invoker-ptrace.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/coregrind/vgdb-invoker-ptrace.c b/coregrind/vgdb-invoker-ptrace.c
index 7865c53..d930589 100644
--- a/coregrind/vgdb-invoker-ptrace.c
+++ b/coregrind/vgdb-invoker-ptrace.c
@@ -759,11 +759,7 @@ void restore_and_detach (pid_t pid)
}
DEBUG(1, "setregs restore registers pid %d\n", pid_of_save_regs);
-#if defined(VGP_loongarch64_linux)
- if (!setregs(pid_of_save_regs, &user_save.gpr, sizeof(user_save.gpr))) {
-#else
if (!setregs(pid_of_save_regs, &user_save.regs, sizeof(user_save.regs))) {
-#endif
ERROR(errno, "setregs restore registers pid %d after cont\n",
pid_of_save_regs);
}
@@ -845,11 +841,7 @@ Bool invoker_invoke_gdbserver (pid_t pid)
return False;
}
-#if defined(VGP_loongarch64_linux)
- if (!getregs(pid, &user_mod.gpr, sizeof(user_mod.gpr))) {
-#else
if (!getregs(pid, &user_mod.regs, sizeof(user_mod.regs))) {
-#endif
detach_from_all_threads(pid);
return False;
}
@@ -885,7 +877,7 @@ Bool invoker_invoke_gdbserver (pid_t pid)
#elif defined(VGA_mips64)
sp = user_mod.regs[29];
#elif defined(VGA_loongarch64)
- sp = user_mod.gpr[3];
+ sp = user_mod.regs[3];
#else
I_die_here : (sp) architecture missing in vgdb-invoker-ptrace.c
#endif
@@ -1084,10 +1076,10 @@ Bool invoker_invoke_gdbserver (pid_t pid)
user_mod.regs[25] = shared64->invoke_gdbserver;
#elif defined(VGA_loongarch64)
/* put check arg in register a0 */
- user_mod.gpr[4] = check;
+ user_mod.regs[4] = check;
/* put NULL return address in ra */
- user_mod.gpr[1] = bad_return;
- user_mod.pc = shared64->invoke_gdbserver;
+ user_mod.regs[1] = bad_return;
+ user_mod.csr_era = shared64->invoke_gdbserver;
#else
I_die_here: architecture missing in vgdb-invoker-ptrace.c
#endif
@@ -1096,11 +1088,7 @@ Bool invoker_invoke_gdbserver (pid_t pid)
assert(0);
}
-#if defined(VGP_loongarch64_linux)
- if (!setregs(pid, &user_mod.gpr, sizeof(user_mod.gpr))) {
-#else
if (!setregs(pid, &user_mod.regs, sizeof(user_mod.regs))) {
-#endif
detach_from_all_threads(pid);
return False;
}
--
2.33.0

View File

@ -16,26 +16,33 @@
%endif
Name: valgrind
Version: 3.16.0
Release: 7
Version: 3.22.0
Release: 1
Epoch: 1
Summary: An instrumentation framework for building dynamic analysis tools
License: GPLv2+
URL: http://www.valgrind.org/
Source0: ftp://sourceware.org/pub/%{name}/%{name}-%{version}.tar.bz2
Source0: https://sourceware.org/pub/%{name}/%{name}-%{version}.tar.bz2
Patch1: valgrind-3.9.0-cachegrind-improvements.patch
Patch2: valgrind-3.9.0-helgrind-race-supp.patch
Patch3: valgrind-3.9.0-ldso-supp.patch
Patch4: backport-Generate-a-ENOSYS-sys_ni_syscall-for-clone3-on-all-linux-arches.patch
Patch5: valgrind-Implement-linux-rseq-syscall-as-ENOSYS.patch
Patch6: Add-LOONGARCH64-Linux-support.patch
Patch7: valgrind-Sync-LoongArch-with-glibc-2.36.patch
Patch2: valgrind-3.9.0-ldso-supp.patch
%if "%{toolchain}" == "clang"
Patch8: Add-AArch64-clang-longjmp-support.patch
Patch3: Add-AArch64-clang-longjmp-support.patch
%endif
# Add LOONGARCH64 support
Patch4: Add-LOONGARCH64-Linux-support.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
BuildRequires: glibc glibc-devel gdb procps gcc-c++ perl(Getopt::Long)
BuildRequires: automake autoconf
%description
Valgrind is an instrumentation framework for building dynamic analysis tools. There are
@ -55,6 +62,9 @@ This files contains the development files for %{name}.
%autosetup -n %{name}-%{version} -p1
%build
# Some patches (might) touch Makefile.am or configure.ac files.
# Just always autoreconf so we don't need patches to prebuild files.
./autogen.sh
CC=%{__cc}
%ifarch x86_64
mkdir -p shared/libgcc/32
@ -94,13 +104,12 @@ popd
%doc %{_datadir}/doc/%{name}/{html,*.pdf}
%exclude %{_datadir}/doc/%{name}/*.ps
%{_bindir}/*
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*[^ao]
%attr(0755,root,root) %{_libdir}/valgrind/vgpreload*-%{arch_val}-*so
%dir %{_libexecdir}/%{name}
%{_libexecdir}/valgrind/*[^o]
%attr(0755,root,root) %{_libexecdir}/valgrind/vgpreload*-%{arch_val}-*so
%if "%{arch_old_val}" != ""
%{_libdir}/%{name}/vgpreload*-%{arch_old_val}-*so
%{_libdir}/%{name}/*-%{arch_old_val}-*
%endif
%{_libexecdir}/valgrind/*
%files devel
%{_includedir}/%{name}
@ -111,6 +120,9 @@ popd
%{_mandir}/man1/*
%changelog
* Mon Jan 08 2024 yaoxin <yao_xin001@hoperun.com> - 1:3.22.0-1
- Upgrade to 3.22.0
* Tue Aug 29 2023 liyunfei <liyunfei33@huawei.com> - 1:3.16.0-7
- Add clang compile support on AArch64