Skip to content

Commit

Permalink
mips: terminate the FDE before the return trampoline in makecontext
Browse files Browse the repository at this point in the history
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 e535ce2. 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.
  • Loading branch information
Aurelien Jarno committed Mar 9, 2016
1 parent 613c92b commit f8e9c4d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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-09 Joseph Myers <joseph@codesourcery.com>

[BZ #19790]
Expand Down
7 changes: 7 additions & 0 deletions sysdeps/unix/sysv/linux/mips/makecontext.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -186,6 +191,8 @@ NESTED (__makecontext, FRAMESZ, ra)
1:
lb zero, (zero)
b 1b

cfi_startproc
PSEUDO_END (__makecontext)

weak_alias (__makecontext, makecontext)

0 comments on commit f8e9c4d

Please sign in to comment.