From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Sergei Trofimovich Newsgroups: gmane.lisp.guile.bugs Subject: bug#29151: [PATCH] ia64: fix crash in thread context switch Date: Sun, 5 Nov 2017 09:30:45 +0000 Message-ID: <20171105093045.10066-1-slyfox@gentoo.org> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1509874337 8279 195.159.176.226 (5 Nov 2017 09:32:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 5 Nov 2017 09:32:17 +0000 (UTC) Cc: Sergei Trofimovich To: 29151@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Nov 05 10:32:09 2017 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBHHj-0001Zb-DM for guile-bugs@m.gmane.org; Sun, 05 Nov 2017 10:32:07 +0100 Original-Received: from localhost ([::1]:43521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBHHq-0003SK-SY for guile-bugs@m.gmane.org; Sun, 05 Nov 2017 04:32:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBHHj-0003S4-Po for bug-guile@gnu.org; Sun, 05 Nov 2017 04:32:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBHHe-0007Sx-ML for bug-guile@gnu.org; Sun, 05 Nov 2017 04:32:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42505) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eBHHe-0007Se-JQ for bug-guile@gnu.org; Sun, 05 Nov 2017 04:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eBHHe-0001di-Da for bug-guile@gnu.org; Sun, 05 Nov 2017 04:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sergei Trofimovich Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 05 Nov 2017 09:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29151 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15098742736242 (code B ref -1); Sun, 05 Nov 2017 09:32:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Nov 2017 09:31:13 +0000 Original-Received: from localhost ([127.0.0.1]:51186 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBHGr-0001cc-Cu for submit@debbugs.gnu.org; Sun, 05 Nov 2017 04:31:13 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39730) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBHGq-0001cP-6L for submit@debbugs.gnu.org; Sun, 05 Nov 2017 04:31:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBHGj-0006kz-Ol for submit@debbugs.gnu.org; Sun, 05 Nov 2017 04:31:06 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:36415) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eBHGj-0006kq-LJ for submit@debbugs.gnu.org; Sun, 05 Nov 2017 04:31:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBHGh-0003Cv-Oi for bug-guile@gnu.org; Sun, 05 Nov 2017 04:31:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBHGc-0006ei-Sr for bug-guile@gnu.org; Sun, 05 Nov 2017 04:31:03 -0500 Original-Received: from smtp.gentoo.org ([2001:470:ea4a:1:5054:ff:fec7:86e4]:34399) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eBHGc-0006dt-M2 for bug-guile@gnu.org; Sun, 05 Nov 2017 04:30:58 -0500 Original-Received: from sf.home (host86-186-94-90.range86-186.btcentralplus.com [86.186.94.90]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: slyfox) by smtp.gentoo.org (Postfix) with ESMTPSA id D606B33BF55; Sun, 5 Nov 2017 09:30:55 +0000 (UTC) Original-Received: by sf.home (Postfix, from userid 1000) id 266AC1C758EE6; Sun, 5 Nov 2017 09:30:50 +0000 (GMT) X-Mailer: git-send-email 2.15.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9018 Backtrace looks like that: Program terminated with signal SIGSEGV, Segmentation fault. #0 0x200000000014a5c0 in scm_ia64_longjmp (JB=0x6000000000817020, VAL=1) at continuations.c:372 372 t->pending_rbs_continuation->backing_store, [Current thread is 1 (Thread 0x2000000000049340 (LWP 8190))] (gdb) bt #0 0x200000000014a5c0 in scm_ia64_longjmp (JB=0x6000000000817020, VAL=1) at continuations.c:372 #1 0x2000000000148e00 in scm_c_abort (vm=0x60000000000edea0, tag=0x6000000000795ba0, n=0, argv=0x60000fffff7f0ce0, cookie=-1) at control.c:239 #2 0x2000000000149070 in scm_at_abort (tag=0x6000000000795ba0, args=0x304) at control.c:258 (gdb) print t $2 = (scm_i_thread *) 0x6000000000068000 (gdb) print t->pending_rbs_continuation $3 = (scm_t_contregs *) 0xffeb The problem here is the value of 't->pending_rbs_continuation' pointer. It's supposed to poin to a register stack pointer or be NULL if not yet backed up. The problem is it is never initialized to NULL at creation time and contained garbage on stack. Sometimes people are lucky and have zeros on stack and guile works. But sometimes there is something and guile crashes. The fix is trivial: initialize 'pending_rbs_continuation = NULL' at thread registration time (the same way other threads are registered). Reported-by: Matt Turner Bug: https://bugs.gentoo.org/613986 * libguile/threads.c(guilify_self_1): initialize pending_rbs_continuation to avoid guile crash on ia64. Signed-off-by: Sergei Trofimovich --- libguile/threads.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libguile/threads.c b/libguile/threads.c index 9ceb5b88a..770f62c44 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -395,6 +395,7 @@ guilify_self_1 (struct GC_stack_base *base, int needs_unregister) t.base = base->mem_base; #ifdef __ia64__ t.register_backing_store_base = base->reg_base; + t.pending_rbs_continuation = 0; #endif t.continuation_root = SCM_EOL; t.continuation_base = t.base; -- 2.15.0