-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime: go 1.6 segfault with musl libc #14476
Comments
Looks like a nil pointer dereference, but we don't know where it is happening. Can you run the executable under gdb, and see what it says about where the signal occurs? Try to get a backtrace. |
interesting. could you please run go under gdb and see where does it crash? I wonder if this is related to musl libc. Does gofmt (which should be a The ldd output looks wrong too. At least bin/go should link to libc.so @bradfitz, we might need to run a musl-based builder. |
|
gofmt is fine, but statically linked.
|
I can't spot anything wrong. With musl, libpthread, like other libraries, are all bundled into a single library. That includes the dynamic linker: http://wiki.musl-libc.org/wiki/Design_Concepts#Unified_libc.2Flibpthread.2Fldso However, I've just tested Go 1.6 on the musl version of Void Linux and cannot reproduce the segfault. It is a 64 bit machine, unlike OP's 32 bit. |
dominikh, thanks for confirming. I cannot reproduce this on amd64 either, same kernel version on same distribution with same version musl. |
Ahh, thanks for the info.
Is there a musl i386 VM image that I can use to reproduce this?
|
minux, alpine 386 image would be appropriate I should think: http://www.alpinelinux.org/downloads/ get the non 64 bit one. of course,that will have grsec, and will make debugging harder . but once it installs you can install the vanilla kernel |
Thanks. Reproduced.
|
I tried two programs. bin/go fails in runtime.sched_getaffinity (the very first syscall): Program received signal SIGSEGV, Segmentation fault. It's because musl doesn't put vsyscall entry point in %gs:0x10. An externally linked hello world program couldn't even start: Program received signal SIGSEGV, Segmentation fault. Something is wrong with the relocations. |
CL https://golang.org/cl/19833 mentions this issue. |
Including patch to fix 386 build. golang/go#14476 Removed default-sc-getpw-r-size-max.patch, fixed upstream. golang/go#11319 Changed the offset for no-pic.patch to match new code. TT: pkgrel set to 1 as the original pkgrel=0 failed to build with x86 and was reverted.
Sorry, I think I'm late to the game, but I may also seeing this on linux/amd64? I'm trying to build https://github.com/mattes/migrate (which depends upon https://github.com/mattn/go-sqlite3, which has some CGO, but I don't know what to look for), and everything builds fine, but I'm getting segfaults as well by doing:
The 1.6.0-alpine image is based on alpine3.3, so maybe this can be replicated using http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86_64/alpine-3.3.1-x86_64.iso? Here are the strace and GDB results:
Output from running
|
@cyli The fix for this issue is on tip but is not in 1.6. If you have a different problem, please open a new issue. This one is closed. Thanks. |
@ianlancetaylor The fix on tip seems to be for 386 only and I am seeing this in amd64. I am happy to open a new issue though! |
please file a new issue for amd64. thanks.
|
CL https://golang.org/cl/22038 mentions this issue. |
Like bionic, musl also doesn't provide vsyscall helper in %gs:0x10, and as int $0x80 is as fast as calling %gs:0x10, just use int $0x80 always. Because we're no longer using vsyscall in VDSO, get rid of VDSO code for linux/386 too. Fixes #14476. Change-Id: I00ec8652060700e0a3c9b524bfe3c16a810263f6 Reviewed-on: https://go-review.googlesource.com/19833 Run-TryBot: Minux Ma <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-on: https://go-review.googlesource.com/22038 Reviewed-by: Brad Fitzpatrick <[email protected]>
Is this supposed to be resolved in 1.6.2? I'm still facing similar segfault issues when using go-sqlite3. |
@sheldonkwok This issue is believed to be fixed in 1.6.2. If you are having trouble, please open a new issue. A segfault can have many possible causes. |
I am attempting to compile go 1.6 from a go 1.4.3 bootstrap. The build environment is Alpine linux 3.3.1 with the vanilla (i.e., no grsec) 4.1.15 kernel. The libc is musl. Go gets compiled using the build.bash script, and no errors are thrown. However, the resulting binary gives a segmentation fault whenever I attempt to use it.
This same environment has no problems compiling go 1.5.3 from source. My other alpine 3.3.1 VM with amd64 also has no issues compiling / running 1.5.3 or 1.6, even with the grsec kernel.
Any thoughts?
The text was updated successfully, but these errors were encountered: