From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: szgyg Newsgroups: gmane.lisp.guile.bugs Subject: bug#25912: 2.1.7 segfaults on cygwin Date: Thu, 2 Mar 2017 10:13:49 +0100 Message-ID: <20170302091349.GC4544@debbie.mshome.net> References: <20170301102709.GB4544@debbie.mshome.net> <87a895djvh.fsf@pobox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1488472997 20910 195.159.176.226 (2 Mar 2017 16:43:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 2 Mar 2017 16:43:17 +0000 (UTC) User-Agent: Mutt/1.6.0 (2016-04-01) Cc: 25912@debbugs.gnu.org To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Mar 02 17:43:10 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 1cjTor-0004b3-S7 for guile-bugs@m.gmane.org; Thu, 02 Mar 2017 17:43:09 +0100 Original-Received: from localhost ([::1]:53272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjTox-0002w9-SP for guile-bugs@m.gmane.org; Thu, 02 Mar 2017 11:43:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjToq-0002tq-42 for bug-guile@gnu.org; Thu, 02 Mar 2017 11:43:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjTok-0000mw-Fp for bug-guile@gnu.org; Thu, 02 Mar 2017 11:43:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38552) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjTok-0000mq-Ba for bug-guile@gnu.org; Thu, 02 Mar 2017 11:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cjTok-000073-5R for bug-guile@gnu.org; Thu, 02 Mar 2017 11:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: szgyg Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 02 Mar 2017 16:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25912 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 25912-submit@debbugs.gnu.org id=B25912.1488472946380 (code B ref 25912); Thu, 02 Mar 2017 16:43:02 +0000 Original-Received: (at 25912) by debbugs.gnu.org; 2 Mar 2017 16:42:26 +0000 Original-Received: from localhost ([127.0.0.1]:36750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjTo9-000064-Iz for submit@debbugs.gnu.org; Thu, 02 Mar 2017 11:42:26 -0500 Original-Received: from mx3.mail.elte.hu ([157.181.1.138]:45366) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjMmX-0004Ds-C5 for 25912@debbugs.gnu.org; Thu, 02 Mar 2017 04:12:17 -0500 Original-Received: from mailbox1.caesar.elte.hu ([157.181.151.157]) by mx3.mail.elte.hu with esmtp (Exim) id 1cjMmV-0005K1-9E from ; Thu, 02 Mar 2017 10:12:16 +0100 Original-Received: (Authenticated sender: szgyg) by mailbox1.caesar.elte.hu with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cjMmT-0000fW-GI; Thu, 02 Mar 2017 10:12:13 +0100 Content-Disposition: inline In-Reply-To: <87a895djvh.fsf@pobox.com> X-ELTE-SpamScore: -6.7 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 3.0 X-ELTE-SpamCheck-Details: score=-6.7 required=5.0 tests=ALL_TRUSTED, BAYES_00, L_AUTH, RP_MATCHES_RCVD autolearn=ham autolearn_force=no SpamAssassin version=3.4.0 -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -5.0 L_AUTH Caesar auth -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.1 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Mailman-Approved-At: Thu, 02 Mar 2017 11:42:25 -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:8648 Archived-At: On Wed, Mar 01, 2017 at 05:47:30PM +0100, Andy Wingo wrote: > On Wed 01 Mar 2017 11:27, szgyg writes: > > > I got two identical segfaults from make -j2 on 32-bit cygwin, and > > three identical segfaults from make -j3 on 64-bit at the same point. > > > > Any idea? > > Could it be some mprotect issue? static-patch is a bytecode that is > used when doing run-time relocations in the .go files, when they are > first loaded up. They are loaded by loader.c. I usually use the mmap > path; is that being used on cygwin? Is it reliable? There is a > fallback path that doesn't use any memory protection. See loader.c. Thanks. load_thunk_from_memory doesn't call mprotect because in loader.c line 436 the ELF segment is aligned to 4k while page size is 64k. 436 if (ph[i].p_align != page_size) (gdb) print page_size $3 = 65536 (gdb) print ph[i].p_align $4 = 4096 (gdb) print *ph@n $2 = { {p_type = 1, p_offset = 0, p_vaddr = 0, p_paddr = 0, p_filesz = 50264, p_memsz = 50264, p_flags = 4, p_align = 4096}, {p_type = 1, p_offset = 53248, p_vaddr = 53248, p_paddr = 53248, p_filesz = 1944, p_memsz = 1944, p_flags = 6, p_align = 4096}, {p_type = 2, p_offset = 50208, p_vaddr = 50208, p_paddr = 50208, p_filesz = 56, p_memsz = 56, p_flags = 4, p_align = 8} } I have applied the patch below as a workaround, and now I can compile guile. --- origsrc/guile-2.1.7/libguile/loader.c 2017-01-08 23:38:55.000000000 +0100 +++ src/guile-2.1.7/libguile/loader.c 2017-03-01 21:57:35.114163900 +0100 @@ -475,7 +475,7 @@ map_file_contents (int fd, size_t len, i char *data; #ifdef HAVE_SYS_MMAN_H - data = mmap (NULL, len, PROT_READ, MAP_PRIVATE, fd, 0); + data = mmap (NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); if (data == MAP_FAILED) SCM_SYSERROR; *is_read_only = 1;