golang binaries fail to start under linux-user
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
With current master golang binaries fail when run under linux-user, for example:
[will@localhost qemu]$ ./arm-linux-
runtime: failed to create new OS thread (have 2 already; errno=22)
fatal error: newosproc
runtime stack:
runtime.
/usr/lib/
runtime.
/usr/lib/
runtime.
/usr/lib/
runtime.
/usr/lib/
runtime.
/usr/lib/
runtime.mstart()
/usr/lib/
goroutine 1 [running]:
runtime.
/usr/lib/
runtime.main()
/usr/lib/
runtime.goexit()
/usr/lib/
The reason for this is that the golang runtime does not pass the CLONE_SYSVMEM flag to clone so the clone flags checks fail:
https:/
The attached patch allows golang binaries to start under linux-user.
The problem with doing that is that it doesn't actually change the behaviour. We use pthread_create to create the new thread, which glibc does with a clone with CLONE_SYSVSEM set. We can't tell the difference between "guest program needs the new threads to not share SysV semaphore behaviour" and "guest program doesn't care but didn't provide the flag" so we err on the side of caution and refuse to create a thread that doesn't behave the way the guest asked us for it to behave.