mailing list of musl libc
 help / color / mirror / code / Atom feed
* pthread_getattr_np doing loads of mremaps on ARM, MIPS under QEMU user-mode
@ 2017-06-15 13:08 Tobias Koch
  2017-06-15 14:19 ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Tobias Koch @ 2017-06-15 13:08 UTC (permalink / raw)
  To: musl

Hi,

running under QEMU user mode, Ruby 2.4 (and it seems also Guile) ARM and 
MIPS binaries take a long time to start and eventually crash. The long 
startup seems to come from this loop

   while (mremap(p-l-PAGE_SIZE, PAGE_SIZE, 2*PAGE_SIZE, 0)==MAP_FAILED 
&& errno==ENOMEM)
           l += PAGE_SIZE;

being executed hundreds of times in pthread_getattr_np. Any idea what 
this could be about except from maybe being a QEMU bug?

The subsequent crash then occurs after memory set aside by alloca is 
accessed. I think this may be unrelated.

Tobias


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthread_getattr_np doing loads of mremaps on ARM, MIPS under QEMU user-mode
  2017-06-15 13:08 pthread_getattr_np doing loads of mremaps on ARM, MIPS under QEMU user-mode Tobias Koch
@ 2017-06-15 14:19 ` Rich Felker
  2017-06-15 20:01   ` Tobias Koch
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2017-06-15 14:19 UTC (permalink / raw)
  To: musl

On Thu, Jun 15, 2017 at 04:08:03PM +0300, Tobias Koch wrote:
> Hi,
> 
> running under QEMU user mode, Ruby 2.4 (and it seems also Guile) ARM
> and MIPS binaries take a long time to start and eventually crash.
> The long startup seems to come from this loop
> 
>   while (mremap(p-l-PAGE_SIZE, PAGE_SIZE, 2*PAGE_SIZE,
> 0)==MAP_FAILED && errno==ENOMEM)
>           l += PAGE_SIZE;
> 
> being executed hundreds of times in pthread_getattr_np. Any idea
> what this could be about except from maybe being a QEMU bug?

This is not particularly unusual (it's the best way we could find to
measure the initial thread's stack size), but it's possible that qemu
user mode is botching emulation of mremap and thus resulting in a
wrong stack size being reported. Can you send a full strace (qemu-arm
-strace, maybe also real strace of the qemu process with the host
strace utility) log of the crash? That will probably shed some light
on what's happening.

> The subsequent crash then occurs after memory set aside by alloca is
> accessed. I think this may be unrelated.

It seems plausible that it's related or that it's unrelated.

Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthread_getattr_np doing loads of mremaps on ARM, MIPS under QEMU user-mode
  2017-06-15 14:19 ` Rich Felker
@ 2017-06-15 20:01   ` Tobias Koch
  2017-06-21  0:41     ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Tobias Koch @ 2017-06-15 20:01 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 587 bytes --]

