diff mbox

Properly terminate FDE in makecontext for ix86 (bug 18635)

Message ID mvmpp33xro4.fsf_-_@hawking.suse.de
State New
Headers show

Commit Message

Andreas Schwab Aug. 4, 2015, 10:40 a.m. UTC
[BZ #18635]
	* sysdeps/unix/sysv/linux/i386/makecontext.S: Terminate FDE before
	ret.
	* sysdeps/i386/i686/Makefile (test-xfail-tst-makecontext): Remove.
---
 sysdeps/i386/i686/Makefile                 | 6 ------
 sysdeps/unix/sysv/linux/i386/makecontext.S | 5 ++++-
 2 files changed, 4 insertions(+), 7 deletions(-)

Comments

Roland McGrath Aug. 4, 2015, 2:53 p.m. UTC | #1
This seems like it could have a test case.
Roland McGrath Aug. 4, 2015, 3:09 p.m. UTC | #2
HJ pointed out to me that there was a test case and you removed XFAIL for
it.
So that all looks good to me.
Carlos O'Donell Aug. 4, 2015, 4:24 p.m. UTC | #3
On 08/04/2015 06:40 AM, Andreas Schwab wrote:
> 	[BZ #18635]
> 	* sysdeps/unix/sysv/linux/i386/makecontext.S: Terminate FDE before
> 	ret.
> 	* sysdeps/i386/i686/Makefile (test-xfail-tst-makecontext): Remove.

Are you suggesting this for 2.22? I wanted this fixed for 2.22, but there
wasn't consensus as to what should be fixed.

How well tested is this?

c.
Andreas Schwab Aug. 5, 2015, 9:34 a.m. UTC | #4
"Carlos O'Donell" <carlos@redhat.com> writes:

> How well tested is this?

No testsuite regressions, and I also made sure that gdb always shows a
proper backtrace when stepping through makecontext and the new context.

Andreas.
diff mbox

Patch

diff --git a/sysdeps/i386/i686/Makefile b/sysdeps/i386/i686/Makefile
index 83517c4..5ce9fc6 100644
--- a/sysdeps/i386/i686/Makefile
+++ b/sysdeps/i386/i686/Makefile
@@ -18,9 +18,3 @@  ASFLAGS-.op += -Wa,-mtune=i686
 ASFLAGS-.og += -Wa,-mtune=i686
 ASFLAGS-.oS += -Wa,-mtune=i686
 endif
-
-ifeq ($(subdir),stdlib)
-# _Unwind_Backtrace from libgcc produces a segmentation fault if it was
-# called within a context created by makecontext. See Bug 18635.
-test-xfail-tst-makecontext = yes
-endif
diff --git a/sysdeps/unix/sysv/linux/i386/makecontext.S b/sysdeps/unix/sysv/linux/i386/makecontext.S
index 8364fb9..bcf8de6 100644
--- a/sysdeps/unix/sysv/linux/i386/makecontext.S
+++ b/sysdeps/unix/sysv/linux/i386/makecontext.S
@@ -83,6 +83,10 @@  ENTRY(__makecontext)
 #else
 	movl	$L(exitcode), (%edx)
 #endif
+	/* We need to terminate the FDE here instead of after ret because
+	   the unwinder looks at ra-1 for unwind information.  */
+	cfi_endproc
+
 	/* 'makecontext' returns no value.  */
 	ret
 
@@ -92,7 +96,6 @@  ENTRY(__makecontext)
 	   the context 'makecontext' manipulated at the time of the
 	   'makecontext' call.  If the pointer is NULL the process must
 	   terminate.  */
-	cfi_endproc
 L(exitcode):
 	/* This removes the parameters passed to the function given to
 	   'makecontext' from the stack.  EBX contains the number of