[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#25912: 2.1.7 segfaults on cygwin
From: |
szgyg |
Subject: |
bug#25912: 2.1.7 segfaults on cygwin |
Date: |
Thu, 2 Mar 2017 10:13:49 +0100 |
User-agent: |
Mutt/1.6.0 (2016-04-01) |
On Wed, Mar 01, 2017 at 05:47:30PM +0100, Andy Wingo wrote:
> On Wed 01 Mar 2017 11:27, szgyg <address@hidden> 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 address@hidden
$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;