From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 05 14:40:15 2013 Received: (at submit) by debbugs.gnu.org; 5 Dec 2013 19:40:15 +0000 Received: from localhost ([127.0.0.1]:60376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VoemU-00058c-74 for submit@debbugs.gnu.org; Thu, 05 Dec 2013 14:40:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34810) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VoemP-00058S-Qf for submit@debbugs.gnu.org; Thu, 05 Dec 2013 14:40:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoemG-0002PO-T6 for submit@debbugs.gnu.org; Thu, 05 Dec 2013 14:40:09 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoemG-0002PK-P4 for submit@debbugs.gnu.org; Thu, 05 Dec 2013 14:40:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Voem8-0004MV-8N for bug-guile@gnu.org; Thu, 05 Dec 2013 14:40:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Voelw-0002NM-LS for bug-guile@gnu.org; Thu, 05 Dec 2013 14:39:52 -0500 Received: from mail-we0-x22c.google.com ([2a00:1450:400c:c03::22c]:62043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Voelw-0002N3-E9 for bug-guile@gnu.org; Thu, 05 Dec 2013 14:39:40 -0500 Received: by mail-we0-f172.google.com with SMTP id w62so11581123wes.3 for ; Thu, 05 Dec 2013 11:39:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=Gu+fqkq2NtBWR1Dl8Hw/qEJRZ5SVA0cEPPGuvkyMa58=; b=TLXGUNNlN+a0Q8E5UPHYeDuo7yWp3VEkCMHq+eAh1xTClHmKjf5OhZ2SDl6V+EdwJP x93L1vnafKzRFXEJfVmsNWpEYal6XZPDVqV3e21WEbOTPiMr4JaFLjSYEpNVy3nwMHJc iaF7dRL2QnWbqvkzuQz9d216gLIG9XTkrcFeYnLplYyOB8lh5nbrhFBlvMpCdcLlR/0X /qvusOocITqmvLI0qlhmwJzrZUVXfpCgAy/ET7cCTMDfOi+/+FmayC5t8bfjVYHz3owf Hnp73sf/pem1VmqvO9K2NJhS2tAsk3ezQw2WlO/Jc3So7F2JN4PTFKYReQn8D6bjr6hT u1Qg== X-Received: by 10.194.122.99 with SMTP id lr3mr68634871wjb.21.1386272378166; Thu, 05 Dec 2013 11:39:38 -0800 (PST) Received: from [192.168.10.104] (105-237-90-181.access.mtnbusiness.co.za. [105.237.90.181]) by mx.google.com with ESMTPSA id w20sm9212500wia.5.2013.12.05.11.39.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 11:39:37 -0800 (PST) Message-ID: <52A0D66A.2070708@gmail.com> Date: Thu, 05 Dec 2013 21:39:22 +0200 From: Pieter Slabbert User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: bug-guile@gnu.org Subject: segfault when loading file Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) HI When I try to load a file which contains (set-car! '(0 . ()) 1) Guile segfaults . if I enter the same thing into the interpreter it works fine. I tried the same thing in chibi and it complained about try to mutate an immutable pair. Fixed it in my code but the segfault made it a lot harder to find I installed guile from git. Version gives me 2.1.0.526-7f710 Running Ubuntu 13.10 Processor: Intel Atom N450 Steps to reproduce: $ echo "(set-car! '(0 . ()) 1)" > test.scm $ guile > (load "test.scm") segfault Thanks Pieter From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 05 17:14:40 2013 Received: (at control) by debbugs.gnu.org; 5 Dec 2013 22:14:40 +0000 Received: from localhost ([127.0.0.1]:60612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VohBv-0000Xx-Qg for submit@debbugs.gnu.org; Thu, 05 Dec 2013 17:14:40 -0500 Received: from world.peace.net ([96.39.62.75]:38785) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VohBt-0000Xn-B5 for control@debbugs.gnu.org; Thu, 05 Dec 2013 17:14:37 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1VohBn-0005vg-C2; Thu, 05 Dec 2013 17:14:31 -0500 From: Mark H Weaver To: control@debbugs.gnu.org Date: Thu, 05 Dec 2013 17:13:31 -0500 Message-ID: <87wqjjj69g.fsf@netris.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: retitle 16060 Attempt to mutate a literal pair results in segfault (master) thanks [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: retitle 16060 Attempt to mutate a literal pair results in segfault (master) thanks [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject retitle 16060 Attempt to mutate a literal pair results in segfault (master) thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 05 18:05:36 2013 Received: (at 16060) by debbugs.gnu.org; 5 Dec 2013 23:05:36 +0000 Received: from localhost ([127.0.0.1]:60677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VohzC-0002ve-Cg for submit@debbugs.gnu.org; Thu, 05 Dec 2013 18:05:34 -0500 Received: from world.peace.net ([96.39.62.75]:38826) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vohz9-0002vT-8h for 16060@debbugs.gnu.org; Thu, 05 Dec 2013 18:05:32 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Vohz2-00064o-Om; Thu, 05 Dec 2013 18:05:24 -0500 From: Mark H Weaver To: Pieter Slabbert Subject: Re: bug#16060: Attempt to mutate a literal pair results in segfault (master) References: <52A0D66A.2070708@gmail.com> Date: Thu, 05 Dec 2013 18:04:25 -0500 In-Reply-To: <52A0D66A.2070708@gmail.com> (Pieter Slabbert's message of "Thu, 05 Dec 2013 21:39:22 +0200") Message-ID: <87siu6kih2.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16060 Cc: 16060@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Hi, Pieter Slabbert writes: > When I try to load a file which contains > (set-car! '(0 . ()) 1) > > Guile segfaults . > if I enter the same thing into the interpreter it works fine. According to the R5RS, it is "an error" to mutate literals, and implementations are not required to detect this error. In other words, the behavior is unspecified, like signed integer overflow in C. Currently, what happens is this: on the stable-2.0 branch, and in the interpreter on master, you are effectively modifying the code itself. In compiled code on master, literals are in read-only memory, which is why attempting to mutate it leads to a segfault. It is similar to what happens in C if you attempt to mutate a character in a string literal. Perhaps in 2.2.x we can support a debugging mode where compiled code adds extra checks, but this is a wishlist item. > I tried the same thing in chibi and it complained about try to mutate > an immutable pair. Fixed it in my code but the segfault made it a lot > harder to find > > I installed guile from git. Version gives me 2.1.0.526-7f710 The master branch of guile is very much a work-in-progress, with a major new implementation of the VM, compiler, and loader recently pushed. The ABI is not yet stabilized, which means that occasionally you may need to "make clean" and rebuild everything, including any external libraries that use libguile. For now, you might be happier with the 'stable-2.0' branch in git. Regards, Mark From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 05 18:06:09 2013 Received: (at control) by debbugs.gnu.org; 5 Dec 2013 23:06:10 +0000 Received: from localhost ([127.0.0.1]:60681 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vohzl-0002ws-Fm for submit@debbugs.gnu.org; Thu, 05 Dec 2013 18:06:09 -0500 Received: from world.peace.net ([96.39.62.75]:38828) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vohzj-0002wl-WC for control@debbugs.gnu.org; Thu, 05 Dec 2013 18:06:08 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Vohze-00065F-No; Thu, 05 Dec 2013 18:06:02 -0500 From: Mark H Weaver To: control@debbugs.gnu.org Date: Thu, 05 Dec 2013 18:05:03 -0500 Message-ID: <87ob4ukig0.fsf@netris.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: severity 16060 wishlist thanks [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: severity 16060 wishlist thanks [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject severity 16060 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 19 18:14:02 2023 Received: (at 16060) by debbugs.gnu.org; 19 Jul 2023 22:14:02 +0000 Received: from localhost ([127.0.0.1]:57223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMFQn-0005em-Kx for submit@debbugs.gnu.org; Wed, 19 Jul 2023 18:14:02 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:53589) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMFQh-0005e9-Kq for 16060@debbugs.gnu.org; Wed, 19 Jul 2023 18:14:00 -0400 Received: from [172.20.10.5] ([37.169.36.180]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.184]) with ESMTPSA (Nemesis) id 1M7KG2-1qGmJ63Ua4-007kdl for <16060@debbugs.gnu.org>; Thu, 20 Jul 2023 00:13:49 +0200 Message-ID: Subject: Re: bug#16060: Attempt to mutate a literal pair results in segfault (master) From: Jean Abou Samra To: 16060@debbugs.gnu.org Date: Thu, 20 Jul 2023 00:13:47 +0200 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-ZPkmMmYbvtOx0Di8lo7I" User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Provags-ID: V03:K1:GdjCQdmIgo85/BmgvDeABo9e9NzA81HsDAwA7QWCUXfVqcFcyPB 9HEJVbdCfl074By27l4NMnY/G9fLDgiW59EcgzRmUIUww8yLuQUK0Wrz1QdfoT132uWtGig yMqiGAZEvF/8kfl79X6Wf1DOd96QeUcQ2JduJznoe2iBRe8K3XhEXZp+adgCmSW2UMv5UKM jJjpG4Ivq8WyTEBENESNg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:Xk0epy1kaa8=;nDS5J50Jth7RE464zsxiYEqV25R ZgvOxLEe7QHVHt5ptD9qnnpoGy2rlcj9umwm1jNOpAyprkbZ66pTd3c9mRn/FMVU9G31ZApPo HGsKxFnNsmKqBLwt2QWeKTu87BfpfQNU2Wgt05D9T7pDOlbrrrpnAVzdbCC9PGxDFh7oZOZL2 4d42remeiRjOn+8KsMOp7kSh71Aw6Sv59dudWIU9wLo68XHwq7BaINpAjlUBU/or6CnLrvrn3 RHRqGv0UKczSQlzoGGnedIr6KaceQic9kYC1k3+UeOppCfeR0IrzB1OD75zfFtNBmWVocLoVT HutuOTKU0OI/QwOr6byKOrRWLMDEnkv4pJdnul+6m7Vf6mJUWoraLzXywM22qCifIZnsthXSY R8TDsFcFbRL0MWWlWwRHzbmqEwQrz+5ctzaqvPaYYVZfsv08iMbSfsKOdOVvKRdvJy8NjAr74 i3CuI8YPIaTziYFDdoUoLcGPvckp12DaK5XHYJApC3jYBY9puG/NiI2i2MyqEVRrcqSWep3CG AnO4yHRUVpGVwO0qFgXaAQaop6wTtP//d+QIr3j5jOFT+GZtFcQXg95zHt1QMrEjel9extfLl tG/AbMCF01GCjcde2a05C8mELH0I2vsR5i6v9pasRejjFwt3E4oK1DnyhbUZLzwUIOfVam/Sg y4FilcVSB9x647oOTiemgIzx9z8PAgB/XNhLqK0PCg== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 16060 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-ZPkmMmYbvtOx0Di8lo7I Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This is still happening with Guile 3.0, but only at -O2, not at -O1. $ cat x.scm=20 (set-car! '(1 . 2) 3) $ guild3.0 compile -O1 x.scm wrote `/home/jean/.cache/guile/ccache/3.0-LE-8-4.5/home/jean/tmp/x.scm.go' $ guile3.0 x.scm Backtrace: In ice-9/boot-9.scm: 1752:10 6 (with-exception-handler _ _ #:unwind? _ # _) In unknown file: 5 (apply-smob/0 #) In ice-9/boot-9.scm: 724:2 4 (call-with-prompt ("prompt") # =E2=80=A6) In ice-9/eval.scm: 619:8 3 (_ #(#(#))) In ice-9/boot-9.scm: 2835:4 2 (save-module-excursion #) 4380:12 1 (_) In x.scm: 1:0 0 (_) x.scm:1:0: In procedure set-car!: Wrong type argument in position 1 (expect= ing mutable pair): (1 . 2) $ guild3.0 compile -O2 x.scm wrote `/home/jean/.cache/guile/ccache/3.0-LE-8-4.5/home/jean/tmp/x.scm.go' $ guile3.0 x.scm Segmentation fault (core dumped) I found that module/language/cps/lower-primcalls.scm contains: ;; precondition: pair is mutable pair (define-primcall-lowerer (set-car! cps k src #f (pair val)) (with-cps cps (build-term ($continue k src ($primcall 'scm-set!/immediate '(pair . 0) (pair val)))))) which bypasses the check that the scm_set_car_x and scm_set_cdr_x functions do. I wonder if instead of checking the pair beforehand, Guile could just do the set-c(a|d)r! anyway. Could the problem with mmapped bytecode just be solved by adding PROT_WRITE to the mmap flags? (Or are there maybe thread-safety problems?) --=-ZPkmMmYbvtOx0Di8lo7I Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSZ7TKxnKGyBvBjzBmj8PYLiTOX/gUCZLhgGwAKCRCj8PYLiTOX /suIAP0X/4OBa3Yf0SyUdIg6kfZoAQ6SJR1tICxHJFYr/iSVGgEAojmVy0c3QPZw ETqo587SzzPYe9kFeOWU3Bt1UYzfRgA= =Yos1 -----END PGP SIGNATURE----- --=-ZPkmMmYbvtOx0Di8lo7I--