> This is not particularly unusual (it's the best way we could find to 
> measure the initial thread's stack size), but it's possible that qemu 
> user mode is botching emulation of mremap and thus resulting in a 
> wrong stack size being reported. Can you send a full strace (qemu-arm 
> -strace, maybe also real strace of the qemu process with the host 
> strace utility) log of the crash? That will probably shed some light 
> on what's happening.
attached recorded via

strace -o host-strace-qemu.log /usr/bin/qemu-arm-static -strace 
/usr/bin/ruby2.4 > qemu-strace-ruby.log 2>&1




[-- Attachment #2: host-strace-qemu.log --]
[-- Type: text/plain, Size: 31185 bytes --]

execve("/usr/bin/qemu-arm-static", ["/usr/bin/qemu-arm-static", "-strace", "/usr/bin/ruby2.4"], [/* 11 vars */]) = 0
uname({sysname="Linux", nodename="debian", ...}) = 0
brk(NULL)                               = 0x625d7000
brk(0x625d8240)                         = 0x625d8240
arch_prctl(ARCH_SET_FS, 0x625d7900)     = 0
set_tid_address(0x625d7bd0)             = 13641
set_robust_list(0x625d7be0, 24)         = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x60148540, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x601485d0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlink("/proc/self/exe", "/usr/bin/qemu-arm-static", 4096) = 24
brk(0x625f9240)                         = 0x625f9240
brk(0x625fa000)                         = 0x625fa000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7fbd678ff000
mprotect(0x7fbd678ff000, 4096, PROT_NONE) = 0
clone(child_stack=0x7fbd680fedf0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7fbd680ff9d0, tls=0x7fbd680ff700, child_tidptr=0x7fbd680ff9d0) = 13642
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
gettimeofday({tv_sec=1497554487, tv_usec=346263}, NULL) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
time(NULL)                              = 1497554487
open("/etc/qemu-binfmt/arm", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
uname({sysname="Linux", nodename="debian", ...}) = 0
brk(0x6261b000)                         = 0x6261b000
mmap(NULL, 528384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbd6787e000
mprotect(0x6054f000, 33550336, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
mprotect(0x6254e000, 4096, PROT_NONE)   = 0
madvise(0x6054fe30, 33546704, MADV_HUGEPAGE) = -1 EINVAL (Invalid argument)
mmap(NULL, 23261184, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbd6624f000
brk(0x6263c000)                         = 0x6263c000
brk(0x6263b000)                         = 0x6263b000
mmap(NULL, 4143972352, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7fbc6f24f000
mmap(0x7fbd6f23f000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbd6f23f000
mprotect(0x7fbd6f23f000, 4096, PROT_READ) = 0
open("/proc/sys/vm/mmap_min_addr", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
read(3, "65536\n", 1024)                = 6
close(3)                                = 0
gettid()                                = 13641
open("/usr/bin/ruby2.4", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=5332, ...}) = 0
geteuid()                               = 1000
getegid()                               = 1000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\2\0(\0\1\0\0\0\24\6\1\0004\0\0\0"..., 1024) = 1024
mmap(0x7fbc6f25f000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x7fbc6f25f000
mmap(0x7fbc6f26f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x7fbc6f26f000
close(3)                                = 0
mmap(0x7fbd65a4e000, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fbd65a4e000
mprotect(0x7fbd65a4e000, 4096, PROT_NONE) = 0
open("/usr/lib/ld-musl-arm.so.1", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\2104\7\0004\0\0\0"..., 1024) = 1024
mmap(0x7fbd65998000, 745472, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7fbd65998000
mmap(0x7fbd65998000, 667648, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x7fbd65998000
mmap(0x7fbd65a4a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xa2000) = 0x7fbd65a4a000
mmap(0x7fbd65a4c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fbd65a4c000
close(3)                                = 0
getuid()                                = 1000
geteuid()                               = 1000
getgid()                                = 1000
getegid()                               = 1000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigaction(SIGHUP, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGINT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGILL, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGILL, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGTRAP, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTRAP, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGABRT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGABRT, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGFPE, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGFPE, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGKILL, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGKILL, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = -1 EINVAL (Invalid argument)
rt_sigaction(SIGUSR1, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGUSR1, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGSEGV, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGUSR2, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGUSR2, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGPIPE, NULL, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGALRM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGALRM, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGSTKFLT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSTKFLT, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGCHLD, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGCONT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSTOP, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTSTP, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTTIN, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTTOU, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGURG, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGXCPU, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGXCPU, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGXFSZ, NULL, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGXFSZ, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGVTALRM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGVTALRM, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGPROF, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGPROF, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGWINCH, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGIO, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGIO, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGPWR, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGPWR, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGSYS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSYS, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_32, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_32, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_2, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_2, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_3, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_3, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_4, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_4, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_5, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_5, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_6, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_6, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_7, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_7, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_8, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_8, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_9, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_9, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_10, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_10, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_11, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_11, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_12, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_12, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_13, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_13, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_14, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_14, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_15, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_15, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_16, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_16, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_17, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_17, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_18, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_18, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_19, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_19, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_20, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_20, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_21, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_21, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_22, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_22, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_23, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_23, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_24, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_24, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_25, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_25, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_26, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_26, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_27, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_27, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_28, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_28, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_29, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_29, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_30, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_30, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
rt_sigaction(SIGRT_31, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGRT_31, {sa_handler=0x6004d160, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x6014f220}, NULL, 8) = 0
arch_prctl(ARCH_SET_GS, 0x7fbc6f24f000) = 0
brk(0x6265c000)                         = 0x6265c000
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "set_tid_address(-159391760,-1597"..., 73) = 73
set_tid_address(0x7fbd65a4cff0)         = 13641
write(2, " = 13641\n", 9)               = 9
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "open(", 5)                    = 5
write(2, "\"/usr/etc/ld-musl-arm.path\",", 28) = 28
write(2, "O_RDONLY", 8)                 = 8
write(2, "|", 1)                        = 1
write(2, "O_LARGEFILE", 11)             = 11
write(2, "|O_CLOEXEC", 10)              = 10
write(2, ")", 1)                        = 1
openat(AT_FDCWD, "/usr/etc/ld-musl-arm.path", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, " = -1 errno=2 (No such file or d"..., 42) = 42
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "open(", 5)                    = 5
write(2, "\"/usr/lib/libruby-2.4.so.2.4\",", 30) = 30
write(2, "O_RDONLY", 8)                 = 8
write(2, "|", 1)                        = 1
write(2, "O_LARGEFILE", 11)             = 11
write(2, "|O_CLOEXEC", 10)              = 10
write(2, ")", 1)                        = 1
openat(AT_FDCWD, "/usr/lib/libruby-2.4.so.2.4", O_RDONLY|O_CLOEXEC) = 3
write(2, " = 3\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "fcntl64(", 8)                 = 8
write(2, "3,", 2)                       = 2
write(2, "F_SETFD,", 8)                 = 8
write(2, "1", 1)                        = 1
write(2, ")", 1)                        = 1
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "fstat64(", 8)                 = 8
write(2, "3,", 2)                       = 2
write(2, "0xf6fff860", 10)              = 10
write(2, ")", 1)                        = 1
fstat(3, {st_mode=S_IFREG|0755, st_size=2252572, ...}) = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "read(3,0xf6fff460,936)", 22)  = 22
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\220\264\1\0004\0\0\0"..., 936) = 936
write(2, " = 936\n", 7)                 = 7
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mmap2(", 6)                   = 6
write(2, "NULL,", 5)                    = 5
write(2, "2342912,", 8)                 = 8
write(2, "PROT_EXEC", 9)                = 9
write(2, "|PROT_READ", 10)              = 10
write(2, ",", 1)                        = 1
write(2, "MAP_PRIVATE", 11)             = 11
write(2, ",", 1)                        = 1
write(2, "3,", 2)                       = 2
write(2, "0", 1)                        = 1
write(2, ")", 1)                        = 1
mmap(0x7fbd6575c000, 2342912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fbd6575c000
mmap(0x7fbd6575c000, 2342912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x7fbd6575c000
write(2, " = 0xf650d000\n", 14)         = 14
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mmap2(", 6)                   = 6
write(2, "0xf673e000,", 11)             = 11
write(2, "45056,", 6)                   = 6
write(2, "PROT_READ", 9)                = 9
write(2, "|PROT_WRITE", 11)             = 11
write(2, ",", 1)                        = 1
write(2, "MAP_PRIVATE", 11)             = 11
write(2, "|MAP_FIXED", 10)              = 10
write(2, ",", 1)                        = 1
write(2, "3,", 2)                       = 2
write(2, "0x221", 5)                    = 5
write(2, ")", 1)                        = 1
mmap(0x7fbd6598d000, 45056, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x221000) = 0x7fbd6598d000
write(2, " = 0xf673e000\n", 14)         = 14
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mmap2(", 6)                   = 6
write(2, "0xf6743000,", 11)             = 11
write(2, "24576,", 6)                   = 6
write(2, "PROT_READ", 9)                = 9
write(2, "|PROT_WRITE", 11)             = 11
write(2, ",", 1)                        = 1
write(2, "MAP_PRIVATE", 11)             = 11
write(2, "|MAP_ANONYMOUS", 14)          = 14
write(2, "|MAP_FIXED", 10)              = 10
write(2, ",", 1)                        = 1
write(2, "-1,", 3)                      = 3
write(2, "0", 1)                        = 1
write(2, ")", 1)                        = 1
mmap(0x7fbd65992000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fbd65992000
write(2, " = 0xf6743000\n", 14)         = 14
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "close(3)", 8)                 = 8
close(3)                                = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "open(", 5)                    = 5
write(2, "\"/usr/lib/libgmp.so.10\",", 24) = 24
write(2, "O_RDONLY", 8)                 = 8
write(2, "|", 1)                        = 1
write(2, "O_LARGEFILE", 11)             = 11
write(2, "|O_CLOEXEC", 10)              = 10
write(2, ")", 1)                        = 1
openat(AT_FDCWD, "/usr/lib/libgmp.so.10", O_RDONLY|O_CLOEXEC) = 3
write(2, " = 3\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "fcntl64(", 8)                 = 8
write(2, "3,", 2)                       = 2
write(2, "F_SETFD,", 8)                 = 8
write(2, "1", 1)                        = 1
write(2, ")", 1)                        = 1
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "fstat64(", 8)                 = 8
write(2, "3,", 2)                       = 2
write(2, "0xf6fff860", 10)              = 10
write(2, ")", 1)                        = 1
fstat(3, {st_mode=S_IFREG|0755, st_size=396032, ...}) = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "read(3,0xf6fff460,936)", 22)  = 22
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0@\205\0\0004\0\0\0"..., 936) = 936
write(2, " = 936\n", 7)                 = 7
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mmap2(", 6)                   = 6
write(2, "NULL,", 5)                    = 5
write(2, "462848,", 7)                  = 7
write(2, "PROT_EXEC", 9)                = 9
write(2, "|PROT_READ", 10)              = 10
write(2, ",", 1)                        = 1
write(2, "MAP_PRIVATE", 11)             = 11
write(2, ",", 1)                        = 1
write(2, "3,", 2)                       = 2
write(2, "0", 1)                        = 1
write(2, ")", 1)                        = 1
mmap(0x7fbd656eb000, 462848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fbd656eb000
mmap(0x7fbd656eb000, 462848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x7fbd656eb000
write(2, " = 0xf649c000\n", 14)         = 14
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mmap2(", 6)                   = 6
write(2, "0xf650b000,", 11)             = 11
write(2, "8192,", 5)                    = 5
write(2, "PROT_READ", 9)                = 9
write(2, "|PROT_WRITE", 11)             = 11
write(2, ",", 1)                        = 1
write(2, "MAP_PRIVATE", 11)             = 11
write(2, "|MAP_FIXED", 10)              = 10
write(2, ",", 1)                        = 1
write(2, "3,", 2)                       = 2
write(2, "0x5f", 4)                     = 4
write(2, ")", 1)                        = 1
mmap(0x7fbd6575a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x5f000) = 0x7fbd6575a000
write(2, " = 0xf650b000\n", 14)         = 14
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "close(3)", 8)                 = 8
close(3)                                = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mprotect(", 9)                = 9
write(2, "0xf673e000,", 11)             = 11
write(2, "12288,", 6)                   = 6
write(2, "PROT_READ", 9)                = 9
write(2, ")", 1)                        = 1
mprotect(0x7fbd6598d000, 12288, PROT_READ) = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mprotect(", 9)                = 9
write(2, "0xf650b000,", 11)             = 11
write(2, "4096,", 5)                    = 5
write(2, "PROT_READ", 9)                = 9
write(2, ")", 1)                        = 1
mprotect(0x7fbd6575a000, 4096, PROT_READ) = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mprotect(", 9)                = 9
write(2, "0xf67fb000,", 11)             = 11
write(2, "4096,", 5)                    = 5
write(2, "PROT_READ", 9)                = 9
write(2, ")", 1)                        = 1
mprotect(0x7fbd65a4a000, 4096, PROT_READ) = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mprotect(", 9)                = 9
write(2, "0x00020000,", 11)             = 11
write(2, "4096,", 5)                    = 5
write(2, "PROT_READ", 9)                = 9
write(2, ")", 1)                        = 1
mprotect(0x7fbc6f26f000, 4096, PROT_READ) = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "fstat64(", 8)                 = 8
write(2, "0,", 2)                       = 2
write(2, "0xf6fffd08", 10)              = 10
write(2, ")", 1)                        = 1
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 6), ...}) = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "fstat64(", 8)                 = 8
write(2, "1,", 2)                       = 2
write(2, "0xf6fffd08", 10)              = 10
write(2, ")", 1)                        = 1
fstat(1, {st_mode=S_IFREG|0644, st_size=1266, ...}) = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "fstat64(", 8)                 = 8
write(2, "2,", 2)                       = 2
write(2, "0xf6fffd08", 10)              = 10
write(2, ")", 1)                        = 1
fstat(2, {st_mode=S_IFREG|0644, st_size=1298, ...}) = 0
write(2, " = 0\n", 5)                   = 5
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mremap(-151003136,4096,8192,0,0,"..., 43) = 43
write(2, " = -1 errno=12 (Cannot allocate "..., 40) = 40
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mremap(-151007232,4096,8192,0,0,"..., 43) = 43
write(2, " = -1 errno=12 (Cannot allocate "..., 40) = 40
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mremap(-151011328,4096,8192,0,0,"..., 43) = 43
write(2, " = -1 errno=12 (Cannot allocate "..., 40) = 40
.
.
.
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mremap(0,4096,8192,0,0,-15939142"..., 34) = 34
mremap(0x7fbc6f24f000, 4096, 8192, 0)   = -1 ENOMEM (Out of memory)
write(2, " = -1 errno=12 (Cannot allocate "..., 40) = 40
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "mremap(-4096,4096,8192,0,0,-1593"..., 38) = 38
mremap(0x7fbd6f24e000, 4096, 8192, 0)   = -1 EFAULT (Bad address)
write(2, " = -1 errno=14 (Bad address)\n", 29) = 29
getpid()                                = 13641
write(2, "13641 ", 6)                   = 6
write(2, "prlimit64(0,3,0,-150995952,-1509"..., 49) = 49
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
write(2, " = 0\n", 5)                   = 5
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR, si_addr=0x7fbc6f2500d8} ---
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], NULL, 8) = 0
write(2, "--- ", 4)                     = 4
write(2, "SIGSEGV", 7)                  = 7
write(2, " ", 1)                        = 1
write(2, "{si_signo=", 10)              = 10
write(2, "SIGSEGV", 7)                  = 7
write(2, ", si_code=", 10)              = 10
write(2, "1", 1)                        = 1
write(2, ", si_addr = ", 12)            = 12
write(2, "0x000010d8", 10)              = 10
write(2, "}", 1)                        = 1
write(2, " ---\n", 5)                   = 5
getrlimit(RLIMIT_CORE, {rlim_cur=0, rlim_max=RLIM64_INFINITY}) = 0
getrlimit(RLIMIT_CORE, {rlim_cur=0, rlim_max=RLIM64_INFINITY}) = 0
setrlimit(RLIMIT_CORE, {rlim_cur=0, rlim_max=RLIM64_INFINITY}) = 0
futex(0x6256db80, FUTEX_WAKE_PRIVATE, 2147483647) = 0
write(2, "qemu: uncaught target signal 11 "..., 67) = 67
rt_sigaction(SIGSEGV, {sa_handler=SIG_DFL, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x6014f220}, NULL, 8) = 0
getpid()                                = 13641
kill(13641, SIGSEGV)                    = 0
rt_sigsuspend(~[SEGV RTMIN RT_1], 8)    = ? ERESTARTNOHAND (To be restarted if no handler)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SI_USER, si_pid=13641, si_uid=1000} ---
+++ killed by SIGSEGV +++

[-- Attachment #3: qemu-strace-ruby.log --]
[-- Type: text/plain, Size: 2026 bytes --]

13641 set_tid_address(-159391760,-159706348,1,-159391412,-159391788,-150995520) = 13641
13641 open("/usr/etc/ld-musl-arm.path",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 errno=2 (No such file or directory)
13641 open("/usr/lib/libruby-2.4.so.2.4",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
13641 fcntl64(3,F_SETFD,1) = 0
13641 fstat64(3,0xf6fff860) = 0
13641 read(3,0xf6fff460,936) = 936
13641 mmap2(NULL,2342912,PROT_EXEC|PROT_READ,MAP_PRIVATE,3,0) = 0xf650d000
13641 mmap2(0xf673e000,45056,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,3,0x221) = 0xf673e000
13641 mmap2(0xf6743000,24576,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0xf6743000
13641 close(3) = 0
13641 open("/usr/lib/libgmp.so.10",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
13641 fcntl64(3,F_SETFD,1) = 0
13641 fstat64(3,0xf6fff860) = 0
13641 read(3,0xf6fff460,936) = 936
13641 mmap2(NULL,462848,PROT_EXEC|PROT_READ,MAP_PRIVATE,3,0) = 0xf649c000
13641 mmap2(0xf650b000,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,3,0x5f) = 0xf650b000
13641 close(3) = 0
13641 mprotect(0xf673e000,12288,PROT_READ) = 0
13641 mprotect(0xf650b000,4096,PROT_READ) = 0
13641 mprotect(0xf67fb000,4096,PROT_READ) = 0
13641 mprotect(0x00020000,4096,PROT_READ) = 0
13641 fstat64(0,0xf6fffd08) = 0
13641 fstat64(1,0xf6fffd08) = 0
13641 fstat64(2,0xf6fffd08) = 0
13641 mremap(-151003136,4096,8192,0,0,-159391424) = -1 errno=12 (Cannot allocate memory)
13641 mremap(-151007232,4096,8192,0,0,-159391424) = -1 errno=12 (Cannot allocate memory)
13641 mremap(-151011328,4096,8192,0,0,-159391424) = -1 errno=12 (Cannot allocate memory)
.
.
.
13641 mremap(4096,4096,8192,0,0,-159391424) = -1 errno=12 (Cannot allocate memory)
13641 mremap(0,4096,8192,0,0,-159391424) = -1 errno=12 (Cannot allocate memory)
13641 mremap(-4096,4096,8192,0,0,-159391424) = -1 errno=14 (Bad address)
13641 prlimit64(0,3,0,-150995952,-150995952,-159391424) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=1, si_addr = 0x000010d8} ---
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthread_getattr_np doing loads of mremaps on ARM, MIPS under QEMU user-mode
  2017-06-15 20:01   ` Tobias Koch
@ 2017-06-21  0:41     ` Rich Felker
  2017-06-24 22:05       ` Tobias Koch
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2017-06-21  0:41 UTC (permalink / raw)
  To: musl

On Thu, Jun 15, 2017 at 11:01:48PM +0300, Tobias Koch wrote:
> >This is not particularly unusual (it's the best way we could find
> >to measure the initial thread's stack size), but it's possible
> >that qemu user mode is botching emulation of mremap and thus
> >resulting in a wrong stack size being reported. Can you send a
> >full strace (qemu-arm -strace, maybe also real strace of the qemu
> >process with the host strace utility) log of the crash? That will
> >probably shed some light on what's happening.
> attached recorded via
> 
> strace -o host-strace-qemu.log /usr/bin/qemu-arm-static -strace
> /usr/bin/ruby2.4 > qemu-strace-ruby.log 2>&1
> 
> [...]
> 
> 13641 set_tid_address(-159391760,-159706348,1,-159391412,-159391788,-150995520) = 13641
> 13641 open("/usr/etc/ld-musl-arm.path",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 errno=2 (No such file or directory)
> 13641 open("/usr/lib/libruby-2.4.so.2.4",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
> 13641 fcntl64(3,F_SETFD,1) = 0
> 13641 fstat64(3,0xf6fff860) = 0
> 13641 read(3,0xf6fff460,936) = 936
> 13641 mmap2(NULL,2342912,PROT_EXEC|PROT_READ,MAP_PRIVATE,3,0) = 0xf650d000
> 13641 mmap2(0xf673e000,45056,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,3,0x221) = 0xf673e000
> 13641 mmap2(0xf6743000,24576,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0xf6743000
> 13641 close(3) = 0
> 13641 open("/usr/lib/libgmp.so.10",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
> 13641 fcntl64(3,F_SETFD,1) = 0
> 13641 fstat64(3,0xf6fff860) = 0
> 13641 read(3,0xf6fff460,936) = 936
> 13641 mmap2(NULL,462848,PROT_EXEC|PROT_READ,MAP_PRIVATE,3,0) = 0xf649c000
> 13641 mmap2(0xf650b000,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,3,0x5f) = 0xf650b000
> 13641 close(3) = 0
> 13641 mprotect(0xf673e000,12288,PROT_READ) = 0
> 13641 mprotect(0xf650b000,4096,PROT_READ) = 0
> 13641 mprotect(0xf67fb000,4096,PROT_READ) = 0
> 13641 mprotect(0x00020000,4096,PROT_READ) = 0
> 13641 fstat64(0,0xf6fffd08) = 0
> 13641 fstat64(1,0xf6fffd08) = 0
> 13641 fstat64(2,0xf6fffd08) = 0
> 13641 mremap(-151003136,4096,8192,0,0,-159391424) = -1 errno=12 (Cannot allocate memory)
> 13641 mremap(-151007232,4096,8192,0,0,-159391424) = -1 errno=12 (Cannot allocate memory)
> 13641 mremap(-151011328,4096,8192,0,0,-159391424) = -1 errno=12 (Cannot allocate memory)
> .
> .
> .
> 13641 mremap(4096,4096,8192,0,0,-159391424) = -1 errno=12 (Cannot allocate memory)
> 13641 mremap(0,4096,8192,0,0,-159391424) = -1 errno=12 (Cannot allocate memory)
> 13641 mremap(-4096,4096,8192,0,0,-159391424) = -1 errno=14 (Bad address)

OK, qemu-user is just emulating mremap very poorly. The man page
documents that it fails with EFAULT when the address passed is not
valid, but qemu seems to be giving ENOMEM, which has a different
meaning. I remember we looked hard when this was first implemented to
find an acceptable/safe way to probe for valid pages, so I doubt we'll
find a better or equally good way that both works around the bug in
qemu-user and does the right thing on all real kernels. I think the
qemu bug should just be reported and fixed.

Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthread_getattr_np doing loads of mremaps on ARM, MIPS under QEMU user-mode
  2017-06-21  0:41     ` Rich Felker
@ 2017-06-24 22:05       ` Tobias Koch
  2017-06-24 22:18         ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Tobias Koch @ 2017-06-24 22:05 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]

Hi,

thank you! And yes, you are absolutely right. QEMU always fails in 
mmap.c after looking at page flags in the extended memory range:

         int prot = 0;
         if (reserved_va && old_size < new_size) {
             abi_ulong addr;
             for (addr = old_addr + old_size;
                  addr < old_addr + new_size;
                  addr++) {
                 prot |= page_get_flags(addr);
             }
         }
         if (prot == 0) {
             host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
             if (host_addr != MAP_FAILED && reserved_va && old_size > new_size) {
                 mmap_reserve(old_addr + old_size, new_size - old_size);
             }
         } else {
	    /* musl's pthread_getattr_np always fails here doing mremaps: */
  	    errno = ENOMEM;
             host_addr = MAP_FAILED;
         }

I wonder why it cannot just try the remap directly and use the result of 
that, but that's clearly a question for the QEMU people.

Tobias


On 21/06/2017 03:41, Rich Felker wrote:
> [...]
> OK, qemu-user is just emulating mremap very poorly. The man page
> documents that it fails with EFAULT when the address passed is not
> valid, but qemu seems to be giving ENOMEM, which has a different
> meaning. I remember we looked hard when this was first implemented to
> find an acceptable/safe way to probe for valid pages, so I doubt we'll
> find a better or equally good way that both works around the bug in
> qemu-user and does the right thing on all real kernels. I think the
> qemu bug should just be reported and fixed.
>
> Rich


[-- Attachment #2: Type: text/html, Size: 2388 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthread_getattr_np doing loads of mremaps on ARM, MIPS under QEMU user-mode
  2017-06-24 22:05       ` Tobias Koch
@ 2017-06-24 22:18         ` Rich Felker
  0 siblings, 0 replies; 6+ messages in thread
From: Rich Felker @ 2017-06-24 22:18 UTC (permalink / raw)
  To: musl

On Sun, Jun 25, 2017 at 01:05:52AM +0300, Tobias Koch wrote:
> Hi,
> 
> thank you! And yes, you are absolutely right. QEMU always fails in
> mmap.c after looking at page flags in the extended memory range:
> 
>         int prot = 0;
>         if (reserved_va && old_size < new_size) {
>             abi_ulong addr;
>             for (addr = old_addr + old_size;
>                  addr < old_addr + new_size;
>                  addr++) {
>                 prot |= page_get_flags(addr);
>             }
>         }
>         if (prot == 0) {
>             host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
>             if (host_addr != MAP_FAILED && reserved_va && old_size > new_size) {
>                 mmap_reserve(old_addr + old_size, new_size - old_size);
>             }
>         } else {
> 	    /* musl's pthread_getattr_np always fails here doing mremaps: */
>  	    errno = ENOMEM;
>             host_addr = MAP_FAILED;
>         }
> 
> I wonder why it cannot just try the remap directly and use the
> result of that, but that's clearly a question for the QEMU people.

They can't try to mremap arbitrary addresses in the emulated address
space without first translating them to the host address space. When
page_get_flags fails they probably need to be generating EFAULT
themselves or something.

Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-06-24 22:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15 13:08 pthread_getattr_np doing loads of mremaps on ARM, MIPS under QEMU user-mode Tobias Koch
2017-06-15 14:19 ` Rich Felker
2017-06-15 20:01   ` Tobias Koch
2017-06-21  0:41     ` Rich Felker
2017-06-24 22:05       ` Tobias Koch
2017-06-24 22:18         ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).