]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
mips: terminate the FDE before the return trampoline in makecontext
authorAurelien Jarno <aurelien@aurel32.net>
Tue, 8 Mar 2016 23:25:00 +0000 (00:25 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Wed, 9 Mar 2016 17:51:50 +0000 (18:51 +0100)
In makecontext the FDE needs to be terminated before the return
trampoline otherwise backtrace called within a context created by
makecontext yields infinite backtrace.

This bug has been present for a long time, stdlib/tst-makecontext did
not fail until recent commit e535ce25. Tested on mips-linux-gnu and
mips64el-linux-gnuabi64 and mips-linux-gnu, no regression.

This fixes stdlib/tst-makecontext on MIPS.

Changelog:
[BZ #19792]
* sysdeps/unix/sysv/linux/mips/makecontext.S (__makecontext):
Terminate FDE before return label.

(cherry picked from commit f8e9c4d30c28b8815e65a391416e8b15d2e7cbb8)

ChangeLog
NEWS
sysdeps/unix/sysv/linux/mips/makecontext.S

index 31773324f10414e99be55b1e8931e940bffbc38d..559f860ab25261e0d64832cc1bb67701f231be44 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-09  Aurelien Jarno  <aurelien@aurel32.net>
+
+       [BZ #19792]
+       * sysdeps/unix/sysv/linux/mips/makecontext.S (__makecontext):
+       Terminate FDE before return label.
+
 2016-03-08  Aurelien Jarno  <aurelien@aurel32.net>
 
        * include/sys/auxv.h: New file.
diff --git a/NEWS b/NEWS
index 509e336e6bf05ee04e0488f685f6841d78b95974..987f5f547965e008c016e1e8e70a72aa993de3e2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ Security related changes:
 The following bugs are resolved with this release:
 
   [19679] gcc-4.9.3 C++ exception handling broken due to unaligned stack
+  [19792] MIPS: backtrace yields infinite backtrace with makecontext
 
 \f
 Version 2.23
index 66600c75133fd42e68edfb9f33bf1f5676bcbed7..31965543f8cc4c64faaf28009df2e8a518e30b65 100644 (file)
@@ -153,6 +153,11 @@ NESTED (__makecontext, FRAMESZ, ra)
 #endif
        jr      ra
 
+       /* We need to terminate the FDE to stop unwinding if backtrace was
+          called within a context created by makecontext.  */
+       cfi_endproc
+       nop
+
 99:
 #ifdef __PIC__
        move    gp, s1
@@ -186,6 +191,8 @@ NESTED (__makecontext, FRAMESZ, ra)
 1:
        lb      zero, (zero)
        b       1b
+
+       cfi_startproc
 PSEUDO_END (__makecontext)
 
 weak_alias (__makecontext, makecontext)