From: Mark Wielaard Date: Fri, 17 Oct 2025 16:23:58 +0000 (+0200) Subject: Keep at least one frame while peeling syscall frames X-Git-Tag: VALGRIND_3_26_0~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a4593438d9fb95bae841531bd70a9217818c482b;p=thirdparty%2Fvalgrind.git 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 --git a/NEWS b/NEWS index 130665208..e53121813 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 21c0f4794..d4ee10792 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