3.22.0-0.1.RC1
- Upstream 3.22.0-RC1 - Remove all upstreamed patches - Adjust valgrind-3.16.0-some-stack-protector.patch - Adjust valgrind-3.16.0-some-Wl-z-now.patch - Add cachegrind.h to valgrind-devel package
This commit is contained in:
parent
35cf45d805
commit
e5b933a454
1
.gitignore
vendored
1
.gitignore
vendored
@ -48,3 +48,4 @@
|
||||
/valgrind-3.21.0.RC1.tar.bz2
|
||||
/valgrind-3.21.0.RC2.tar.bz2
|
||||
/valgrind-3.21.0.tar.bz2
|
||||
/valgrind-3.22.0.RC1.tar.bz2
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (valgrind-3.21.0.tar.bz2) = 3e86cda2f2d6cd30807fac7933ba2c46a97a2b4a868db989e6b0cceeadf029af7ee34ba900466a346948289aacb30f4399799bb83b97cc49a4d2d810441e5cfd
|
||||
SHA512 (valgrind-3.22.0.RC1.tar.bz2) = 0aa9e98a959808d20cce53575433f81973ef3de3acc313ef2700f58cf9b2b7ee951b5bc701ef8508f5c136cb14239bbe7d81ae4208679ba55150b3edfd6078f0
|
||||
|
@ -48,8 +48,8 @@ index 3c73210..fb6b7bb 100644
|
||||
# If there is no secondary platform, and the platforms include x86-darwin,
|
||||
# then the primary platform must be x86-darwin. Hence:
|
||||
if ! VGCONF_HAVE_PLATFORM_SEC
|
||||
@@ -96,7 +96,7 @@ endif
|
||||
vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI)
|
||||
@@ -104,7 +104,7 @@
|
||||
vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) $(GDB_SCRIPTS_DIR)
|
||||
vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong
|
||||
vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI)
|
||||
-vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@
|
||||
|
@ -94,10 +94,10 @@ index 94030fd..3c73210 100644
|
||||
valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI)
|
||||
valgrind_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@
|
||||
# If there is no secondary platform, and the platforms include x86-darwin,
|
||||
@@ -94,7 +94,7 @@ vgdb_SOURCES += vgdb-invoker-solaris.c
|
||||
@@ -102,7 +102,7 @@
|
||||
endif
|
||||
|
||||
vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI)
|
||||
vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) $(GDB_SCRIPTS_DIR)
|
||||
-vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS)
|
||||
+vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong
|
||||
vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI)
|
||||
|
@ -1,123 +0,0 @@
|
||||
From e97f7a6cf2315908fb0a9b900f1de87a155c9df1 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
Date: Sun, 14 May 2023 23:34:05 +0200
|
||||
Subject: [PATCH] Add --with-gdbscripts-dir=PATH configure option
|
||||
|
||||
Currently the gdb valgrind scripts are installed under VG_LIBDIR
|
||||
which is normally pkglibexecdir which is likely not in the default
|
||||
gdb safe-path (a list of directories from which it is safe to
|
||||
auto-load files). So users will have to add the directory to their
|
||||
.gdbinit file.
|
||||
|
||||
This patch adds a --with-gdbscripts-dir=PATH configure option that
|
||||
sets VG_GDBSCRIPTS_DIR to the given PATH (${libexecdir}/valgrind if
|
||||
not given).
|
||||
|
||||
Use VG_GDBSCRIPTS_DIR as gdbscriptsdir to install the valgrind-monitor
|
||||
python files and pass it with CPPFLAGS when building vg_preloaded.c
|
||||
and vgdb.c to use instead of VG_LIBDIR.
|
||||
---
|
||||
configure.ac | 11 +++++++++++
|
||||
coregrind/Makefile.am | 15 ++++++++++-----
|
||||
coregrind/vg_preloaded.c | 2 +-
|
||||
coregrind/vgdb.c | 2 +-
|
||||
4 files changed, 23 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 15fbf5ea2..223ab4529 100755
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1198,6 +1198,17 @@ AC_MSG_RESULT([$xcodedir])
|
||||
AC_DEFINE_UNQUOTED(XCODE_DIR, "$xcodedir", [xcode sdk include directory])
|
||||
AC_SUBST(XCODE_DIR, [$xcodedir])])
|
||||
|
||||
+#----------------------------------------------------------------------------
|
||||
+# Where to install gdb scripts, defaults to VG_LIBDIR (pkglibexecdir)
|
||||
+#----------------------------------------------------------------------------
|
||||
+AC_MSG_CHECKING([where gdb scripts are installed])
|
||||
+AC_ARG_WITH(gdbscripts-dir,
|
||||
+ [ --with-gdbscripts-dir=PATH Specify path to install gdb scripts],
|
||||
+ [gdbscriptsdir=${withval}],
|
||||
+ [gdbscriptsdir=${libexecdir}/valgrind])
|
||||
+AC_MSG_RESULT([$gdbscriptsdir])
|
||||
+AC_SUBST(VG_GDBSCRIPTS_DIR, [$gdbscriptsdir])
|
||||
+
|
||||
#----------------------------------------------------------------------------
|
||||
# Libc and suppressions
|
||||
#----------------------------------------------------------------------------
|
||||
diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
|
||||
index 553211782..64d593b08 100644
|
||||
--- a/coregrind/Makefile.am
|
||||
+++ b/coregrind/Makefile.am
|
||||
@@ -101,7 +101,8 @@
|
||||
vgdb_SOURCES += vgdb-invoker-freebsd.c
|
||||
endif
|
||||
|
||||
-vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI)
|
||||
+vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) \
|
||||
+ -DVG_GDBSCRIPTS_DIR="\"@VG_GDBSCRIPTS_DIR@\""
|
||||
vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong
|
||||
vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI)
|
||||
vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ -Wl,-z,now
|
||||
@@ -626,7 +627,8 @@
|
||||
|
||||
vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_SOURCES = vg_preloaded.c
|
||||
vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CPPFLAGS = \
|
||||
- $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
|
||||
+ $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
|
||||
+ -DVG_GDBSCRIPTS_DIR="\"@VG_GDBSCRIPTS_DIR@\""
|
||||
vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CFLAGS = \
|
||||
$(AM_CFLAGS_PSO_@VGCONF_PLATFORM_PRI_CAPS@)
|
||||
vgpreload_core_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
|
||||
@@ -634,7 +636,8 @@
|
||||
if VGCONF_HAVE_PLATFORM_SEC
|
||||
vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = vg_preloaded.c
|
||||
vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CPPFLAGS = \
|
||||
- $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
|
||||
+ $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) \
|
||||
+ -DVG_GDBSCRIPTS_DIR="\"@VG_GDBSCRIPTS_DIR@\""
|
||||
vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CFLAGS = \
|
||||
$(AM_CFLAGS_PSO_@VGCONF_PLATFORM_SEC_CAPS@)
|
||||
vgpreload_core_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_LDFLAGS = \
|
||||
@@ -766,8 +769,10 @@
|
||||
# so as to make sure these get copied into the install tree
|
||||
vglibdir = $(pkglibexecdir)
|
||||
vglib_DATA = $(GDBSERVER_XML_FILES)
|
||||
-vglib_DATA += m_gdbserver/valgrind-monitor.py
|
||||
-vglib_DATA += m_gdbserver/valgrind-monitor-def.py
|
||||
+
|
||||
+gdbscriptsdir = @VG_GDBSCRIPTS_DIR@
|
||||
+gdbscripts_DATA = m_gdbserver/valgrind-monitor.py
|
||||
+gdbscripts_DATA += m_gdbserver/valgrind-monitor-def.py
|
||||
|
||||
# so as to make sure these get copied into the tarball
|
||||
EXTRA_DIST += $(GDBSERVER_XML_FILES)
|
||||
diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c
|
||||
index d6e05898c..bff76b81b 100644
|
||||
--- a/coregrind/vg_preloaded.c
|
||||
+++ b/coregrind/vg_preloaded.c
|
||||
@@ -61,7 +61,7 @@
|
||||
.popsection \n\
|
||||
");
|
||||
|
||||
-DEFINE_GDB_PY_SCRIPT(VG_LIBDIR "/valgrind-monitor.py")
|
||||
+DEFINE_GDB_PY_SCRIPT(VG_GDBSCRIPTS_DIR "/valgrind-monitor.py")
|
||||
#endif
|
||||
|
||||
#if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd)
|
||||
diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c
|
||||
index 8ec424077..a449b86e0 100644
|
||||
--- a/coregrind/vgdb.c
|
||||
+++ b/coregrind/vgdb.c
|
||||
@@ -1984,7 +1984,7 @@ void usage(void)
|
||||
" -h --help shows this message\n"
|
||||
" The GDB python code defining GDB front end valgrind commands is:\n %s\n"
|
||||
" To get help from the Valgrind gdbserver, use vgdb help\n"
|
||||
-"\n", vgdb_prefix_default(), VG_LIBDIR "/valgrind-monitor.py"
|
||||
+"\n", vgdb_prefix_default(), VG_GDBSCRIPTS_DIR "/valgrind-monitor.py"
|
||||
);
|
||||
invoker_restrictions_msg();
|
||||
}
|
||||
--
|
||||
2.40.0
|
||||
|
@ -1,12 +0,0 @@
|
||||
diff --git a/callgrind/callgrind_control.in b/callgrind/callgrind_control.in
|
||||
index 083ffa29f..eb50c16ad 100644
|
||||
--- a/callgrind/callgrind_control.in
|
||||
+++ b/callgrind/callgrind_control.in
|
||||
@@ -22,7 +22,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-use strict;
|
||||
use warnings;
|
||||
|
||||
use File::Basename;
|
@ -1,58 +0,0 @@
|
||||
From a0d555a0dfe078ef04ea49d991a8090ab14bd4a5 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Floyd <pjfloyd@wanadoo.fr>
|
||||
Date: Sat, 19 Aug 2023 21:37:33 +0200
|
||||
Subject: [PATCH] Always cleanup on exit from ML_(read_elf_object)
|
||||
|
||||
I'm still a but baffled as to why this wasn't seen earlier.
|
||||
A FreeBSD testcase started failing with kernel 13.2 patch 2,
|
||||
which is quite a minor change. The testcase gets an fd from
|
||||
pdfork and the parent does a printf with the fd then zaps the
|
||||
process with pdkill. Standalone the fd is 3, and that's what
|
||||
the expected contains. However, when it started failing I saw
|
||||
with lsof that fds 3 and 4 were associated with the guest exe
|
||||
and ld-elf.so.1.
|
||||
---
|
||||
coregrind/m_debuginfo/readelf.c | 16 +++++++---------
|
||||
1 file changed, 7 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
|
||||
index f99d3dfd2..ac72f98fb 100644
|
||||
--- a/coregrind/m_debuginfo/readelf.c
|
||||
+++ b/coregrind/m_debuginfo/readelf.c
|
||||
@@ -1916,6 +1916,7 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
|
||||
Word i, j;
|
||||
Bool dynbss_present = False;
|
||||
Bool sdynbss_present = False;
|
||||
+ Bool retval = False;
|
||||
|
||||
/* Image for the main ELF file we're working with. */
|
||||
DiImage* mimg = NULL;
|
||||
@@ -2944,19 +2945,16 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
|
||||
}
|
||||
}
|
||||
|
||||
- return True;
|
||||
+ retval = True;
|
||||
|
||||
- out:
|
||||
- {
|
||||
- /* Last, but not least, detach from the image. */
|
||||
- if (mimg) ML_(img_done)(mimg);
|
||||
+ out:
|
||||
|
||||
- if (svma_ranges) VG_(deleteXA)(svma_ranges);
|
||||
+ /* Last, but not least, detach from the image. */
|
||||
+ if (mimg) ML_(img_done)(mimg);
|
||||
|
||||
- return False;
|
||||
- } /* out: */
|
||||
+ if (svma_ranges) VG_(deleteXA)(svma_ranges);
|
||||
|
||||
- /* NOTREACHED */
|
||||
+ return retval;
|
||||
}
|
||||
|
||||
Bool ML_(read_elf_debug) ( struct _DebugInfo* di )
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,217 +0,0 @@
|
||||
From 17f56ab4c4fce7b4778251e1fab2bc50e5c6dbda Mon Sep 17 00:00:00 2001
|
||||
From: Olli Vanhoja <olli.vanhoja@gmail.com>
|
||||
Date: Mon, 10 Oct 2022 11:44:22 +0200
|
||||
Subject: [PATCH] Add epoll_pwait2
|
||||
|
||||
The only difference between epoll_pwait and epoll_pwait2 is the
|
||||
timeout argument. For epoll_pwait2 this is a timespec (which is
|
||||
always 64bit).
|
||||
|
||||
https://bugs.kde.org/show_bug.cgi?id=460192
|
||||
---
|
||||
NEWS | 1 +
|
||||
coregrind/m_syswrap/priv_syswrap-linux.h | 1 +
|
||||
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 | 23 ++++++++++++++++++++
|
||||
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, 45 insertions(+)
|
||||
|
||||
diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h
|
||||
index a73b6247e..7c9decf5a 100644
|
||||
--- a/coregrind/m_syswrap/priv_syswrap-linux.h
|
||||
+++ b/coregrind/m_syswrap/priv_syswrap-linux.h
|
||||
@@ -105,6 +105,7 @@ DECL_TEMPLATE(linux, sys_epoll_create1);
|
||||
DECL_TEMPLATE(linux, sys_epoll_ctl);
|
||||
DECL_TEMPLATE(linux, sys_epoll_wait);
|
||||
DECL_TEMPLATE(linux, sys_epoll_pwait);
|
||||
+DECL_TEMPLATE(linux, sys_epoll_pwait2);
|
||||
DECL_TEMPLATE(linux, sys_eventfd);
|
||||
DECL_TEMPLATE(linux, sys_eventfd2);
|
||||
|
||||
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
|
||||
index 1aeebd274..008600798 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
|
||||
@@ -883,6 +883,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
|
||||
};
|
||||
|
||||
diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
|
||||
index bca509589..9a7a1e0d2 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
|
||||
@@ -1057,6 +1057,8 @@ static SyscallTableEntry syscall_main_table[] = {
|
||||
LINXY(__NR_close_range, sys_close_range), // 436
|
||||
|
||||
LINX_(__NR_faccessat2, sys_faccessat2), // 439
|
||||
+
|
||||
+ LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
|
||||
};
|
||||
|
||||
|
||||
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
|
||||
index 953236000..6af7bab83 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
|
||||
@@ -837,6 +837,8 @@ static SyscallTableEntry syscall_main_table[] = {
|
||||
|
||||
LINX_(__NR_faccessat2, sys_faccessat2), // 439
|
||||
|
||||
+ LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
|
||||
+
|
||||
LINXY(__NR_memfd_secret, sys_memfd_secret), // 447
|
||||
};
|
||||
|
||||
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
|
||||
index 26f1fbee3..f8621f8f0 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-linux.c
|
||||
@@ -2165,6 +2165,29 @@ POST(sys_epoll_pwait)
|
||||
epoll_post_helper (tid, arrghs, status);
|
||||
}
|
||||
|
||||
+PRE(sys_epoll_pwait2)
|
||||
+{
|
||||
+ *flags |= SfMayBlock;
|
||||
+ PRINT("sys_epoll_pwait2 ( %ld, %#" FMT_REGWORD "x, %ld, %#"
|
||||
+ FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )",
|
||||
+ SARG1, ARG2, SARG3, ARG4, ARG5, ARG6);
|
||||
+ PRE_REG_READ6(long, "epoll_pwait2",
|
||||
+ int, epfd, struct vki_epoll_event *, events,
|
||||
+ int, maxevents, const struct timespec64 *, timeout,
|
||||
+ vki_sigset_t *, sigmask, vki_size_t, sigsetsize);
|
||||
+ /* Assume all (maxevents) events records should be (fully) writable. */
|
||||
+ PRE_MEM_WRITE( "epoll_pwait2(events)", ARG2, sizeof(struct vki_epoll_event)*ARG3);
|
||||
+ /* epoll_pwait2 only supports 64bit timespec. */
|
||||
+ if (ARG4)
|
||||
+ pre_read_timespec64(tid, "epoll_pwait2(timeout)", ARG4);
|
||||
+ if (ARG5)
|
||||
+ PRE_MEM_READ( "epoll_pwait2(sigmask)", ARG5, sizeof(vki_sigset_t) );
|
||||
+}
|
||||
+POST(sys_epoll_pwait2)
|
||||
+{
|
||||
+ epoll_post_helper (tid, arrghs, status);
|
||||
+}
|
||||
+
|
||||
PRE(sys_eventfd)
|
||||
{
|
||||
PRINT("sys_eventfd ( %" FMT_REGWORD "u )", ARG1);
|
||||
diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c
|
||||
index de27998b3..6268a00dd 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-mips32-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c
|
||||
@@ -1141,6 +1141,8 @@ static SyscallTableEntry syscall_main_table[] = {
|
||||
LINXY(__NR_close_range, sys_close_range), // 436
|
||||
|
||||
LINX_ (__NR_faccessat2, sys_faccessat2), // 439
|
||||
+
|
||||
+ LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
|
||||
};
|
||||
|
||||
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 67e7c2c2f..6cdf25893 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
|
||||
@@ -819,6 +819,7 @@ static SyscallTableEntry syscall_main_table[] = {
|
||||
GENX_ (__NR_clone3, sys_ni_syscall),
|
||||
LINXY (__NR_close_range, sys_close_range),
|
||||
LINX_ (__NR_faccessat2, sys_faccessat2),
|
||||
+ LINXY(__NR_epoll_pwait2, sys_epoll_pwait2),
|
||||
};
|
||||
|
||||
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 9c535c68e..d724cde74 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-nanomips-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c
|
||||
@@ -828,6 +828,7 @@ static SyscallTableEntry syscall_main_table[] = {
|
||||
GENX_ (__NR_clone3, sys_ni_syscall),
|
||||
LINXY (__NR_close_range, sys_close_range),
|
||||
LINX_ (__NR_faccessat2, sys_faccessat2),
|
||||
+ LINXY (__NR_epoll_pwait2, sys_epoll_pwait2),
|
||||
};
|
||||
|
||||
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 12c073027..c0cfef235 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
|
||||
@@ -1061,6 +1061,8 @@ static SyscallTableEntry syscall_table[] = {
|
||||
LINXY(__NR_close_range, sys_close_range), // 436
|
||||
|
||||
LINX_(__NR_faccessat2, sys_faccessat2), // 439
|
||||
+
|
||||
+ LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441
|
||||
};
|
||||
|
||||
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 3c33d1267..f5976f30c 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
|
||||
@@ -1030,6 +1030,8 @@ static SyscallTableEntry syscall_table[] = {
|
||||
LINXY(__NR_close_range, sys_close_range), // 436
|
||||
|
||||
LINX_(__NR_faccessat2, sys_faccessat2), // 439
|
||||
+
|
||||
+ LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441
|
||||
};
|
||||
|
||||
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 a377cb731..afba154e7 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
|
||||
@@ -871,6 +871,8 @@ static SyscallTableEntry syscall_table[] = {
|
||||
LINXY(__NR_close_range, sys_close_range), // 436
|
||||
|
||||
LINX_(__NR_faccessat2, sys_faccessat2), // 439
|
||||
+
|
||||
+ LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441
|
||||
};
|
||||
|
||||
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 a9ba15dfe..da4fd8fa2 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
|
||||
@@ -1655,6 +1655,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
|
||||
};
|
||||
|
||||
diff --git a/include/vki/vki-scnums-shared-linux.h b/include/vki/vki-scnums-shared-linux.h
|
||||
index d90cdd312..542382b53 100644
|
||||
--- a/include/vki/vki-scnums-shared-linux.h
|
||||
+++ b/include/vki/vki-scnums-shared-linux.h
|
||||
@@ -46,6 +46,8 @@
|
||||
|
||||
#define __NR_faccessat2 439
|
||||
|
||||
+#define __NR_epoll_pwait2 441
|
||||
+
|
||||
#define __NR_memfd_secret 447
|
||||
|
||||
#endif
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,85 +0,0 @@
|
||||
From 449dd82becae6533a8e658e76f30f65434f6417f Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
Date: Thu, 17 Aug 2023 15:40:30 +0200
|
||||
Subject: [PATCH] gdb --multi mode stdout redirecting to stderr
|
||||
|
||||
When in stdio mode (talking to gdb through stdin/stdout, not
|
||||
through a socket), redirect stdout to stderr and close stdin
|
||||
for the inferior. That way at least some output can be seen,
|
||||
but there will be no input.
|
||||
|
||||
This is workaround till we have real terminal handling.
|
||||
|
||||
* coregrind/vgdb.c (main): Pass in_port to do_multi_mode.
|
||||
(do_multi_mode): Pass in_port to fork_and_exec_valgrind.
|
||||
(fork_and_exec_valgrind): Close stdin, redirect stdout to
|
||||
stderr if in_port <= 0.
|
||||
|
||||
https://bugs.kde.org/show_bug.cgi?id=471311
|
||||
---
|
||||
NEWS | 1 +
|
||||
coregrind/vgdb.c | 20 +++++++++++++++++---
|
||||
2 files changed, 18 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c
|
||||
index 56a969de7..c024ffca6 100644
|
||||
--- a/coregrind/vgdb.c
|
||||
+++ b/coregrind/vgdb.c
|
||||
@@ -1159,7 +1159,7 @@ static void gdb_relay(int pid, int send_noack_mode, char *q_buf);
|
||||
or the errno from the child on failure. */
|
||||
static
|
||||
int fork_and_exec_valgrind (int argc, char **argv, const char *working_dir,
|
||||
- pid_t *pid)
|
||||
+ int in_port, pid_t *pid)
|
||||
{
|
||||
int err = 0;
|
||||
// We will use a pipe to track what the child does,
|
||||
@@ -1243,6 +1243,19 @@ int fork_and_exec_valgrind (int argc, char **argv, const char *working_dir,
|
||||
}
|
||||
}
|
||||
|
||||
+ /* When in stdio mode (talking to gdb through stdin/stdout, not
|
||||
+ through a socket), redirect stdout to stderr and close stdin
|
||||
+ for the inferior. That way at least some output can be seen,
|
||||
+ but there will be no input. */
|
||||
+ if (in_port <= 0) {
|
||||
+ /* close stdin */
|
||||
+ close (0);
|
||||
+ /* open /dev/null as new stdin */
|
||||
+ open ("/dev/null", O_RDONLY);
|
||||
+ /* redirect stdout as stderr */
|
||||
+ dup2 (2, 1);
|
||||
+ }
|
||||
+
|
||||
/* Try to launch valgrind. Add --vgdb-error=0 to stop immediately so we
|
||||
can attach and --launched-with-multi to let valgrind know it doesn't
|
||||
need to show a banner how to connect to gdb, we will do that
|
||||
@@ -1309,7 +1322,7 @@ int fork_and_exec_valgrind (int argc, char **argv, const char *working_dir,
|
||||
|
||||
/* Do multi stuff. */
|
||||
static
|
||||
-void do_multi_mode(int check_trials)
|
||||
+void do_multi_mode(int check_trials, int in_port)
|
||||
{
|
||||
char *buf = vmalloc(PBUFSIZ+1);
|
||||
char *q_buf = vmalloc(PBUFSIZ+1); //save the qSupported packet sent by gdb
|
||||
@@ -1459,6 +1472,7 @@ void do_multi_mode(int check_trials)
|
||||
int res = fork_and_exec_valgrind (count,
|
||||
decoded_string,
|
||||
working_dir,
|
||||
+ in_port,
|
||||
&valgrind_pid);
|
||||
|
||||
if (res == 0) {
|
||||
@@ -2427,7 +2441,7 @@ int main(int argc, char** argv)
|
||||
if (multi_mode) {
|
||||
/* check_trails is the --wait argument in seconds, defaulting to 1
|
||||
* if not given. */
|
||||
- do_multi_mode (check_trials);
|
||||
+ do_multi_mode (check_trials, in_port);
|
||||
} else if (last_command >= 0) {
|
||||
standalone_send_commands(pid, last_command, commands);
|
||||
} else {
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,850 +0,0 @@
|
||||
From 60f7e89ba32b54d73b9e36d49e28d0f559ade0b9 Mon Sep 17 00:00:00 2001
|
||||
From: Aaron Merey <amerey@redhat.com>
|
||||
Date: Fri, 30 Jun 2023 18:31:42 -0400
|
||||
Subject: [PATCH] Support lazy reading and downloading of DWARF debuginfo
|
||||
|
||||
Currently valgrind attempts to read DWARF .debug_* sections as well
|
||||
as separate debuginfo files for ELF binaries as soon as a shared library
|
||||
is loaded. This might also result in the downloading of separate debuginfo
|
||||
files via debuginfod.
|
||||
|
||||
This is inefficient when some of this debuginfo never ends up being used
|
||||
by valgrind while running the client process.
|
||||
|
||||
This patch adds support for lazy reading and downloading of DWARF
|
||||
debuginfo. When an ELF shared library is loaded, the reading of .debug_*
|
||||
sections as well as separate or alternate debuginfo is deferred until
|
||||
valgrind handles an instruction pointer corresponding to a text segment
|
||||
of the shared library. At this point the deferred sections and separate
|
||||
debug files are loaded.
|
||||
|
||||
This feature is only supported on ELF platforms.
|
||||
|
||||
https://bugs.kde.org/show_bug.cgi?id=471807
|
||||
|
||||
ChangeLog
|
||||
* debuginfo.c (di_notify_ACHIEVE_ACCEPT_STATE): Replace
|
||||
read_elf_debug_info with read_elf_object.
|
||||
(addr_load_di): New function. Attempts to load deferred debuginfo
|
||||
associated with a given address.
|
||||
(load_di): New function. Attempts to load a given deferred
|
||||
debuginfo associated with a given address.
|
||||
(describe_IP): Add calls to load_di and addr_load_di.
|
||||
(find_DiCfSI): Add call to load_di.
|
||||
|
||||
* priv_readelf.h (read_elf_object): New declaration.
|
||||
(read_elf_debug): Ditto.
|
||||
|
||||
* priv_storage.h (struct _DebugInfo): New field 'bool deferred'.
|
||||
|
||||
* readelf.c (read_elf_debug_info): Split into read_elf_object and
|
||||
read_elf_debug.
|
||||
(read_elf_object): Read non .debug_* section from an ELF binary.
|
||||
(read_elf_debug): Read .debug_* sections from an ELF binary as
|
||||
as well any separate/alternate debuginfo files.
|
||||
|
||||
* storage.c (canonicaliseSymtab): Remove assert in order to support
|
||||
canonicalization of deferred _DebugInfo.
|
||||
(finish_CFSI_arrays): Add early return if _DebugInfo is
|
||||
deferred in order to avoid freeing memory that will be needed
|
||||
when reading debuginfo at a later time.
|
||||
(canonicaliseTables): Ditto.
|
||||
|
||||
* pub_core_debuginfo.h (addr_load_di): New declaration.
|
||||
(load_di): New declaration.
|
||||
---
|
||||
NEWS | 1 +
|
||||
coregrind/m_debuginfo/debuginfo.c | 57 +++-
|
||||
coregrind/m_debuginfo/priv_readelf.h | 24 +-
|
||||
coregrind/m_debuginfo/priv_storage.h | 7 +
|
||||
coregrind/m_debuginfo/readelf.c | 437 ++++++++++++++++++---------
|
||||
coregrind/m_debuginfo/storage.c | 13 +-
|
||||
coregrind/pub_core_debuginfo.h | 4 +
|
||||
7 files changed, 379 insertions(+), 164 deletions(-)
|
||||
|
||||
diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
|
||||
index 22b41def2..8d1fdc696 100644
|
||||
--- a/coregrind/m_debuginfo/debuginfo.c
|
||||
+++ b/coregrind/m_debuginfo/debuginfo.c
|
||||
@@ -959,14 +959,16 @@ static ULong di_notify_ACHIEVE_ACCEPT_STATE ( struct _DebugInfo* di )
|
||||
discard_DebugInfos_which_overlap_with( di );
|
||||
|
||||
/* The DebugInfoMappings that now exist in the FSM may involve
|
||||
- overlaps. This confuses ML_(read_elf_debug_info), and may cause
|
||||
+ overlaps. This confuses ML_(read_elf_*), and may cause
|
||||
it to compute wrong biases. So de-overlap them now.
|
||||
See http://bugzilla.mozilla.org/show_bug.cgi?id=788974 */
|
||||
truncate_DebugInfoMapping_overlaps( di, di->fsm.maps );
|
||||
|
||||
/* And acquire new info. */
|
||||
# if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd)
|
||||
- ok = ML_(read_elf_debug_info)( di );
|
||||
+ ok = ML_(read_elf_object)( di );
|
||||
+ if (ok)
|
||||
+ di->deferred = True;
|
||||
# elif defined(VGO_darwin)
|
||||
ok = ML_(read_macho_debug_info)( di );
|
||||
# else
|
||||
@@ -1443,6 +1445,50 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd )
|
||||
}
|
||||
}
|
||||
|
||||
+/* Load DI if it has a text segment containing A and DI hasn't already
|
||||
+ been loaded. */
|
||||
+
|
||||
+void VG_(load_di)( DebugInfo *di, Addr a)
|
||||
+{
|
||||
+ if (!di->deferred
|
||||
+ || !di->text_present
|
||||
+ || di->text_size <= 0
|
||||
+ || di->text_avma > a
|
||||
+ || a >= di->text_avma + di->text_size)
|
||||
+ return;
|
||||
+
|
||||
+ di->deferred = False;
|
||||
+ ML_(read_elf_debug) (di);
|
||||
+ ML_(canonicaliseTables)( di );
|
||||
+
|
||||
+ /* Check invariants listed in
|
||||
+ Comment_on_IMPORTANT_REPRESENTATIONAL_INVARIANTS in
|
||||
+ priv_storage.h. */
|
||||
+ check_CFSI_related_invariants(di);
|
||||
+ ML_(finish_CFSI_arrays)(di);
|
||||
+}
|
||||
+
|
||||
+/* Attempt to load DebugInfo with a text segment containing A,
|
||||
+ if such a debuginfo hasn't already been loaded. */
|
||||
+
|
||||
+void VG_(addr_load_di)( Addr a )
|
||||
+{
|
||||
+ DebugInfo *di;
|
||||
+
|
||||
+ di = VG_(find_DebugInfo)(VG_(current_DiEpoch)(), a);
|
||||
+ if (di != NULL)
|
||||
+ if (di->deferred) {
|
||||
+ di->deferred = False;
|
||||
+ ML_(read_elf_debug) (di);
|
||||
+ ML_(canonicaliseTables)( di );
|
||||
+
|
||||
+ /* Check invariants listed in
|
||||
+ Comment_on_IMPORTANT_REPRESENTATIONAL_INVARIANTS in
|
||||
+ priv_storage.h. */
|
||||
+ check_CFSI_related_invariants(di);
|
||||
+ ML_(finish_CFSI_arrays)(di);
|
||||
+ }
|
||||
+}
|
||||
|
||||
/* Unmap is simpler - throw away any SegInfos intersecting
|
||||
[a, a+len). */
|
||||
@@ -2746,6 +2792,11 @@ const HChar* VG_(describe_IP)(DiEpoch ep, Addr eip, const InlIPCursor *iipc)
|
||||
Bool know_objname;
|
||||
Bool know_srcloc;
|
||||
|
||||
+ if (iipc && iipc->di)
|
||||
+ VG_(load_di) (iipc->di, eip);
|
||||
+ else
|
||||
+ VG_(addr_load_di) (eip);
|
||||
+
|
||||
if (is_bottom(iipc)) {
|
||||
// At the bottom (towards main), we describe the fn at eip.
|
||||
know_fnname = VG_(clo_sym_offsets)
|
||||
@@ -3090,6 +3141,8 @@ static void find_DiCfSI ( /*OUT*/DebugInfo** diP,
|
||||
if (!is_DI_valid_for_epoch(di, curr_epoch))
|
||||
continue;
|
||||
|
||||
+ VG_(load_di)(di, ip);
|
||||
+
|
||||
/* Use the per-DebugInfo summary address ranges to skip
|
||||
inapplicable DebugInfos quickly. */
|
||||
if (di->cfsi_used == 0)
|
||||
diff --git a/coregrind/m_debuginfo/priv_readelf.h b/coregrind/m_debuginfo/priv_readelf.h
|
||||
index 57aa0cc3f..7e0fa17c9 100644
|
||||
--- a/coregrind/m_debuginfo/priv_readelf.h
|
||||
+++ b/coregrind/m_debuginfo/priv_readelf.h
|
||||
@@ -44,13 +44,23 @@
|
||||
extern Bool ML_(is_elf_object_file)( const void* image, SizeT n_image,
|
||||
Bool rel_ok );
|
||||
|
||||
-/* The central function for reading ELF debug info. For the
|
||||
- object/exe specified by the SegInfo, find ELF sections, then read
|
||||
- the symbols, line number info, file name info, CFA (stack-unwind
|
||||
- info) and anything else we want, into the tables within the
|
||||
- supplied SegInfo.
|
||||
-*/
|
||||
-extern Bool ML_(read_elf_debug_info) ( DebugInfo* di );
|
||||
+/* Read the ELF binary specified by DI. For the object/exe specified
|
||||
+ by the SegInfo, find ELF sections, then read the symbols, line number
|
||||
+ info, file name info, CFA (stack-unwind info) and anything else we
|
||||
+ want, into the tables within the supplied SegInfo.
|
||||
+
|
||||
+ .debug_* sections as well as any separate debuginfo files are not
|
||||
+ loaded by this function but instead by ML_(read_elf_debug). This
|
||||
+ separation facilitates lazy loading of debuginfo. */
|
||||
+extern Bool ML_(read_elf_object) ( DebugInfo* di );
|
||||
+
|
||||
+/* Read .debug_* sections from the ELF binary specified by DI. Also
|
||||
+ attempt to load any separate debuginfo files associated with the
|
||||
+ object.
|
||||
+
|
||||
+ ML_(read_elf_object) should be called on DI before calling this
|
||||
+ function. */
|
||||
+extern Bool ML_(read_elf_debug) ( DebugInfo* di );
|
||||
|
||||
extern Bool ML_(check_elf_and_get_rw_loads) ( Int fd, const HChar* filename, Int * rw_load_count );
|
||||
|
||||
diff --git a/coregrind/m_debuginfo/priv_storage.h b/coregrind/m_debuginfo/priv_storage.h
|
||||
index a4b90d36b..b959873ab 100644
|
||||
--- a/coregrind/m_debuginfo/priv_storage.h
|
||||
+++ b/coregrind/m_debuginfo/priv_storage.h
|
||||
@@ -678,6 +678,13 @@ struct _DebugInfo {
|
||||
invalid and should not be consulted. */
|
||||
Bool have_dinfo; /* initially False */
|
||||
|
||||
+ /* If true then the reading of .debug_* section has been deferred
|
||||
+ until it this information is required (such as when printing
|
||||
+ a stacktrace). Additionally, if true then the reading of any
|
||||
+ separate debuginfo files associated with this object has also
|
||||
+ been deferred. */
|
||||
+ Bool deferred;
|
||||
+
|
||||
/* All the rest of the fields in this structure are filled in once
|
||||
we have committed to reading the symbols and debug info (that
|
||||
is, at the point where .have_dinfo is set to True). */
|
||||
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
|
||||
index ce7b7998d..f99d3dfd2 100644
|
||||
--- a/coregrind/m_debuginfo/readelf.c
|
||||
+++ b/coregrind/m_debuginfo/readelf.c
|
||||
@@ -1836,6 +1836,44 @@ static HChar* readlink_path (const HChar *path)
|
||||
return buf;
|
||||
}
|
||||
|
||||
+#define FINDX_MIMG(_sec_name, _sec_escn, _post_fx) \
|
||||
+ do { \
|
||||
+ ElfXX_Shdr a_shdr; \
|
||||
+ ML_(img_get)(&a_shdr, mimg, \
|
||||
+ INDEX_BIS(shdr_mioff, i, shdr_ment_szB), \
|
||||
+ sizeof(a_shdr)); \
|
||||
+ if (0 == ML_(img_strcmp_c)(mimg, shdr_strtab_mioff \
|
||||
+ + a_shdr.sh_name, _sec_name)) { \
|
||||
+ Bool nobits; \
|
||||
+ _sec_escn.img = mimg; \
|
||||
+ _sec_escn.ioff = (DiOffT)a_shdr.sh_offset; \
|
||||
+ _sec_escn.szB = a_shdr.sh_size; \
|
||||
+ if (!check_compression(&a_shdr, &_sec_escn)) { \
|
||||
+ ML_(symerr)(di, True, " Compression type is unsupported"); \
|
||||
+ goto out; \
|
||||
+ } \
|
||||
+ nobits = a_shdr.sh_type == SHT_NOBITS; \
|
||||
+ vg_assert(_sec_escn.img != NULL); \
|
||||
+ vg_assert(_sec_escn.ioff != DiOffT_INVALID); \
|
||||
+ TRACE_SYMTAB( "%-18s: ioff %llu .. %llu\n", \
|
||||
+ _sec_name, (ULong)a_shdr.sh_offset, \
|
||||
+ ((ULong)a_shdr.sh_offset) + a_shdr.sh_size - 1); \
|
||||
+ /* SHT_NOBITS sections have zero size in the file. */ \
|
||||
+ if (!nobits && \
|
||||
+ a_shdr.sh_offset + \
|
||||
+ a_shdr.sh_size > ML_(img_real_size)(mimg)) { \
|
||||
+ ML_(symerr)(di, True, \
|
||||
+ " section beyond image end?!"); \
|
||||
+ goto out; \
|
||||
+ } \
|
||||
+ _post_fx; \
|
||||
+ } \
|
||||
+ } while (0);
|
||||
+
|
||||
+/* Version with no post-effects */
|
||||
+#define FIND_MIMG(_sec_name, _sec_escn) \
|
||||
+ FINDX_MIMG(_sec_name, _sec_escn, /**/)
|
||||
+
|
||||
/* The central function for reading ELF debug info. For the
|
||||
object/exe specified by the DebugInfo, find ELF sections, then read
|
||||
the symbols, line number info, file name info, CFA (stack-unwind
|
||||
@@ -1843,7 +1881,7 @@ static HChar* readlink_path (const HChar *path)
|
||||
supplied DebugInfo.
|
||||
*/
|
||||
|
||||
-Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
+Bool ML_(read_elf_object) ( struct _DebugInfo* di )
|
||||
{
|
||||
/* This function is long and complex. That, and the presence of
|
||||
nested scopes, means it's not always easy to see which parts are
|
||||
@@ -1874,7 +1912,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
|
||||
|
||||
/* TOPLEVEL */
|
||||
- Bool res, ok;
|
||||
+ Bool ok;
|
||||
Word i, j;
|
||||
Bool dynbss_present = False;
|
||||
Bool sdynbss_present = False;
|
||||
@@ -1882,12 +1920,6 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
/* Image for the main ELF file we're working with. */
|
||||
DiImage* mimg = NULL;
|
||||
|
||||
- /* Ditto for any ELF debuginfo file that we might happen to load. */
|
||||
- DiImage* dimg = NULL;
|
||||
-
|
||||
- /* Ditto for alternate ELF debuginfo file that we might happen to load. */
|
||||
- DiImage* aimg = NULL;
|
||||
-
|
||||
/* ELF header offset for the main file. Should be zero since the
|
||||
ELF header is at start of file. */
|
||||
DiOffT ehdr_mioff = 0;
|
||||
@@ -1970,8 +2002,6 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
got, plt, and toc.
|
||||
---------------------------------------------------------- */
|
||||
|
||||
- res = False;
|
||||
-
|
||||
if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir))
|
||||
VG_(message)(Vg_DebugMsg, "Reading syms from %s\n",
|
||||
di->fsm.filename );
|
||||
@@ -2056,7 +2086,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
shdr_strtab_mioff
|
||||
= ehdr_mioff /* isn't this always zero? */ + a_shdr.sh_offset;
|
||||
|
||||
- if (!ML_(img_valid)(mimg, shdr_strtab_mioff,
|
||||
+ if (!ML_(img_valid)(mimg, shdr_strtab_mioff,
|
||||
1/*bogus, but we don't know the real size*/ )) {
|
||||
ML_(symerr)(di, True, "Invalid ELF Section Header String Table");
|
||||
goto out;
|
||||
@@ -2798,10 +2828,6 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
di->text_avma - di->text_bias,
|
||||
di->text_avma );
|
||||
|
||||
- TRACE_SYMTAB("\n");
|
||||
- TRACE_SYMTAB("------ Finding image addresses "
|
||||
- "for debug-info sections ------\n");
|
||||
-
|
||||
/* TOPLEVEL */
|
||||
/* Find interesting sections, read the symbol table(s), read any
|
||||
debug information. Each section is located either in the main,
|
||||
@@ -2821,27 +2847,6 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
# if defined(VGO_solaris)
|
||||
DiSlice ldynsym_escn = DiSlice_INVALID; // .SUNW_ldynsym
|
||||
# endif
|
||||
- DiSlice debuglink_escn = DiSlice_INVALID; // .gnu_debuglink
|
||||
- DiSlice debugaltlink_escn = DiSlice_INVALID; // .gnu_debugaltlink
|
||||
- DiSlice debug_line_escn = DiSlice_INVALID; // .debug_line (dwarf2)
|
||||
- DiSlice debug_info_escn = DiSlice_INVALID; // .debug_info (dwarf2)
|
||||
- DiSlice debug_types_escn = DiSlice_INVALID; // .debug_types (dwarf4)
|
||||
- DiSlice debug_abbv_escn = DiSlice_INVALID; // .debug_abbrev (dwarf2)
|
||||
- DiSlice debug_str_escn = DiSlice_INVALID; // .debug_str (dwarf2)
|
||||
- DiSlice debug_line_str_escn = DiSlice_INVALID; // .debug_line_str(dwarf5)
|
||||
- DiSlice debug_ranges_escn = DiSlice_INVALID; // .debug_ranges (dwarf2)
|
||||
- DiSlice debug_rnglists_escn = DiSlice_INVALID; // .debug_rnglists(dwarf5)
|
||||
- DiSlice debug_loclists_escn = DiSlice_INVALID; // .debug_loclists(dwarf5)
|
||||
- DiSlice debug_addr_escn = DiSlice_INVALID; // .debug_addr (dwarf5)
|
||||
- DiSlice debug_str_offsets_escn = DiSlice_INVALID; // .debug_str_offsets (dwarf5)
|
||||
- DiSlice debug_loc_escn = DiSlice_INVALID; // .debug_loc (dwarf2)
|
||||
- DiSlice debug_frame_escn = DiSlice_INVALID; // .debug_frame (dwarf2)
|
||||
- DiSlice debug_line_alt_escn = DiSlice_INVALID; // .debug_line (alt)
|
||||
- DiSlice debug_info_alt_escn = DiSlice_INVALID; // .debug_info (alt)
|
||||
- DiSlice debug_abbv_alt_escn = DiSlice_INVALID; // .debug_abbrev (alt)
|
||||
- DiSlice debug_str_alt_escn = DiSlice_INVALID; // .debug_str (alt)
|
||||
- DiSlice dwarf1d_escn = DiSlice_INVALID; // .debug (dwarf1)
|
||||
- DiSlice dwarf1l_escn = DiSlice_INVALID; // .line (dwarf1)
|
||||
DiSlice opd_escn = DiSlice_INVALID; // .opd (dwarf2,
|
||||
// ppc64be-linux)
|
||||
DiSlice ehframe_escn[N_EHFRAME_SECTS]; // .eh_frame (dwarf2)
|
||||
@@ -2868,118 +2873,282 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
/* TOPLEVEL */
|
||||
/* Iterate over section headers (again) */
|
||||
for (i = 0; i < ehdr_m.e_shnum; i++) {
|
||||
+ /* NAME ElfSec */
|
||||
+ FIND_MIMG( ".dynsym", dynsym_escn)
|
||||
+ FIND_MIMG( ".dynstr", dynstr_escn)
|
||||
+ FIND_MIMG( ".symtab", symtab_escn)
|
||||
+ FIND_MIMG( ".strtab", strtab_escn)
|
||||
+# if defined(VGO_solaris)
|
||||
+ FIND_MIMG( ".SUNW_ldynsym", ldynsym_escn)
|
||||
+# endif
|
||||
|
||||
-# define FINDX(_sec_name, _sec_escn, _post_fx) \
|
||||
- do { \
|
||||
- ElfXX_Shdr a_shdr; \
|
||||
- ML_(img_get)(&a_shdr, mimg, \
|
||||
- INDEX_BIS(shdr_mioff, i, shdr_ment_szB), \
|
||||
- sizeof(a_shdr)); \
|
||||
- if (0 == ML_(img_strcmp_c)(mimg, shdr_strtab_mioff \
|
||||
- + a_shdr.sh_name, _sec_name)) { \
|
||||
- Bool nobits; \
|
||||
- _sec_escn.img = mimg; \
|
||||
- _sec_escn.ioff = (DiOffT)a_shdr.sh_offset; \
|
||||
- _sec_escn.szB = a_shdr.sh_size; \
|
||||
- if (!check_compression(&a_shdr, &_sec_escn)) { \
|
||||
- ML_(symerr)(di, True, " Compression type is unsupported"); \
|
||||
- goto out; \
|
||||
- } \
|
||||
- nobits = a_shdr.sh_type == SHT_NOBITS; \
|
||||
- vg_assert(_sec_escn.img != NULL); \
|
||||
- vg_assert(_sec_escn.ioff != DiOffT_INVALID); \
|
||||
- TRACE_SYMTAB( "%-18s: ioff %llu .. %llu\n", \
|
||||
- _sec_name, (ULong)a_shdr.sh_offset, \
|
||||
- ((ULong)a_shdr.sh_offset) + a_shdr.sh_size - 1); \
|
||||
- /* SHT_NOBITS sections have zero size in the file. */ \
|
||||
- if (!nobits && \
|
||||
- a_shdr.sh_offset + \
|
||||
- a_shdr.sh_size > ML_(img_real_size)(mimg)) { \
|
||||
- ML_(symerr)(di, True, \
|
||||
- " section beyond image end?!"); \
|
||||
- goto out; \
|
||||
- } \
|
||||
- _post_fx; \
|
||||
- } \
|
||||
- } while (0);
|
||||
+ FINDX_MIMG( ".eh_frame", ehframe_escn[ehframe_mix],
|
||||
+ do { ehframe_mix++; vg_assert(ehframe_mix <= N_EHFRAME_SECTS);
|
||||
+ } while (0)
|
||||
+ )
|
||||
+ /* Comment_on_EH_FRAME_MULTIPLE_INSTANCES: w.r.t. .eh_frame
|
||||
+ multi-instance kludgery, how are we assured that the order
|
||||
+ in which we fill in ehframe_escn[] is consistent with the
|
||||
+ order in which we previously filled in di->ehframe_avma[]
|
||||
+ and di->ehframe_size[] ? By the fact that in both cases,
|
||||
+ these arrays were filled in by iterating over the section
|
||||
+ headers top-to-bottom. So both loops (this one and the
|
||||
+ previous one) encounter the .eh_frame entries in the same
|
||||
+ order and so fill in these arrays in a consistent order.
|
||||
+ */
|
||||
+ } /* Iterate over section headers (again) */
|
||||
|
||||
- /* Version with no post-effects */
|
||||
-# define FIND(_sec_name, _sec_escn) \
|
||||
- FINDX(_sec_name, _sec_escn, /**/)
|
||||
+ /* Check some sizes */
|
||||
+ vg_assert((dynsym_escn.szB % sizeof(ElfXX_Sym)) == 0);
|
||||
+ vg_assert((symtab_escn.szB % sizeof(ElfXX_Sym)) == 0);
|
||||
+# if defined(VGO_solaris)
|
||||
+ vg_assert((ldynsym_escn.szB % sizeof(ElfXX_Sym)) == 0);
|
||||
+# endif
|
||||
|
||||
- /* NAME ElfSec */
|
||||
- FIND( ".dynsym", dynsym_escn)
|
||||
- FIND( ".dynstr", dynstr_escn)
|
||||
- FIND( ".symtab", symtab_escn)
|
||||
- FIND( ".strtab", strtab_escn)
|
||||
+ /* Read symbols */
|
||||
+ {
|
||||
+ void (*read_elf_symtab)(struct _DebugInfo*, const HChar*,
|
||||
+ DiSlice*, DiSlice*, DiSlice*, Bool);
|
||||
+# if defined(VGP_ppc64be_linux)
|
||||
+ read_elf_symtab = read_elf_symtab__ppc64be_linux;
|
||||
+# else
|
||||
+ read_elf_symtab = read_elf_symtab__normal;
|
||||
+# endif
|
||||
+ if (symtab_escn.img != NULL)
|
||||
+ read_elf_symtab(di, "symbol table",
|
||||
+ &symtab_escn, &strtab_escn, &opd_escn,
|
||||
+ False);
|
||||
+ read_elf_symtab(di, "dynamic symbol table",
|
||||
+ &dynsym_escn, &dynstr_escn, &opd_escn,
|
||||
+ False);
|
||||
# if defined(VGO_solaris)
|
||||
- FIND( ".SUNW_ldynsym", ldynsym_escn)
|
||||
+ read_elf_symtab(di, "local dynamic symbol table",
|
||||
+ &ldynsym_escn, &dynstr_escn, &opd_escn,
|
||||
+ False);
|
||||
# endif
|
||||
+ }
|
||||
|
||||
- FIND( ".gnu_debuglink", debuglink_escn)
|
||||
- FIND( ".gnu_debugaltlink", debugaltlink_escn)
|
||||
+ /* TOPLEVEL */
|
||||
+ /* Read .eh_frame and .debug_frame (call-frame-info) if any. Do
|
||||
+ the .eh_frame section(s) first. */
|
||||
+ vg_assert(di->n_ehframe >= 0 && di->n_ehframe <= N_EHFRAME_SECTS);
|
||||
+ for (i = 0; i < di->n_ehframe; i++) {
|
||||
+ /* see Comment_on_EH_FRAME_MULTIPLE_INSTANCES above for why
|
||||
+ this next assertion should hold. */
|
||||
+ vg_assert(ML_(sli_is_valid)(ehframe_escn[i]));
|
||||
+ vg_assert(ehframe_escn[i].szB == di->ehframe_size[i]);
|
||||
+ ML_(read_callframe_info_dwarf3)( di,
|
||||
+ ehframe_escn[i],
|
||||
+ di->ehframe_avma[i],
|
||||
+ True/*is_ehframe*/ );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return True;
|
||||
+
|
||||
+ out:
|
||||
+ {
|
||||
+ /* Last, but not least, detach from the image. */
|
||||
+ if (mimg) ML_(img_done)(mimg);
|
||||
+
|
||||
+ if (svma_ranges) VG_(deleteXA)(svma_ranges);
|
||||
|
||||
- FIND( ".debug_line", debug_line_escn)
|
||||
+ return False;
|
||||
+ } /* out: */
|
||||
+
|
||||
+ /* NOTREACHED */
|
||||
+}
|
||||
+
|
||||
+Bool ML_(read_elf_debug) ( struct _DebugInfo* di )
|
||||
+{
|
||||
+ Word i, j;
|
||||
+ Bool res = True;
|
||||
+ Bool ok;
|
||||
+
|
||||
+ /* Image for the main ELF file we're working with. */
|
||||
+ DiImage* mimg = NULL;
|
||||
+
|
||||
+ /* Ditto for any ELF debuginfo file that we might happen to load. */
|
||||
+ DiImage* dimg = NULL;
|
||||
+
|
||||
+ /* Ditto for alternate ELF debuginfo file that we might happen to load. */
|
||||
+ DiImage* aimg = NULL;
|
||||
+
|
||||
+ /* Section header image addr, # entries, entry size. Also the
|
||||
+ associated string table. */
|
||||
+ DiOffT shdr_mioff = 0;
|
||||
+ UWord shdr_mnent = 0;
|
||||
+ UWord shdr_ment_szB = 0;
|
||||
+ DiOffT shdr_strtab_mioff = 0;
|
||||
+
|
||||
+ DiOffT ehdr_mioff = 0;
|
||||
+
|
||||
+ /* Connect to the primary object image, so that we can read symbols
|
||||
+ and line number info out of it. It will be disconnected
|
||||
+ immediately thereafter; it is only connected transiently. */
|
||||
+ mimg = ML_(img_from_local_file)(di->fsm.filename);
|
||||
+ if (mimg == NULL) {
|
||||
+ VG_(message)(Vg_UserMsg, "warning: connection to image %s failed\n",
|
||||
+ di->fsm.filename );
|
||||
+ VG_(message)(Vg_UserMsg, " no debug info loaded\n" );
|
||||
+ return False;
|
||||
+ }
|
||||
+
|
||||
+ /* Ok, the object image is available. Now verify that it is a
|
||||
+ valid ELF .so or executable image. */
|
||||
+ ok = is_elf_object_file_by_DiImage(mimg, False);
|
||||
+ if (!ok) {
|
||||
+ ML_(symerr)(di, True, "Invalid ELF Header");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ /* Find where the program and section header tables are, and give
|
||||
+ up if either is missing or outside the image (bogus). */
|
||||
+ ElfXX_Ehdr ehdr_m;
|
||||
+ vg_assert(ehdr_mioff == 0); // ensured by its initialisation
|
||||
+ ok = ML_(img_valid)(mimg, ehdr_mioff, sizeof(ehdr_m));
|
||||
+ vg_assert(ok); // ML_(is_elf_object_file) should ensure this
|
||||
+ ML_(img_get)(&ehdr_m, mimg, ehdr_mioff, sizeof(ehdr_m));
|
||||
+
|
||||
+ shdr_mioff = ehdr_mioff + ehdr_m.e_shoff;
|
||||
+ shdr_mnent = ehdr_m.e_shnum;
|
||||
+ shdr_ment_szB = ehdr_m.e_shentsize;
|
||||
+
|
||||
+ if (shdr_mnent == 0
|
||||
+ || !ML_(img_valid)(mimg, shdr_mioff, shdr_mnent * shdr_ment_szB)) {
|
||||
+ ML_(symerr)(di, True, "Missing or invalid ELF Section Header Table");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ /* Also find the section header's string table, and validate. */
|
||||
+ /* checked previously by is_elf_object_file: */
|
||||
+ vg_assert(ehdr_m.e_shstrndx != SHN_UNDEF);
|
||||
+
|
||||
+ // shdr_mioff is the offset of the section header table
|
||||
+ // and we need the ehdr_m.e_shstrndx'th entry
|
||||
+ { ElfXX_Shdr a_shdr;
|
||||
+ ML_(img_get)(&a_shdr, mimg,
|
||||
+ INDEX_BIS(shdr_mioff, ehdr_m.e_shstrndx, shdr_ment_szB),
|
||||
+ sizeof(a_shdr));
|
||||
+ shdr_strtab_mioff
|
||||
+ = ehdr_mioff /* isn't this always zero? */ + a_shdr.sh_offset;
|
||||
+
|
||||
+ if (!ML_(img_valid)(mimg, shdr_strtab_mioff,
|
||||
+ 1/*bogus, but we don't know the real size*/ )) {
|
||||
+ ML_(symerr)(di, True, "Invalid ELF Section Header String Table");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ TRACE_SYMTAB("\n");
|
||||
+ TRACE_SYMTAB("------ Finding image addresses "
|
||||
+ "for debug-info sections ------\n");
|
||||
+ /* TOPLEVEL */
|
||||
+ /* Find interesting sections, read the symbol table(s), read any
|
||||
+ debug information. Each section is located either in the main,
|
||||
+ debug or alt-debug files, but only in one. For each section,
|
||||
+ |section_escn| records which of |mimg|, |dimg| or |aimg| we
|
||||
+ found it in, along with the section's image offset and its size.
|
||||
+ The triples (section_img, section_ioff, section_szB) are
|
||||
+ consistent, in that they are always either (NULL,
|
||||
+ DiOffT_INVALID, 0), or refer to the same image, and are all
|
||||
+ assigned together. */
|
||||
+
|
||||
+ {
|
||||
+ /* TOPLEVEL */
|
||||
+ DiSlice strtab_escn = DiSlice_INVALID; // .strtab
|
||||
+ DiSlice symtab_escn = DiSlice_INVALID; // .symtab
|
||||
+ DiSlice debuglink_escn = DiSlice_INVALID; // .gnu_debuglink
|
||||
+ DiSlice debugaltlink_escn = DiSlice_INVALID; // .gnu_debugaltlink
|
||||
+ DiSlice debug_line_escn = DiSlice_INVALID; // .debug_line (dwarf2)
|
||||
+ DiSlice debug_info_escn = DiSlice_INVALID; // .debug_info (dwarf2)
|
||||
+ DiSlice debug_types_escn = DiSlice_INVALID; // .debug_types (dwarf4)
|
||||
+ DiSlice debug_abbv_escn = DiSlice_INVALID; // .debug_abbrev (dwarf2)
|
||||
+ DiSlice debug_str_escn = DiSlice_INVALID; // .debug_str (dwarf2)
|
||||
+ DiSlice debug_line_str_escn = DiSlice_INVALID; // .debug_line_str(dwarf5)
|
||||
+ DiSlice debug_ranges_escn = DiSlice_INVALID; // .debug_ranges (dwarf2)
|
||||
+ DiSlice debug_rnglists_escn = DiSlice_INVALID; // .debug_rnglists(dwarf5)
|
||||
+ DiSlice debug_loclists_escn = DiSlice_INVALID; // .debug_loclists(dwarf5)
|
||||
+ DiSlice debug_addr_escn = DiSlice_INVALID; // .debug_addr (dwarf5)
|
||||
+ DiSlice debug_str_offsets_escn = DiSlice_INVALID; // .debug_str_offsets (dwarf5)
|
||||
+ DiSlice debug_loc_escn = DiSlice_INVALID; // .debug_loc (dwarf2)
|
||||
+ DiSlice debug_frame_escn = DiSlice_INVALID; // .debug_frame (dwarf2)
|
||||
+ DiSlice debug_line_alt_escn = DiSlice_INVALID; // .debug_line (alt)
|
||||
+ DiSlice debug_info_alt_escn = DiSlice_INVALID; // .debug_info (alt)
|
||||
+ DiSlice debug_abbv_alt_escn = DiSlice_INVALID; // .debug_abbrev (alt)
|
||||
+ DiSlice debug_str_alt_escn = DiSlice_INVALID; // .debug_str (alt)
|
||||
+ DiSlice dwarf1d_escn = DiSlice_INVALID; // .debug (dwarf1)
|
||||
+ DiSlice dwarf1l_escn = DiSlice_INVALID; // .line (dwarf1)
|
||||
+ DiSlice opd_escn = DiSlice_INVALID; // .opd (dwarf2,
|
||||
+ // ppc64be-linux)
|
||||
+
|
||||
+ /* TOPLEVEL */
|
||||
+ /* Iterate over section headers (again) */
|
||||
+ for (i = 0; i < ehdr_m.e_shnum; i++) {
|
||||
+
|
||||
+ /* NAME ElfSec */
|
||||
+ FIND_MIMG( ".symtab", symtab_escn)
|
||||
+ FIND_MIMG( ".strtab", strtab_escn)
|
||||
+ FIND_MIMG( ".gnu_debuglink", debuglink_escn)
|
||||
+ FIND_MIMG( ".gnu_debugaltlink", debugaltlink_escn)
|
||||
+
|
||||
+ FIND_MIMG( ".debug_line", debug_line_escn)
|
||||
if (!ML_(sli_is_valid)(debug_line_escn))
|
||||
- FIND(".zdebug_line", debug_line_escn)
|
||||
+ FIND_MIMG(".zdebug_line", debug_line_escn)
|
||||
|
||||
- FIND( ".debug_info", debug_info_escn)
|
||||
+ FIND_MIMG( ".debug_info", debug_info_escn)
|
||||
if (!ML_(sli_is_valid)(debug_info_escn))
|
||||
- FIND(".zdebug_info", debug_info_escn)
|
||||
+ FIND_MIMG(".zdebug_info", debug_info_escn)
|
||||
|
||||
- FIND( ".debug_types", debug_types_escn)
|
||||
+ FIND_MIMG( ".debug_types", debug_types_escn)
|
||||
if (!ML_(sli_is_valid)(debug_types_escn))
|
||||
- FIND(".zdebug_types", debug_types_escn)
|
||||
+ FIND_MIMG(".zdebug_types", debug_types_escn)
|
||||
|
||||
- FIND( ".debug_abbrev", debug_abbv_escn)
|
||||
+ FIND_MIMG( ".debug_abbrev", debug_abbv_escn)
|
||||
if (!ML_(sli_is_valid)(debug_abbv_escn))
|
||||
- FIND(".zdebug_abbrev", debug_abbv_escn)
|
||||
+ FIND_MIMG(".zdebug_abbrev", debug_abbv_escn)
|
||||
|
||||
- FIND( ".debug_str", debug_str_escn)
|
||||
+ FIND_MIMG( ".debug_str", debug_str_escn)
|
||||
if (!ML_(sli_is_valid)(debug_str_escn))
|
||||
- FIND(".zdebug_str", debug_str_escn)
|
||||
+ FIND_MIMG(".zdebug_str", debug_str_escn)
|
||||
|
||||
- FIND( ".debug_line_str", debug_line_str_escn)
|
||||
+ FIND_MIMG( ".debug_line_str", debug_line_str_escn)
|
||||
if (!ML_(sli_is_valid)(debug_line_str_escn))
|
||||
- FIND(".zdebug_str", debug_line_str_escn)
|
||||
+ FIND_MIMG(".zdebug_str", debug_line_str_escn)
|
||||
|
||||
- FIND( ".debug_ranges", debug_ranges_escn)
|
||||
+ FIND_MIMG( ".debug_ranges", debug_ranges_escn)
|
||||
if (!ML_(sli_is_valid)(debug_ranges_escn))
|
||||
- FIND(".zdebug_ranges", debug_ranges_escn)
|
||||
+ FIND_MIMG(".zdebug_ranges", debug_ranges_escn)
|
||||
|
||||
- FIND( ".debug_rnglists", debug_rnglists_escn)
|
||||
+ FIND_MIMG( ".debug_rnglists", debug_rnglists_escn)
|
||||
if (!ML_(sli_is_valid)(debug_rnglists_escn))
|
||||
- FIND(".zdebug_rnglists", debug_rnglists_escn)
|
||||
+ FIND_MIMG(".zdebug_rnglists", debug_rnglists_escn)
|
||||
|
||||
- FIND( ".debug_loclists", debug_loclists_escn)
|
||||
+ FIND_MIMG( ".debug_loclists", debug_loclists_escn)
|
||||
if (!ML_(sli_is_valid)(debug_loclists_escn))
|
||||
- FIND(".zdebug_loclists", debug_loclists_escn)
|
||||
+ FIND_MIMG(".zdebug_loclists", debug_loclists_escn)
|
||||
|
||||
- FIND( ".debug_loc", debug_loc_escn)
|
||||
+ FIND_MIMG( ".debug_loc", debug_loc_escn)
|
||||
if (!ML_(sli_is_valid)(debug_loc_escn))
|
||||
- FIND(".zdebug_loc", debug_loc_escn)
|
||||
+ FIND_MIMG(".zdebug_loc", debug_loc_escn)
|
||||
|
||||
- FIND( ".debug_frame", debug_frame_escn)
|
||||
+ FIND_MIMG( ".debug_frame", debug_frame_escn)
|
||||
if (!ML_(sli_is_valid)(debug_frame_escn))
|
||||
- FIND(".zdebug_frame", debug_frame_escn)
|
||||
+ FIND_MIMG(".zdebug_frame", debug_frame_escn)
|
||||
|
||||
- FIND( ".debug_addr", debug_addr_escn)
|
||||
+ FIND_MIMG( ".debug_addr", debug_addr_escn)
|
||||
if (!ML_(sli_is_valid)(debug_addr_escn))
|
||||
- FIND(".zdebug_addr", debug_addr_escn)
|
||||
+ FIND_MIMG(".zdebug_addr", debug_addr_escn)
|
||||
|
||||
- FIND( ".debug_str_offsets", debug_str_offsets_escn)
|
||||
+ FIND_MIMG( ".debug_str_offsets", debug_str_offsets_escn)
|
||||
if (!ML_(sli_is_valid)(debug_str_offsets_escn))
|
||||
- FIND(".zdebug_str_offsets", debug_str_offsets_escn)
|
||||
+ FIND_MIMG(".zdebug_str_offsets", debug_str_offsets_escn)
|
||||
|
||||
- FIND( ".debug", dwarf1d_escn)
|
||||
- FIND( ".line", dwarf1l_escn)
|
||||
+ FIND_MIMG( ".debug", dwarf1d_escn)
|
||||
+ FIND_MIMG( ".line", dwarf1l_escn)
|
||||
|
||||
- FIND( ".opd", opd_escn)
|
||||
+ FIND_MIMG( ".opd", opd_escn)
|
||||
|
||||
- FINDX( ".eh_frame", ehframe_escn[ehframe_mix],
|
||||
- do { ehframe_mix++; vg_assert(ehframe_mix <= N_EHFRAME_SECTS);
|
||||
- } while (0)
|
||||
- )
|
||||
/* Comment_on_EH_FRAME_MULTIPLE_INSTANCES: w.r.t. .eh_frame
|
||||
multi-instance kludgery, how are we assured that the order
|
||||
in which we fill in ehframe_escn[] is consistent with the
|
||||
@@ -2991,8 +3160,6 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
order and so fill in these arrays in a consistent order.
|
||||
*/
|
||||
|
||||
-# undef FINDX
|
||||
-# undef FIND
|
||||
} /* Iterate over section headers (again) */
|
||||
|
||||
/* TOPLEVEL */
|
||||
@@ -3465,53 +3632,23 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
} /* Find all interesting sections */
|
||||
} /* do we have a debug image? */
|
||||
|
||||
-
|
||||
/* TOPLEVEL */
|
||||
- /* Check some sizes */
|
||||
- vg_assert((dynsym_escn.szB % sizeof(ElfXX_Sym)) == 0);
|
||||
vg_assert((symtab_escn.szB % sizeof(ElfXX_Sym)) == 0);
|
||||
-# if defined(VGO_solaris)
|
||||
- vg_assert((ldynsym_escn.szB % sizeof(ElfXX_Sym)) == 0);
|
||||
-# endif
|
||||
|
||||
/* TOPLEVEL */
|
||||
/* Read symbols */
|
||||
{
|
||||
void (*read_elf_symtab)(struct _DebugInfo*, const HChar*,
|
||||
DiSlice*, DiSlice*, DiSlice*, Bool);
|
||||
- Bool symtab_in_debug;
|
||||
# if defined(VGP_ppc64be_linux)
|
||||
read_elf_symtab = read_elf_symtab__ppc64be_linux;
|
||||
# else
|
||||
read_elf_symtab = read_elf_symtab__normal;
|
||||
# endif
|
||||
- symtab_in_debug = symtab_escn.img == dimg;
|
||||
- read_elf_symtab(di, "symbol table",
|
||||
- &symtab_escn, &strtab_escn, &opd_escn,
|
||||
- symtab_in_debug);
|
||||
- read_elf_symtab(di, "dynamic symbol table",
|
||||
- &dynsym_escn, &dynstr_escn, &opd_escn,
|
||||
- False);
|
||||
-# if defined(VGO_solaris)
|
||||
- read_elf_symtab(di, "local dynamic symbol table",
|
||||
- &ldynsym_escn, &dynstr_escn, &opd_escn,
|
||||
- False);
|
||||
-# endif
|
||||
- }
|
||||
-
|
||||
- /* TOPLEVEL */
|
||||
- /* Read .eh_frame and .debug_frame (call-frame-info) if any. Do
|
||||
- the .eh_frame section(s) first. */
|
||||
- vg_assert(di->n_ehframe >= 0 && di->n_ehframe <= N_EHFRAME_SECTS);
|
||||
- for (i = 0; i < di->n_ehframe; i++) {
|
||||
- /* see Comment_on_EH_FRAME_MULTIPLE_INSTANCES above for why
|
||||
- this next assertion should hold. */
|
||||
- vg_assert(ML_(sli_is_valid)(ehframe_escn[i]));
|
||||
- vg_assert(ehframe_escn[i].szB == di->ehframe_size[i]);
|
||||
- ML_(read_callframe_info_dwarf3)( di,
|
||||
- ehframe_escn[i],
|
||||
- di->ehframe_avma[i],
|
||||
- True/*is_ehframe*/ );
|
||||
+ if (symtab_escn.img != NULL)
|
||||
+ read_elf_symtab(di, "symbol table",
|
||||
+ &symtab_escn, &strtab_escn, &opd_escn,
|
||||
+ True);
|
||||
}
|
||||
if (ML_(sli_is_valid)(debug_frame_escn)) {
|
||||
ML_(read_callframe_info_dwarf3)( di,
|
||||
@@ -3643,8 +3780,6 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
|
||||
if (dimg) ML_(img_done)(dimg);
|
||||
if (aimg) ML_(img_done)(aimg);
|
||||
|
||||
- if (svma_ranges) VG_(deleteXA)(svma_ranges);
|
||||
-
|
||||
return res;
|
||||
} /* out: */
|
||||
|
||||
diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c
|
||||
index c3fa62e96..3ad114607 100644
|
||||
--- a/coregrind/m_debuginfo/storage.c
|
||||
+++ b/coregrind/m_debuginfo/storage.c
|
||||
@@ -1297,8 +1297,7 @@ void ML_(addVar)( struct _DebugInfo* di,
|
||||
that those extra sections have the same bias as .text, but that
|
||||
seems a reasonable assumption to me. */
|
||||
/* This is assured us by top level steering logic in debuginfo.c,
|
||||
- and it is re-checked at the start of
|
||||
- ML_(read_elf_debug_info). */
|
||||
+ and it is re-checked at the start of ML_(read_elf_object). */
|
||||
vg_assert(di->fsm.have_rx_map && di->fsm.rw_map_count);
|
||||
if (level > 0 && ML_(find_rx_mapping)(di, aMin, aMax) == NULL) {
|
||||
if (VG_(clo_verbosity) > 1) {
|
||||
@@ -1725,7 +1724,6 @@ static void canonicaliseSymtab ( struct _DebugInfo* di )
|
||||
for (i = 0; i < di->symtab_used; i++) {
|
||||
DiSym* sym = &di->symtab[i];
|
||||
vg_assert(sym->pri_name);
|
||||
- vg_assert(!sym->sec_names);
|
||||
}
|
||||
|
||||
/* Sort by address. */
|
||||
@@ -2383,6 +2381,9 @@ void ML_(finish_CFSI_arrays) ( struct _DebugInfo* di )
|
||||
vg_assert (f_holes == n_holes);
|
||||
vg_assert (pos == new_used);
|
||||
|
||||
+ if (di->deferred)
|
||||
+ return;
|
||||
+
|
||||
di->cfsi_used = new_used;
|
||||
di->cfsi_size = new_used;
|
||||
ML_(dinfo_free) (di->cfsi_rd);
|
||||
@@ -2398,9 +2399,13 @@ void ML_(canonicaliseTables) ( struct _DebugInfo* di )
|
||||
canonicaliseLoctab ( di );
|
||||
canonicaliseInltab ( di );
|
||||
ML_(canonicaliseCFI) ( di );
|
||||
+ canonicaliseVarInfo ( di );
|
||||
+
|
||||
+ if (di->deferred)
|
||||
+ return;
|
||||
+
|
||||
if (di->cfsi_m_pool)
|
||||
VG_(freezeDedupPA) (di->cfsi_m_pool, ML_(dinfo_shrink_block));
|
||||
- canonicaliseVarInfo ( di );
|
||||
if (di->strpool)
|
||||
VG_(freezeDedupPA) (di->strpool, ML_(dinfo_shrink_block));
|
||||
if (di->fndnpool)
|
||||
diff --git a/coregrind/pub_core_debuginfo.h b/coregrind/pub_core_debuginfo.h
|
||||
index 938ed00cc..ce7246217 100644
|
||||
--- a/coregrind/pub_core_debuginfo.h
|
||||
+++ b/coregrind/pub_core_debuginfo.h
|
||||
@@ -76,6 +76,10 @@ extern void VG_(di_notify_pdb_debuginfo)( Int fd, Addr avma,
|
||||
extern void VG_(di_notify_vm_protect)( Addr a, SizeT len, UInt prot );
|
||||
#endif
|
||||
|
||||
+extern void VG_(addr_load_di)( Addr a );
|
||||
+
|
||||
+extern void VG_(load_di)( DebugInfo *di, Addr a );
|
||||
+
|
||||
extern void VG_(di_discard_ALL_debuginfo)( void );
|
||||
|
||||
/* Like VG_(get_fnname), but it does not do C++ demangling nor Z-demangling
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,73 +0,0 @@
|
||||
From 56f1bd12c92806fd18337ba4cd3c0a8d714d0e94 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Arnez <arnez@linux.ibm.com>
|
||||
Date: Thu, 15 Jun 2023 17:24:53 +0200
|
||||
Subject: [PATCH] Bug 470978 - s390x: Link the tools with -Wl,--s390-pgste
|
||||
|
||||
Programs that require the PGSTE mode to be enabled may currently fail
|
||||
under Valgrind. In particular this affects qemu-kvm.
|
||||
|
||||
While it is also possible to enable the PGSTE mode globally with
|
||||
|
||||
sysctl vm.allocate_psgte=1
|
||||
|
||||
the problem can more easily be prevented by linking the Valgrind tools
|
||||
with -Wl,--s390-pgste. Add a configure check if the linker supports this,
|
||||
and activate the flag if it does.
|
||||
|
||||
To verify the intended result, the following shell command can be used to
|
||||
list the executables having this flag set:
|
||||
|
||||
find . -type f -perm -u+x -execdir \
|
||||
/bin/sh -c 'readelf -lW $0 2>/dev/null | grep PGSTE' {} \; -print
|
||||
---
|
||||
Makefile.tool.am | 2 +-
|
||||
configure.ac | 20 ++++++++++++++++++++
|
||||
2 files changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.tool.am b/Makefile.tool.am
|
||||
index df9502913..4ce6d5ab0 100644
|
||||
--- a/Makefile.tool.am
|
||||
+++ b/Makefile.tool.am
|
||||
@@ -78,7 +78,7 @@ TOOL_LDFLAGS_ARM64_LINUX = \
|
||||
$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
|
||||
|
||||
TOOL_LDFLAGS_S390X_LINUX = \
|
||||
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
|
||||
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ @FLAG_S390_PGSTE@
|
||||
|
||||
TOOL_LDFLAGS_X86_DARWIN = \
|
||||
$(TOOL_LDFLAGS_COMMON_DARWIN) -arch i386
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 0cf84a1c0..1d4164a7d 100755
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -3096,6 +3096,26 @@ AC_SUBST([FLAG_NO_BUILD_ID], [""])
|
||||
fi
|
||||
CFLAGS=$safe_CFLAGS
|
||||
|
||||
+# On s390x, if the linker supports -Wl,--s390-pgste, then we build the
|
||||
+# tools with that flag. This enables running programs that need it, such
|
||||
+# as qemu-kvm.
|
||||
+if test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX; then
|
||||
+AC_MSG_CHECKING([if the linker accepts -Wl,--s390-pgste])
|
||||
+safe_CFLAGS=$CFLAGS
|
||||
+CFLAGS="-Wl,--s390-pgste"
|
||||
+
|
||||
+AC_LINK_IFELSE(
|
||||
+[AC_LANG_PROGRAM([ ], [return 0;])],
|
||||
+[
|
||||
+ AC_SUBST([FLAG_S390_PGSTE], ["-Wl,--s390-pgste"])
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+], [
|
||||
+ AC_SUBST([FLAG_S390_PGSTE], [""])
|
||||
+ AC_MSG_RESULT([no])
|
||||
+])
|
||||
+CFLAGS=$safe_CFLAGS
|
||||
+fi
|
||||
+
|
||||
# does the ppc assembler support "mtocrf" et al?
|
||||
AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
|
||||
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,167 +0,0 @@
|
||||
From b904112d7084227f8d6fab322bc360a8a6240a51 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
Date: Thu, 1 Jun 2023 16:10:56 +0200
|
||||
Subject: [PATCH] memcheck: Handle Err_ReallocSizeZero in MC_(eq_Error)
|
||||
|
||||
When an realloc size zero error is emitted MC_(eq_Error) is called to
|
||||
see if the errors can be deduplicated. This crashed since
|
||||
Err_ReallocSizeZero wasn't handled. Handle it like Err_Free.
|
||||
|
||||
Also add a testcase for this case and test with both
|
||||
--realloc-zero-bytes-frees=yes and
|
||||
--realloc-zero-bytes-frees=no.
|
||||
Which will report a different number of errors.
|
||||
|
||||
https://bugs.kde.org/show_bug.cgi?id=470520
|
||||
---
|
||||
memcheck/mc_errors.c | 1 +
|
||||
memcheck/tests/Makefile.am | 7 +++++++
|
||||
memcheck/tests/realloc_size_zero_again.c | 15 +++++++++++++++
|
||||
.../realloc_size_zero_again_no.stderr.exp | 18 ++++++++++++++++++
|
||||
.../realloc_size_zero_again_no.stdout.exp | 0
|
||||
.../tests/realloc_size_zero_again_no.vgtest | 2 ++
|
||||
.../realloc_size_zero_again_yes.stderr.exp | 18 ++++++++++++++++++
|
||||
.../realloc_size_zero_again_yes.stdout.exp | 0
|
||||
.../tests/realloc_size_zero_again_yes.vgtest | 2 ++
|
||||
9 files changed, 63 insertions(+)
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again.c
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_no.stderr.exp
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_no.stdout.exp
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_no.vgtest
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_yes.stderr.exp
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_yes.stdout.exp
|
||||
create mode 100644 memcheck/tests/realloc_size_zero_again_yes.vgtest
|
||||
|
||||
diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c
|
||||
index 00d6ec301..65210a220 100644
|
||||
--- a/memcheck/mc_errors.c
|
||||
+++ b/memcheck/mc_errors.c
|
||||
@@ -1041,6 +1041,7 @@ Bool MC_(eq_Error) ( VgRes res, const Error* e1, const Error* e2 )
|
||||
case Err_IllegalMempool:
|
||||
case Err_Overlap:
|
||||
case Err_Cond:
|
||||
+ case Err_ReallocSizeZero:
|
||||
return True;
|
||||
|
||||
case Err_FishyValue:
|
||||
diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am
|
||||
index 71c38acba..5a17fd35d 100644
|
||||
--- a/memcheck/tests/Makefile.am
|
||||
+++ b/memcheck/tests/Makefile.am
|
||||
@@ -291,8 +291,14 @@ EXTRA_DIST = \
|
||||
realloc_size_zero.vgtest \
|
||||
realloc_size_zero_yes.stderr.exp realloc_size_zero_yes.stdout.exp \
|
||||
realloc_size_zero_yes.vgtest \
|
||||
+ realloc_size_zero_again_yes.stderr.exp \
|
||||
+ realloc_size_zero_again_yes.stdout.exp \
|
||||
+ realloc_size_zero_again_yes.vgtest \
|
||||
realloc_size_zero_no.stderr.exp realloc_size_zero_no.stdout.exp \
|
||||
realloc_size_zero_no.vgtest \
|
||||
+ realloc_size_zero_again_no.stderr.exp \
|
||||
+ realloc_size_zero_again_no.stdout.exp \
|
||||
+ realloc_size_zero_again_no.vgtest \
|
||||
realloc_size_zero_off.stderr.exp realloc_size_zero_off.stdout.exp \
|
||||
realloc_size_zero_off.vgtest \
|
||||
realloc_size_zero_mismatch.stderr.exp \
|
||||
@@ -459,6 +465,7 @@ check_PROGRAMS = \
|
||||
posix_memalign \
|
||||
post-syscall \
|
||||
realloc_size_zero realloc_size_zero_mismatch \
|
||||
+ realloc_size_zero_again \
|
||||
realloc1 realloc2 realloc3 \
|
||||
recursive-merge \
|
||||
resvn_stack \
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again.c b/memcheck/tests/realloc_size_zero_again.c
|
||||
new file mode 100644
|
||||
index 000000000..782d4bde5
|
||||
--- /dev/null
|
||||
+++ b/memcheck/tests/realloc_size_zero_again.c
|
||||
@@ -0,0 +1,15 @@
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ char *p = malloc (1024);
|
||||
+ for (int i = 3; i >= 0; i--)
|
||||
+ for (int j = 0; j <= 3; j++)
|
||||
+ {
|
||||
+ char *q = realloc (p, i * j * 512);
|
||||
+ p = q;
|
||||
+ }
|
||||
+
|
||||
+ free (p);
|
||||
+}
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_no.stderr.exp b/memcheck/tests/realloc_size_zero_again_no.stderr.exp
|
||||
new file mode 100644
|
||||
index 000000000..b9c061d1a
|
||||
--- /dev/null
|
||||
+++ b/memcheck/tests/realloc_size_zero_again_no.stderr.exp
|
||||
@@ -0,0 +1,18 @@
|
||||
+realloc() with size 0
|
||||
+ at 0x........: realloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd
|
||||
+ at 0x........: malloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+
|
||||
+ERROR SUMMARY: 7 errors from 1 contexts (suppressed: 0 from 0)
|
||||
+
|
||||
+7 errors in context 1 of 1:
|
||||
+realloc() with size 0
|
||||
+ at 0x........: realloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd
|
||||
+ at 0x........: malloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+
|
||||
+ERROR SUMMARY: 7 errors from 1 contexts (suppressed: 0 from 0)
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_no.stdout.exp b/memcheck/tests/realloc_size_zero_again_no.stdout.exp
|
||||
new file mode 100644
|
||||
index 000000000..e69de29bb
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_no.vgtest b/memcheck/tests/realloc_size_zero_again_no.vgtest
|
||||
new file mode 100644
|
||||
index 000000000..f1757b6c1
|
||||
--- /dev/null
|
||||
+++ b/memcheck/tests/realloc_size_zero_again_no.vgtest
|
||||
@@ -0,0 +1,2 @@
|
||||
+prog: realloc_size_zero_again
|
||||
+vgopts: -q -s --realloc-zero-bytes-frees=no
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_yes.stderr.exp b/memcheck/tests/realloc_size_zero_again_yes.stderr.exp
|
||||
new file mode 100644
|
||||
index 000000000..d40aa2455
|
||||
--- /dev/null
|
||||
+++ b/memcheck/tests/realloc_size_zero_again_yes.stderr.exp
|
||||
@@ -0,0 +1,18 @@
|
||||
+realloc() with size 0
|
||||
+ at 0x........: realloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd
|
||||
+ at 0x........: malloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+
|
||||
+ERROR SUMMARY: 5 errors from 1 contexts (suppressed: 0 from 0)
|
||||
+
|
||||
+5 errors in context 1 of 1:
|
||||
+realloc() with size 0
|
||||
+ at 0x........: realloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+ Address 0x........ is 0 bytes inside a block of size 1,024 alloc'd
|
||||
+ at 0x........: malloc (vg_replace_malloc.c:...)
|
||||
+ ...
|
||||
+
|
||||
+ERROR SUMMARY: 5 errors from 1 contexts (suppressed: 0 from 0)
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_yes.stdout.exp b/memcheck/tests/realloc_size_zero_again_yes.stdout.exp
|
||||
new file mode 100644
|
||||
index 000000000..e69de29bb
|
||||
diff --git a/memcheck/tests/realloc_size_zero_again_yes.vgtest b/memcheck/tests/realloc_size_zero_again_yes.vgtest
|
||||
new file mode 100644
|
||||
index 000000000..215392ed6
|
||||
--- /dev/null
|
||||
+++ b/memcheck/tests/realloc_size_zero_again_yes.vgtest
|
||||
@@ -0,0 +1,2 @@
|
||||
+prog: realloc_size_zero_again
|
||||
+vgopts: -q -s --realloc-zero-bytes-frees=yes
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,105 +0,0 @@
|
||||
From 21f7a2af2805a02a144c81f12895c134f4a171a3 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Arnez <arnez@linux.ibm.com>
|
||||
Date: Mon, 22 May 2023 19:49:08 +0200
|
||||
Subject: [PATCH 2/2] Bug 470132 - s390x: Increase test coverage for VGM
|
||||
|
||||
Add more tests for the VGM instruction, to verify the fix for the VGM
|
||||
wrap-around case. Also test setting unused bits in the I2 and I3 fields,
|
||||
to check that Valgrind ignores them as it should.
|
||||
---
|
||||
none/tests/s390x/vec2.c | 44 ++++++++++++++++++++++++++++++++
|
||||
none/tests/s390x/vec2.stdout.exp | 20 +++++++++++++++
|
||||
2 files changed, 64 insertions(+)
|
||||
|
||||
diff --git a/none/tests/s390x/vec2.c b/none/tests/s390x/vec2.c
|
||||
index 73b04dee4..c473a2a9a 100644
|
||||
--- a/none/tests/s390x/vec2.c
|
||||
+++ b/none/tests/s390x/vec2.c
|
||||
@@ -301,6 +301,49 @@ static void test_all_fp_int_conversions()
|
||||
#undef TEST_EXEC
|
||||
#undef TEST_GENERATE
|
||||
|
||||
+/* -- Vector generate mask -- */
|
||||
+
|
||||
+#define TEST_GENERATE(insn, i2, i3, m4) \
|
||||
+ static void test_vgm_##i2##_##i3##_##m4(void) \
|
||||
+ { \
|
||||
+ ulong_v out = vec_ini; \
|
||||
+ __asm__("vgm %[out]," #i2 "," #i3 "," #m4 : [out] "+v"(out) : :); \
|
||||
+ printf("\t%016lx %016lx\n", out[0], out[1]); \
|
||||
+ }
|
||||
+
|
||||
+#define TEST_EXEC(insn, i2, i3, m4) \
|
||||
+ do { \
|
||||
+ puts(#insn " " #i2 "," #i3 "," #m4); \
|
||||
+ test_vgm_##i2##_##i3##_##m4(); \
|
||||
+ } while (0)
|
||||
+
|
||||
+#define INSNS \
|
||||
+ XTEST(vgmb, 2, 1, 0); \
|
||||
+ XTEST(vgmb, 0xf7, 0x30, 0); \
|
||||
+ XTEST(vgmb, 0, 0, 0); \
|
||||
+ XTEST(vgmh, 3, 2, 1); \
|
||||
+ XTEST(vgmh, 15, 15, 1); \
|
||||
+ XTEST(vgmf, 4, 3, 2); \
|
||||
+ XTEST(vgmf, 16, 17, 2); \
|
||||
+ XTEST(vgmg, 55, 63, 3); \
|
||||
+ XTEST(vgmg, 43, 55, 3); \
|
||||
+ XTEST(vgmg, 63, 2, 3);
|
||||
+
|
||||
+#define XTEST TEST_GENERATE
|
||||
+INSNS
|
||||
+#undef XTEST
|
||||
+
|
||||
+static void test_all_generate_mask()
|
||||
+{
|
||||
+#define XTEST TEST_EXEC
|
||||
+ INSNS
|
||||
+#undef XTEST
|
||||
+}
|
||||
+
|
||||
+#undef INSNS
|
||||
+#undef TEST_EXEC
|
||||
+#undef TEST_GENERATE
|
||||
+
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -310,5 +353,6 @@ int main()
|
||||
test_all_double_bitshifts();
|
||||
test_all_int_fp_conversions();
|
||||
test_all_fp_int_conversions();
|
||||
+ test_all_generate_mask();
|
||||
return 0;
|
||||
}
|
||||
diff --git a/none/tests/s390x/vec2.stdout.exp b/none/tests/s390x/vec2.stdout.exp
|
||||
index b32cbe1bc..2c9ac21c1 100644
|
||||
--- a/none/tests/s390x/vec2.stdout.exp
|
||||
+++ b/none/tests/s390x/vec2.stdout.exp
|
||||
@@ -166,3 +166,23 @@ vcsfp 0
|
||||
vcsfp 8
|
||||
00ffffff - - -
|
||||
00000004 - - -
|
||||
+vgmb 2,1,0
|
||||
+ ffffffffffffffff ffffffffffffffff
|
||||
+vgmb 0xf7,0x30,0
|
||||
+ 8181818181818181 8181818181818181
|
||||
+vgmb 0,0,0
|
||||
+ 8080808080808080 8080808080808080
|
||||
+vgmh 3,2,1
|
||||
+ ffffffffffffffff ffffffffffffffff
|
||||
+vgmh 15,15,1
|
||||
+ 0001000100010001 0001000100010001
|
||||
+vgmf 4,3,2
|
||||
+ ffffffffffffffff ffffffffffffffff
|
||||
+vgmf 16,17,2
|
||||
+ 0000c0000000c000 0000c0000000c000
|
||||
+vgmg 55,63,3
|
||||
+ 00000000000001ff 00000000000001ff
|
||||
+vgmg 43,55,3
|
||||
+ 00000000001fff00 00000000001fff00
|
||||
+vgmg 63,2,3
|
||||
+ e000000000000001 e000000000000001
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,99 +0,0 @@
|
||||
From 70ef4417837b690755feede0088331a28b102c65 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Arnez <arnez@linux.ibm.com>
|
||||
Date: Mon, 22 May 2023 18:57:35 +0200
|
||||
Subject: [PATCH 1/2] Bug 470132 - s390x: Fix the wrap-around case in VGM
|
||||
|
||||
Valgrind's implementation of VGM is incomplete:
|
||||
|
||||
* It doesn't support generating a wrap-around bit mask. Such a mask
|
||||
should result when the ending bit position is smaller than the starting
|
||||
bit position. Valgrind runs into an assertion failure instead.
|
||||
|
||||
* It doesn't ignore unused bits in the I2 and I3 fields of the
|
||||
instruction, as it should.
|
||||
|
||||
Fix this by re-implementing the main logic in s390_irgen_VGM().
|
||||
---
|
||||
VEX/priv/guest_s390_toIR.c | 57 +++++++++++++++-----------------------
|
||||
1 file changed, 22 insertions(+), 35 deletions(-)
|
||||
|
||||
diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c
|
||||
index 11dda41ef..d9d746c38 100644
|
||||
--- a/VEX/priv/guest_s390_toIR.c
|
||||
+++ b/VEX/priv/guest_s390_toIR.c
|
||||
@@ -16388,50 +16388,37 @@ s390_irgen_VGBM(UChar v1, UShort i2, UChar m3 __attribute__((unused)))
|
||||
static const HChar *
|
||||
s390_irgen_VGM(UChar v1, UShort i2, UChar m3)
|
||||
{
|
||||
- UChar from = (i2 & 0xff00) >> 8;
|
||||
- UChar to = (i2 & 0x00ff);
|
||||
- ULong value = 0UL;
|
||||
- IRType type = s390_vr_get_type(m3);
|
||||
- vassert(from <= to);
|
||||
-
|
||||
- UChar maxIndex = 0;
|
||||
- switch (type) {
|
||||
- case Ity_I8:
|
||||
- maxIndex = 7;
|
||||
- break;
|
||||
- case Ity_I16:
|
||||
- maxIndex = 15;
|
||||
- break;
|
||||
- case Ity_I32:
|
||||
- maxIndex = 31;
|
||||
- break;
|
||||
- case Ity_I64:
|
||||
- maxIndex = 63;
|
||||
- break;
|
||||
- default:
|
||||
- vpanic("s390_irgen_VGM: unknown type");
|
||||
- }
|
||||
-
|
||||
- for(UChar index = from; index <= to; index++) {
|
||||
- value |= (1ULL << (maxIndex - index));
|
||||
- }
|
||||
-
|
||||
- IRExpr *fillValue;
|
||||
- switch (type) {
|
||||
- case Ity_I8:
|
||||
+ s390_insn_assert("vgm", m3 <= 3);
|
||||
+
|
||||
+ UChar max_idx = (8 << m3) - 1;
|
||||
+ UChar from = max_idx & (i2 >> 8);
|
||||
+ UChar to = max_idx & i2;
|
||||
+ ULong all_one = (1ULL << max_idx << 1) - 1;
|
||||
+ ULong value = (all_one >> from) ^ (all_one >> to >> 1);
|
||||
+
|
||||
+ /* In case of wrap-around we now have a value that needs inverting:
|
||||
+ to from
|
||||
+ V V
|
||||
+ 00000111111111110000000000000000 */
|
||||
+ if (to < from)
|
||||
+ value ^= all_one;
|
||||
+
|
||||
+ IRExpr* fillValue;
|
||||
+ switch (m3) {
|
||||
+ case 0:
|
||||
fillValue = mkU8(value);
|
||||
break;
|
||||
- case Ity_I16:
|
||||
+ case 1:
|
||||
fillValue = mkU16(value);
|
||||
break;
|
||||
- case Ity_I32:
|
||||
+ case 2:
|
||||
fillValue = mkU32(value);
|
||||
break;
|
||||
- case Ity_I64:
|
||||
+ case 3:
|
||||
fillValue = mkU64(value);
|
||||
break;
|
||||
default:
|
||||
- vpanic("s390_irgen_VGM: unknown type");
|
||||
+ vpanic("s390_irgen_VGM: unknown element size");
|
||||
}
|
||||
|
||||
s390_vr_fill(v1, fillValue);
|
||||
--
|
||||
2.40.1
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
Summary: Dynamic analysis tools to detect memory or thread bugs and profile
|
||||
Name: %{?scl_prefix}valgrind
|
||||
Version: 3.21.0
|
||||
Release: 10%{?dist}
|
||||
Version: 3.22.0
|
||||
Release: 0.1.RC1%{?dist}
|
||||
Epoch: 1
|
||||
License: GPLv2+
|
||||
URL: https://www.valgrind.org/
|
||||
@ -69,7 +69,7 @@ URL: https://www.valgrind.org/
|
||||
# So those will already have their full symbol table.
|
||||
%undefine _include_minidebuginfo
|
||||
|
||||
Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.tar.bz2
|
||||
Source0: https://sourceware.org/pub/valgrind/valgrind-%{version}.RC1.tar.bz2
|
||||
|
||||
# Needs investigation and pushing upstream
|
||||
Patch1: valgrind-3.9.0-cachegrind-improvements.patch
|
||||
@ -87,41 +87,6 @@ Patch4: valgrind-3.16.0-some-Wl-z-now.patch
|
||||
# by disabling overlap checking for memcpy
|
||||
Patch5: valgrind-3.21.0-no-memcpy-replace-check.patch
|
||||
|
||||
# Add --with-gdbscripts-dir=PATH configure option
|
||||
# https://bugs.kde.org/show_bug.cgi?id=469768
|
||||
Patch6: valgrind-3.21.0-Add-with-gdbscripts-dir.patch
|
||||
|
||||
# Add epoll_pwait2
|
||||
# https://bugs.kde.org/show_bug.cgi?id=460192
|
||||
Patch7: valgrind-3.21.0-epoll_pwait2.patch
|
||||
|
||||
# Can't run callgrind_control with valgrind 3.21.0 because of perl errors
|
||||
# https://bugs.kde.org/show_bug.cgi?id=470121
|
||||
Patch8: valgrind-3.21.0-callgrind_control-no-strict.patch
|
||||
|
||||
# Multiple realloc zero errors crash in MC_(eq_Error)
|
||||
# https://bugs.kde.org/show_bug.cgi?id=470520
|
||||
Patch9: valgrind-3.21.0-realloc-again.patch
|
||||
|
||||
# s390x: Assertion failure on VGM instruction
|
||||
# https://bugs.kde.org/show_bug.cgi?id=470132
|
||||
Patch10: valgrind-3.21.0-vgm.patch
|
||||
Patch11: valgrind-3.21.0-vgm-tests.patch
|
||||
|
||||
# s390x: Valgrind cannot start qemu-kvm when "sysctl vm.allocate_pgste=0"
|
||||
# https://bugs.kde.org/show_bug.cgi?id=470978
|
||||
Patch12: valgrind-3.21.0-pgste.patch
|
||||
|
||||
# gdb --multi mode stdout redirecting to stderr
|
||||
# https://bugs.kde.org/show_bug.cgi?id=471311
|
||||
Patch13: valgrind-3.21.0-gdb-multi-mode-stdout-redirecting-to-stderr.patch
|
||||
|
||||
# Add support for lazy reading and downloading of DWARF debuginfo
|
||||
# https://bugs.kde.org/show_bug.cgi?id=471807
|
||||
# Plus fixup commit a0d555a0dfe078ef04ea49d991a8090ab14bd4a5
|
||||
Patch14: valgrind-3.21.0-lazy-debuginfo.patch
|
||||
Patch15: valgrind-3.21.0-cleanup-read_elf_object.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: glibc-devel
|
||||
|
||||
@ -248,7 +213,7 @@ Valgrind User Manual for details.
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}
|
||||
%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC1
|
||||
|
||||
%patch -P1 -p1
|
||||
%patch -P2 -p1
|
||||
@ -260,17 +225,6 @@ Valgrind User Manual for details.
|
||||
%endif
|
||||
|
||||
%patch -P5 -p1
|
||||
%patch -P6 -p1
|
||||
%patch -P7 -p1
|
||||
%patch -P8 -p1
|
||||
%patch -P9 -p1
|
||||
%patch -P10 -p1
|
||||
%patch -P11 -p1
|
||||
%patch -P12 -p1
|
||||
%patch -P13 -p1
|
||||
%patch -P14 -p1
|
||||
%patch -P15 -p1
|
||||
|
||||
|
||||
%build
|
||||
# LTO triggers undefined symbols in valgrind. Valgrind has a --enable-lto
|
||||
@ -465,6 +419,7 @@ echo ===============END TESTING===============
|
||||
%files devel
|
||||
%dir %{_includedir}/valgrind
|
||||
%{_includedir}/valgrind/valgrind.h
|
||||
%{_includedir}/valgrind/cachegrind.h
|
||||
%{_includedir}/valgrind/callgrind.h
|
||||
%{_includedir}/valgrind/drd.h
|
||||
%{_includedir}/valgrind/helgrind.h
|
||||
@ -503,6 +458,13 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Oct 17 2023 Mark Wielaard <mjw@fedoraproject.org> - 3.22.0-0.1.RC1
|
||||
- Upstream 3.22.0-RC1
|
||||
- Remove all upstreamed patches
|
||||
- Adjust valgrind-3.16.0-some-stack-protector.patch
|
||||
- Adjust valgrind-3.16.0-some-Wl-z-now.patch
|
||||
- Add cachegrind.h to valgrind-devel package
|
||||
|
||||
* Mon Aug 21 2023 Mark Wielaard <mjw@fedoraproject.org> - 3.21.0-10
|
||||
- Add valgrind-3.21.0-lazy-debuginfo.patch
|
||||
- Add valgrind-3.21.0-cleanup-read_elf_object.patch
|
||||
|
Loading…
Reference in New Issue
Block a user