|
Message-ID: <20170611180158.GS30784@example.net> Date: Sun, 11 Jun 2017 20:01:58 +0200 From: u-uy74@...ey.se To: musl@...ts.openwall.com Subject: more fun with non-Linux Linux ABI FWIIW: when running under Linux ABI on FreeBSD in musl-linked programs the child processes segfault right after a vfork(), before doing anything else: ----- #include <sys/types.h> #include <unistd.h> #include <stdio.h> #include <sys/wait.h> int main( int argc, char **argv ) { int s; pid_t pid = vfork(); if( !pid ){ _exit(0); } else { wait(&s); printf("vfork() = %d\n", pid); } fflush(stdout); _exit(0); } ----- 50124 ktrace RET ktrace 0 50124 ktrace CALL execve(0x7fffffffee4b,0x7fffffffec38,0x7fffffffec48) 50124 ktrace NAMI "./v" 50124 v RET linux_olduname 0 50124 v CALL linux_set_thread_area(0xffffcc6c) 50124 v RET linux_set_thread_area 0 50124 v CALL linux_set_tid_address(0x804d524) 50124 v RET linux_set_tid_address 50124/0xc3cc 50124 v CALL linux_vfork 50124 v RET linux_vfork 50125/0xc3cd 50125 v RET linux_fork 0 50125 v PSIG SIGSEGV SIG_DFL code=SEGV_MAPERR 50125 v NAMI "v.core" 50124 v CALL linux_wait4(0xffffffff,0xffffcd4c,0,0) 50124 v RET linux_wait4 50125/0xc3cd 50124 v CALL linux_ioctl(0x1,0x5413,0xffffcb04) 50124 v RET linux_ioctl 0 50124 v CALL linux_writev(0x1,0xffffcad4,0x2) 50124 v GIO fd 1 wrote 16 bytes "vfork() = 50125 " 50124 v RET linux_writev 16/0x10 50124 v CALL linux_exit_group(0) ----- Remarkably this apparently does not affect glibc-based builds (I have not tested right now but otherwise it would have been known). Wonder what makes the difference. Otherwise a simple workaround would be an option to make vfork() a fork() synonym while building musl. (I do the this at applications build time instead, which helps.) Such an option would most probably result in a pretty small performance impact on modern (native) Linux. Cheers, Rune
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.