From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Sheheryar Parvaz Newsgroups: gmane.lisp.guile.bugs Subject: bug#30261: segfault on simultaneous initialization Date: Fri, 26 Jan 2018 17:24:11 +0000 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_DM5PR13MB159629F5A5A3B229022C7AD4F1E00DM5PR13MB1596namp_" X-Trace: blaine.gmane.org 1516988193 5354 195.159.176.226 (26 Jan 2018 17:36:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 26 Jan 2018 17:36:33 +0000 (UTC) To: 30261@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Jan 26 18:36:29 2018 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 1ef7v8-0008NB-34 for guile-bugs@m.gmane.org; Fri, 26 Jan 2018 18:36:10 +0100 Original-Received: from localhost ([::1]:41319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef7x8-00043K-NS for guile-bugs@m.gmane.org; Fri, 26 Jan 2018 12:38:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef7wz-00041e-Vx for bug-guile@gnu.org; Fri, 26 Jan 2018 12:38:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ef7ww-0002gd-Nt for bug-guile@gnu.org; Fri, 26 Jan 2018 12:38:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36092) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ef7ww-0002gJ-I1 for bug-guile@gnu.org; Fri, 26 Jan 2018 12:38:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ef7ww-0006Oe-5W for bug-guile@gnu.org; Fri, 26 Jan 2018 12:38:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sheheryar Parvaz Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 26 Jan 2018 17:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30261 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: "bug-guile@gnu.org" Original-Received: via spool by submit@debbugs.gnu.org id=B.151698825824525 (code B ref -1); Fri, 26 Jan 2018 17:38:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Jan 2018 17:37:38 +0000 Original-Received: from localhost ([127.0.0.1]:43989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ef7wY-0006NS-3Y for submit@debbugs.gnu.org; Fri, 26 Jan 2018 12:37:38 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36380) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ef7jk-0005nj-Rp for submit@debbugs.gnu.org; Fri, 26 Jan 2018 12:24:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ef7je-0005DK-Kc for submit@debbugs.gnu.org; Fri, 26 Jan 2018 12:24:19 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:36629) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ef7je-0005Cx-Gm for submit@debbugs.gnu.org; Fri, 26 Jan 2018 12:24:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef7jd-0002bU-9C for bug-guile@gnu.org; Fri, 26 Jan 2018 12:24:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ef7jZ-0005A2-69 for bug-guile@gnu.org; Fri, 26 Jan 2018 12:24:17 -0500 Original-Received: from mail-oln040092003080.outbound.protection.outlook.com ([40.92.3.80]:2055 helo=NAM02-BL2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ef7jY-00059M-Vl for bug-guile@gnu.org; Fri, 26 Jan 2018 12:24:13 -0500 Original-Received: from SN1NAM02FT034.eop-nam02.prod.protection.outlook.com (10.152.72.53) by SN1NAM02HT157.eop-nam02.prod.protection.outlook.com (10.152.73.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.444.13; Fri, 26 Jan 2018 17:24:11 +0000 Original-Received: from DM5PR13MB1596.namprd13.prod.outlook.com (10.152.72.54) by SN1NAM02FT034.mail.protection.outlook.com (10.152.72.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.444.13 via Frontend Transport; Fri, 26 Jan 2018 17:24:11 +0000 Original-Received: from DM5PR13MB1596.namprd13.prod.outlook.com ([10.175.111.11]) by DM5PR13MB1596.namprd13.prod.outlook.com ([10.175.111.11]) with mapi id 15.20.0444.016; Fri, 26 Jan 2018 17:24:11 +0000 Thread-Topic: segfault on simultaneous initialization Thread-Index: AQHTlsp6xNAj/YVgVky0AtdTwEr5/g== Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:03CA1E570D9A4B1E7284B31BF4935E09A13DC7951DD6371DBBC0D2C7FDA49C70; UpperCasedChecksum:D8F9666A2003D61C58542761DB702B0E36889426A564A24D5670654EDB0CC80B; SizeAsReceived:6808; Count:43 x-tmn: [jNL38sFPcUbSFu88YWFeKs+qTLmk/Idg] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; SN1NAM02HT157; 6:by9TpS1fgTWKkFX4luUfNExBlZTHPRHLACs+jsQby1MuvrdUhpphliNpVRnJR24Msb7GTDvO2aEA/vaugp2Y7vvey+iX8oHKDH8QSHePUde6A9/+fLNdnvz5V+HlczSA8Pe2bgW9GIoRe5aAaJn0eLtpEhjHoVBinJmn/Z2lqccOkvxcUploSDMJhN6dRBVNs4rHPbKPJFwXqMXLUQtpZGsVcWnTYeqqcJfCUAYcCnEzRsQmuFDq8CS7ViixyE8A8Bt27Wi7bGR777XFCbz6FfTZsyXHnrbRJp13pUfsQVgqXkXVTdSPH2h4TMDCIovAJDlpyC8iyT23QCzToWr0eHVgGthcdHnBDn/bLM3mE5g=; 5:im8cmjMBE+sEE8Ts0+OONTTRUn8YP9fswh2gCnhWFn4cuO3y6d0XwdmTpy1LXclYCP4RRi1P1xUDOWHHZJJfVxZ6c6heNCQUP7C12yX15PpgYPPzf5GD0gbX+oug4Eo8bSSXDwJLAyBvz4/EdpNBI6MtDZSuxiyad8ip/lG7rS4=; 24:iuwU+WIm3F/DrbfCOpYxERdoap/9sSixIaOaxTJzW/+GA0b1mUjtJGS58+i1VGPWRTZbJBlpvtW6rgT/fEySB6wtahrRjAgYmIs/P7u9rkw=; 7:WlZn7dX/QMYDzZNH5yVOhn99cJ6D/OwrQw7wnxNAcv5xBXNP8u9uElGuPpVyEKOPfCeZzg2nF7hIZhNFDgltfPsu0wkil/SYPQdEEzOCKkw4CxfqLWDcHI+8ksCQWHebfbfTN7h8TgLzjGbW+IZJ5457lmOT43uI6UkcbY8S1xgEpB+0LuWROMdzX x-incomingheadercount: 43 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125374)(1701031045); SRVR:SN1NAM02HT157; x-ms-traffictypediagnostic: SN1NAM02HT157: x-ms-office365-filtering-correlation-id: e0cbfed1-747c-4318-926e-08d564e19d94 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:SN1NAM02HT157; BCL:0; PCL:0; RULEID:; SRVR:SN1NAM02HT157; x-forefront-prvs: 05641FD966 x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:SN1NAM02HT157; H:DM5PR13MB1596.namprd13.prod.outlook.com; FPR:; SPF:None; LANG:; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0cbfed1-747c-4318-926e-08d564e19d94 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2018 17:24:11.6034 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM02HT157 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Fri, 26 Jan 2018 12:37:36 -0500 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:8982 Archived-At: --_000_DM5PR13MB159629F5A5A3B229022C7AD4F1E00DM5PR13MB1596namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable If the initial call to scm_with_guile is on a thread and in the main thread at the same time, a segmentation fault occurs. #include #include void* hello_world(void *arg) { scm_c_eval_string("(display \"Hello World!\")"); scm_c_eval_string("(newline)"); } void run_guile() { scm_with_guile(&hello_world, NULL); } int main(int argc, char **argv) { pthread_t th; int ret =3D pthread_create(&th, NULL, &run_guile, NULL); run_guile(); pthread_join(&th, NULL); return 0; } Here is a backtrace of the issue. #0 0x00007ffff7afd976 in scm_set_current_dynamic_state () from /usr/li= b/libguile-2.2.so.1 #1 0x00007ffff7b5faec in guilify_self_2 () from /usr/lib/libguile-2.2.= so.1 #2 0x00007ffff7b604b4 in scm_i_init_thread_for_guile () from /usr/lib/= libguile-2.2.so.1 #3 0x00007ffff7b604f9 in with_guile () from /usr/lib/libguile-2.2.so.1 #4 0x00007ffff7281312 in GC_call_with_stack_base () from /usr/lib/libg= c.so.1 #5 0x00007ffff7b60918 in scm_with_guile () from /usr/lib/libguile-2.2.= so.1 #6 0x00000000004007a3 in run_guile () #7 0x00007ffff7893568 in start_thread (arg=3D0x7ffff5ea8700) at pthrea= d_create.c:465 #8 0x00007ffff75cb52f in clone () at ../sysdeps/unix/sysv/linux/x86_64= /clone.S:95 --_000_DM5PR13MB159629F5A5A3B229022C7AD4F1E00DM5PR13MB1596namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
If the initial call to scm_with_guile is on a thread and in the main
thread at the same time, a segmentation fault occurs.

    #include <pthread.h>
    #include <libguile.h>

    void* hello_world(void *arg) {
        scm_c_eval_string("(display= \"Hello World!\")");
        scm_c_eval_string("(newline= )");
    }

    void run_guile() {
        scm_with_guile(&hello_world,= NULL);
    }

    int main(int argc, char **argv) {

        pthread_t th;
        int ret =3D pthread_create(&= th, NULL, &run_guile, NULL);

        run_guile();
        pthread_join(&th, NULL);

        return 0;
    }

Here is a backtrace of the issue.

    #0  0x00007ffff7afd976 in scm_set_current_dyna= mic_state () from /usr/lib/libguile-2.2.so.1
    #1  0x00007ffff7b5faec in guilify_self_2 () fr= om /usr/lib/libguile-2.2.so.1
    #2  0x00007ffff7b604b4 in scm_i_init_thread_fo= r_guile () from /usr/lib/libguile-2.2.so.1
    #3  0x00007ffff7b604f9 in with_guile () from /= usr/lib/libguile-2.2.so.1
    #4  0x00007ffff7281312 in GC_call_with_stack_b= ase () from /usr/lib/libgc.so.1
    #5  0x00007ffff7b60918 in scm_with_guile () fr= om /usr/lib/libguile-2.2.so.1
    #6  0x00000000004007a3 in run_guile ()
    #7  0x00007ffff7893568 in start_thread (arg=3D= 0x7ffff5ea8700) at pthread_create.c:465
    #8  0x00007ffff75cb52f in clone () at ../sysde= ps/unix/sysv/linux/x86_64/clone.S:95

--_000_DM5PR13MB159629F5A5A3B229022C7AD4F1E00DM5PR13MB1596namp_--