]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Keep at least one frame while peeling syscall frames
authorMark Wielaard <mark@klomp.org>
Fri, 17 Oct 2025 16:23:58 +0000 (18:23 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 17 Oct 2025 16:23:58 +0000 (18:23 +0200)
VG_(get_StackTrace_with_deltas) might peel extra glibc syscall
(cancel) frames. But if the backtrace failed, or only contains such
syscall frames then we should keep at least one (the initial frame will
always be there). Various routines expect n_ips of a Stacktrace to be
at least 1.

https://bugs.kde.org/show_bug.cgi?id=507188

NEWS
coregrind/m_stacktrace.c

diff --git a/NEWS b/NEWS
index 1306652087a4452ba2a0741e024d8fcae4a084aa..e531218131d6a6a9cd1407214aa45c3dfee54372 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -133,6 +133,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 506970  mmap needs an EBADF fd_allowed check
 507033  Remove deprecated Iop_Clz32/64 and Iop_Ctz32/64
 507173  s390x: Crash when constant folding is disabled
+507188  memcheck with track-fds=yes on x86 with popen: Assertion
 507720  Review syscalls returning file descriptors (other platforms)
 507721  Wire up illumos and Solaris mallinfo
 507853  faccessat and faccessat2 should handle AT_FDCWD and absolute paths
index 21c0f47942071d8e9e7f6e3d750d29fbf07d491d..d4ee10792a2fff887ab3f297e3040c89ea9a6177 100644 (file)
@@ -1709,7 +1709,8 @@ UInt VG_(get_StackTrace_with_deltas)(
       Int i;
       Int start = 0;
       DiEpoch ep = VG_(current_DiEpoch)();
-      for (i = 0; i < found; i++) {
+      /* We want to keep at least one frame.  */
+      for (i = 0; i < found - 1; i++) {
          /* This could be made a little more efficient by doing the lookups
             for the symbols at glibc load time and check the address falls
             inside the function symbol address range here. But given this