GNU bug report logs -
#25912
2.1.7 segfaults on cygwin
Previous Next
Reported by: szgyg <szgyg <at> ludens.elte.hu>
Date: Wed, 1 Mar 2017 11:05:02 UTC
Severity: normal
Found in version 2.1.7
Done: Andy Wingo <wingo <at> pobox.com>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 25912 <at> debbugs.gnu.org (full text, mbox):
On Wed, Mar 01, 2017 at 05:47:30PM +0100, Andy Wingo wrote:
> On Wed 01 Mar 2017 11:27, szgyg <szgyg <at> 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 <at> 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;
This bug report was last modified 8 years and 69 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.