From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Gran Newsgroups: gmane.lisp.guile.bugs Subject: bug#13611: SEGV during SMOB GC Date: Sat, 2 Feb 2013 12:51:40 -0800 (PST) Message-ID: <1359838300.89158.YahooMailNeo@web120405.mail.ne1.yahoo.com> Reply-To: Mike Gran NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="1501580392-229250612-1359838300=:89158" X-Trace: ger.gmane.org 1359838330 3583 80.91.229.3 (2 Feb 2013 20:52:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Feb 2013 20:52:10 +0000 (UTC) To: 13611@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Feb 02 21:52:31 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U1k4c-0007Nx-TH for guile-bugs@m.gmane.org; Sat, 02 Feb 2013 21:52:31 +0100 Original-Received: from localhost ([::1]:48821 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1k4K-00013n-JV for guile-bugs@m.gmane.org; Sat, 02 Feb 2013 15:52:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1k4H-00013X-4x for bug-guile@gnu.org; Sat, 02 Feb 2013 15:52:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1k4F-0001DY-VP for bug-guile@gnu.org; Sat, 02 Feb 2013 15:52:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56001) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1k4F-0001DT-Rz for bug-guile@gnu.org; Sat, 02 Feb 2013 15:52:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U1k58-0006q0-Fd for bug-guile@gnu.org; Sat, 02 Feb 2013 15:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mike Gran Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 02 Feb 2013 20:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13611 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: Bug Guile Original-Received: via spool by submit@debbugs.gnu.org id=B.135983836426238 (code B ref -1); Sat, 02 Feb 2013 20:53:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Feb 2013 20:52:44 +0000 Original-Received: from localhost ([127.0.0.1]:33232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1k4p-0006p9-PA for submit@debbugs.gnu.org; Sat, 02 Feb 2013 15:52:44 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:44768) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1k4n-0006p0-Sy for submit@debbugs.gnu.org; Sat, 02 Feb 2013 15:52:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1k3t-0001C2-C9 for submit@debbugs.gnu.org; Sat, 02 Feb 2013 15:51:46 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:58396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1k3t-0001Bg-8n for submit@debbugs.gnu.org; Sat, 02 Feb 2013 15:51:45 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1k3s-000121-2J for bug-guile@gnu.org; Sat, 02 Feb 2013 15:51:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1k3q-0001BK-Q4 for bug-guile@gnu.org; Sat, 02 Feb 2013 15:51:44 -0500 Original-Received: from nm31-vm1.bullet.mail.ne1.yahoo.com ([98.138.229.41]:35460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1k3q-0001BG-GR for bug-guile@gnu.org; Sat, 02 Feb 2013 15:51:42 -0500 Original-Received: from [98.138.90.53] by nm31.bullet.mail.ne1.yahoo.com with NNFMP; 02 Feb 2013 20:51:41 -0000 Original-Received: from [98.138.89.245] by tm6.bullet.mail.ne1.yahoo.com with NNFMP; 02 Feb 2013 20:51:41 -0000 Original-Received: from [127.0.0.1] by omp1059.mail.ne1.yahoo.com with NNFMP; 02 Feb 2013 20:51:41 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 509328.96256.bm@omp1059.mail.ne1.yahoo.com Original-Received: (qmail 89324 invoked by uid 60001); 2 Feb 2013 20:51:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1359838301; bh=C6m4I4uJMpkyaLSGvcTIHRDVajrsUiDDt0/FTgrOBEw=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=MaouwKDMGvXADDGUD8niYRUkxXB+R32RxBiuj1E1HKeGqEw0OCWBjab+RIYrm9ilKYriG89Sqcxb8G7ey4z7rV86mbSDIyJwXLBM+XD9lcyLSVG4PBGNjD+Rkd/7YV1pOdxt4ELacIA6aCRsBCj/aQT1n/R8PHMRo5P6l6cAvgw= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=TMw+0lCJAJtoIv2o7JmTA8pjsyMqa7pkVv+pInsAn5r0LUlG5tKAbnMqY1ulxHvKlVmNitHppJHHV8EV4llZhc455sOsR/4auE7bQdIqwGapYgwQPG6G4OXreb5dvpxmaVOKo3qQOfrOmxUwFDiSB2PgkF5BiGWfD/kMmkVwYdg=; X-YMail-OSG: nVJQhXkVM1l4KZtVwnhGAsUDV1a_joElRHMBa492AxE3rBB mNkg8J2AyG3KnsaGLpF10gDMeXosghgM1emAcK0wC_fsBmtv7SZHDIQhGP3D dIynfP0NLIT1OQpBn5R5HxAJQWICqytMbz60.V4lo4piqwxLG5uKz0_od5Ah __iVqHO6Pgu3PbJgKjnJ1qSnQSZkOOdZ5Qd6oc2Na6JATc_TkcNI4vjJVs4b GoJyAXFFo47kj609afK9hDHfLjyNtZxJnXyJ0p2_f82JT5p9iluZNBde3UGZ Vba2wM94MZdYqLK70_AwBBBTwmt8BjJTqC8B6DUlg84zqEcjwWVAzLxzc1O8 ncRCVKgBurXbCttHyAcQ_0DclXyeoG4.hzJHfQ7x64tgM_9cuYF5kJ8k0XSI iFJ6iPWj0H4vBcrb7akGZ4scv9_WhLrelKOt6ClFiND0MpKLlwL_unbaoxI0 YdI9lx4wOavWANrE3CQ2m3662ynoy9sSm_Sczf8o8AgwOidIlsBzCjt9.4HB mb4NkStsiBFFFQnIDF6I_06QRU3RLE6fG5NhGGVzDQWAR5a3c Original-Received: from [71.130.223.191] by web120405.mail.ne1.yahoo.com via HTTP; Sat, 02 Feb 2013 12:51:40 PST X-Rocket-MIMEInfo: 001.001, SGVsbG8tCgpJIGhhdmUgYSByZXByb2R1Y2libGUgU0VHViBkdXJpbmcgR0Mgb2YgU01PQnMgb24gR3VpbGUgMi4wLjcuCkl0IHdhcyBhbHNvIHByZXNlbnQgaW4gMi4wLjYuCgoKVG8gcmVwcm9kdWNlIGNvbXBpbGUgbWFpbi5jIGFzIAoKJCBnY2MgLXN0ZD1nbnU5OSAtc2hhcmVkIC1vIHNtb2JidWcuc28gLVdhbGwgLVdleHRyYSBgcGtnLWNvbmZpZyBndWlsZS0yLjAgLS1jZmxhZ3MgLS1saWJzYCAtZlBJQyBtYWluLmMKCgpUaGVuIHdpdGgKJCBMRF9QUkVMT0FEPS4vc21vYmJ1Zy5zbyBMRF9MSUJSQVJZX1ABMAEBAQE- X-Mailer: YahooMailWebService/0.8.131.499 X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x 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.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6730 Archived-At: --1501580392-229250612-1359838300=:89158 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hello-=0A=0AI have a reproducible SEGV during GC of SMOBs on Guile 2.0.7.= =0AIt was also present in 2.0.6.=0A=0A=0ATo reproduce compile main.c as =0A= =0A$ gcc -std=3Dgnu99 -shared -o smobbug.so -Wall -Wextra `pkg-config guile= -2.0 --cflags --libs` -fPIC main.c=0A=0A=0AThen with=0A$ LD_PRELOAD=3D./smo= bbug.so LD_LIBRARY_PATH=3D. GUILE_LOAD_PATH=3D. guile=0A=0A;; At the repl, = load the lib=0A=0A=A0(use-modules (smobbug))=0A;; Make a SMOB to be GC'd=0A= =0A=A0(handlesmob-init)=0A;; Trigger a GC from the GC thread=0A=A0(string-l= ength (make-string 10000000))=0A=0AThis gives=0A=0A=A0 Program received sig= nal SIGSEGV, Segmentation fault.=0A=A0 [Switching to Thread 0xb7d98b40 (LWP= 20488)]=0A=A0 0xb7f251ab in smob_mark (addr=3D0x8608ff0, mark_stack_ptr=3D= 0xb7d90308, =0A=A0=A0 =A0=A0 mark_stack_limit=3D0xb7d982f0, env=3D0) at smo= b.c:325=0A=A0 325=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 SCM_I_CURRENT_THREAD->curre= nt_mark_stack_ptr =3D mark_stack_ptr;=0A=0AHere's what's happening internal= ly.=A0 When Guile starts up, it creates 3=0Athreads=0A* Initial thread=0A* = GC thread from scm_storage_prehistory GC_INIT()=0A* signal delivery thread= =0A=0AThat second thread is the one from which automatic garbage collection= =0Aoccurs.=A0 The way that thread gets created, it has an=0Ascm_i_current_t= hread =3D=3D NULL, apparently.=0A=0A=0ASo dereferencing scm_i_current_threa= d causes null dereference.=0AAnd smob_mark() will dereference scm_i_current= _thread when collecting a=0Asmob with a mark function.=0A=0A-Mike=0A --1501580392-229250612-1359838300=:89158 Content-Type: text/x-scheme; name="smobbug.scm" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smobbug.scm" KGRlZmluZS1tb2R1bGUgKHNtb2JidWcpCiAgIzpleHBvcnQgKCAKCSAgICBo YW5kbGVzbW9iLWluaXQKCSAgICApKQoKKGxvYWQtZXh0ZW5zaW9uICJzbW9i YnVnIiAic21vYmJ1Z19pbml0IikKCihkZWZpbmUgKGhhbmRsZXNtb2ItaW5p dCkKICAiZG9jc3RyaW5nIgogICglaGFuZGxlc21vYi1pbml0KSkK --1501580392-229250612-1359838300=:89158 Content-Type: text/x-csrc; name="main.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="main.c" I2RlZmluZSBfR05VX1NPVVJDRQojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1 ZGUgPGxpYmd1aWxlLmg+CgpzdGF0aWMgc2NtX3RfYml0cyBoYW5kbGVzbW9i X3RhZzsKdm9pZCBzbW9iYnVnX2luaXQgKHZvaWQpOwpTQ00gbWFya19oYW5k bGUgKFNDTSB4KTsKCgpTQ00gaGFuZGxlc21vYl9pbml0ICgpCnsKICBTQ00g c19oYW5kbGVzbW9iOwogIGNoYXIgKmhhbmR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