https://sourceware.org/cgit/valgrind/commit/?id=a4593438d9fb95bae841531bd70a9217818c482b
commit a4593438d9fb95bae841531bd70a9217818c482b
Author: Mark Wielaard <ma...@kl...>
Date: Fri Oct 17 18:23:58 2025 +0200
Keep at least one frame while peeling syscall frames
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
Diff:
---
NEWS | 1 +
coregrind/m_stacktrace.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 1306652087..e531218131 100644
--- 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
diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c
index 21c0f47942..d4ee10792a 100644
--- a/coregrind/m_stacktrace.c
+++ b/coregrind/m_stacktrace.c
@@ -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
|