]> sourceware.org Git - glibc.git/commitdiff
sparc32: Add nop before __startcontext to stop unwinding [BZ #22919]
authorAurelien Jarno <aurelien@aurel32.net>
Thu, 8 Mar 2018 23:14:27 +0000 (00:14 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Thu, 8 Mar 2018 23:14:27 +0000 (00:14 +0100)
On sparc32 tst-makecontext fails, as backtrace called within a context
created by makecontext to yield infinite backtrace.

Fix that the same way than nios2 by adding a nop just before
__startcontext. This is needed as otherwise FDE lookup just repeatedly
finds __setcontext's FDE in an infinite loop, due to the convention of
using 'address - 1' for FDE lookup.

Changelog:
[BZ #22919]
* sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S (__startcontext):
Add nop before __startcontext, add explaining comments.

ChangeLog
sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S

index dfb96aa372afec13f1bb814c020aa0f377568943..054d004b544903c04ce745a2579ff1b69377cbac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-09  Aurelien Jarno  <aurelien@aurel32.net>
+
+       [BZ #22919]
+       * sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S (__startcontext):
+       Add nop before __startcontext, add explaining comments.
+
 2018-03-07  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
        [BZ #22926]
index 695f172c634f960a133ea087df5c67bd9688a2e3..283aef1b304de4f3c4aac3a42c69f5ad77667175 100644 (file)
@@ -95,6 +95,19 @@ END(__setcontext)
 
 weak_alias (__setcontext, setcontext)
 
+/* We add an NOP here to separate between __setcontext/__startcontext. The
+   wanted behavior that happens is: when unwinding from a function called
+   inside a makecontext() context, FDE lookup will use '&__startcontext - 1',
+   then returns NULL for no FDE found, and immediately ends the unwind, in
+   a normal fashion.
+
+   If this NOP word does not exist, FDE lookup just repeatedly finds
+   __setcontext's FDE in an infinite loop, due to the convention of using
+   'address - 1' for FDE lookup. Modifiying/deleting the below
+   __startcontext's FDE has no help on this.  */
+
+       nop
+
 /* This is the helper code which gets called if a function which is
    registered with 'makecontext' returns.  In this case we have to
    install the context listed in the uc_link element of the context
This page took 0.095677 seconds and 5 git commands to generate.