From patchwork Wed Mar 9 07:53:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 11285 Received: (qmail 21686 invoked by alias); 9 Mar 2016 07:53:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 21667 invoked by uid 89); 9 Mar 2016 07:53:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.8 required=5.0 tests=BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=U*aurelien, sk:aurelie, aurelien@aurel32.net, D*aurel32.net X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Aurelien Jarno Subject: [PATCH] mips: terminate the FDE before the return trampoline in makecontext Date: Wed, 9 Mar 2016 08:53:13 +0100 Message-Id: <1457509993-2393-1-git-send-email-aurelien@aurel32.net> 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. --- ChangeLog | 6 ++++++ sysdeps/unix/sysv/linux/mips/makecontext.S | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 73a49a0..4a2647d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-03-09 Aurelien Jarno + + [BZ #19792] + * sysdeps/unix/sysv/linux/mips/makecontext.S (__makecontext): + Terminate FDE before return label. + 2016-03-08 Roland McGrath * sysdeps/x86_64/tst-audit10.c: #include . diff --git a/sysdeps/unix/sysv/linux/mips/makecontext.S b/sysdeps/unix/sysv/linux/mips/makecontext.S index 66600c7..3196554 100644 --- a/sysdeps/unix/sysv/linux/mips/makecontext.S +++ b/sysdeps/unix/sysv/linux/mips/makecontext.S @@ -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)