]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
VG_(get_StackTrace_wrk) for x86-{linux,darwin}: when following
authorJulian Seward <jseward@acm.org>
Tue, 7 Jul 2015 14:06:00 +0000 (14:06 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 7 Jul 2015 14:06:00 +0000 (14:06 +0000)
frame-pointer chains (via EBP), don't continue if EBP doesn't contain
a 4-aligned value.  A misaligned EBP is almost certainly invalid --
hence, no loss in unwind capability here -- and the misaligned access
causes gcc 5.1 ubsan alignment checks to fail.  So avoid them.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15400

coregrind/m_stacktrace.c

index 83dc5d9b8a43659c5578a905d75d7e02a154542d..aca2d20fd8bf54d082d1fa846e309258f3cfc4f4 100644 (file)
@@ -337,7 +337,8 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
       /* This deals with frames resulting from functions which begin "pushl%
          ebp ; movl %esp, %ebp" which is the ABI-mandated preamble. */
       if (fp_min <= uregs.xbp &&
-          uregs.xbp <= fp_max - 1 * sizeof(UWord)/*see comment below*/)
+          uregs.xbp <= fp_max - 1 * sizeof(UWord)/*see comment below*/ &&
+          VG_IS_4_ALIGNED(uregs.xbp))
       {
          /* fp looks sane, so use it. */
          uregs.xip = (((UWord*)uregs.xbp)[1]);