Patchwork alpha: Add cfi information for _startcontext routines to stop unwinding [BZ#22910]

login
register
mail settings
Submitter Aurelien Jarno
Date March 1, 2018, 11:08 p.m.
Message ID <20180301230856.18317-1-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/26148/
State New
Headers show

Comments

Aurelien Jarno - March 1, 2018, 11:08 p.m.
Starting with GCC 8, libgc1c is better at unwinding on alpha. This
causes backtrace called within a context created by makecontext to yield
infinite backtrace. This patch adds cfi information for _startcontext
and ra which marks the frame as outermost frame.

This fixes tst-makecontext for alpha.
---
 ChangeLog                                   | 6 ++++++
 sysdeps/unix/sysv/linux/alpha/makecontext.S | 5 +++++
 2 files changed, 11 insertions(+)

Patch

diff --git a/ChangeLog b/ChangeLog
index 4b7e0a0261..8ea10886e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@ 
+2018-03-01  Aurelien Jarno  <aurelien@aurel32.net>
+
+	[BZ #22910]
+	* sysdeps/unix/sysv/linux/alpha/setcontext.S (__startcontext): Set
+	up CFI directive to forbid further backtracing.
+
 2018-03-01  Maciej W. Rozycki  <macro@mips.com>
 
 	* nptl_db/td_ta_thr_iter.c (iterate_thread_list): Remove
diff --git a/sysdeps/unix/sysv/linux/alpha/makecontext.S b/sysdeps/unix/sysv/linux/alpha/makecontext.S
index cae2144e03..cc824dfe25 100644
--- a/sysdeps/unix/sysv/linux/alpha/makecontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/makecontext.S
@@ -138,10 +138,14 @@  weak_alias (__makecontext, makecontext)
 
 	.align	4
 	.ent	__startcontext
+	cfi_startproc
 __startcontext:
 	.frame $31, 0, $31, 0
 	.prologue 0
 
+	/* Mark ra as undefined in order to stop unwinding here.  */
+	cfi_undefined(ra)
+
 	jsr	$26, ($27), 0
 	ldgp	$29, 0($26)
 	mov	$9, $16
@@ -160,4 +164,5 @@  __startcontext:
 
 	halt
 
+	cfi_endproc
 	.end __startcontext