From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72142 invoked by alias); 8 Mar 2018 23:33:45 -0000 Mailing-List: contact libc-stable-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: List-Archive: Sender: libc-stable-owner@sourceware.org Received: (qmail 72129 invoked by uid 89); 8 Mar 2018 23:33:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=HTo:U*libc-stable, H*r:120, __startcontext X-Spam-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: hall.aurel32.net Received: from hall.aurel32.net (HELO hall.aurel32.net) (163.172.24.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Mar 2018 23:33:42 +0000 Received: from [2001:bc8:30d7:120:9bb5:8936:7e6a:9e36] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eu52a-0001rx-RS; Fri, 09 Mar 2018 00:33:40 +0100 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.90_1) (envelope-from ) id 1eu52a-0005MF-6Z; Fri, 09 Mar 2018 00:33:40 +0100 From: Aurelien Jarno To: libc-stable@sourceware.org Cc: Aurelien Jarno Subject: [2.27 COMMITTED] sparc32: Add nop before __startcontext to stop unwinding [BZ #22919] Date: Mon, 01 Jan 2018 00:00:00 -0000 Message-Id: <20180308233149.20477-1-aurelien@aurel32.net> X-Mailer: git-send-email 2.16.1 X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00000.txt.bz2 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. (cherry picked from commit 9aa5c222b9e0409143410a02b6364a3b25dbf028) --- ChangeLog | 6 ++++++ sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 494f98b51b3..3ae0ecd07a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-03-09 Aurelien Jarno + + [BZ #22919] + * sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S (__startcontext): + Add nop before __startcontext, add explaining comments. + 2018-03-07 Adhemerval Zanella [BZ #22926] diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S index 695f172c634..283aef1b304 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S @@ -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 -- 2.16.1