From: szgyg <szgyg@ludens.elte.hu>
To: Andy Wingo <wingo@pobox.com>
Cc: 25912@debbugs.gnu.org
Subject: bug#25912: 2.1.7 segfaults on cygwin
Date: Thu, 2 Mar 2017 10:13:49 +0100 [thread overview]
Message-ID: <20170302091349.GC4544@debbie.mshome.net> (raw)
In-Reply-To: <87a895djvh.fsf@pobox.com>
On Wed, Mar 01, 2017 at 05:47:30PM +0100, Andy Wingo wrote:
> On Wed 01 Mar 2017 11:27, szgyg <szgyg@ludens.elte.hu> 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;
next prev parent reply other threads:[~2017-03-02 9:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <78221352.340980.1488551525340.ref@mail.yahoo.com>
2017-03-01 10:27 ` bug#25912: 2.1.7 segfaults on cygwin szgyg
2017-03-01 16:47 ` Andy Wingo
2017-03-02 9:13 ` szgyg [this message]
2017-03-06 19:41 ` Andy Wingo
2017-03-08 16:50 ` szgyg
2017-03-03 14:32 ` Mike Gran
2017-03-14 11:35 ` Andy Wingo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170302091349.GC4544@debbie.mshome.net \
--to=szgyg@ludens.elte.hu \
--cc=25912@debbugs.gnu.org \
--cc=wingo@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).