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/race: Race detector test fails on grsec kernels #6787
Comments
We seem to be specifying MAP_FIXED when trying to allocate at particular address. Please check with strace what exactly syscall fails. Or do you want to say that we need to try to allocate w/o MAP_FIXED if MAP_FIXED fails? Labels changed: added racedetector. Owner changed to @dvyukov. |
Comment 2 by wizeman@wizy.org: Actually, it seems mmap() on those addresses fail with ENOMEM because grsec kernels with UDEREF protection on amd64 reduce the available virtual address space to 42 bits (as opposed to 47 bits on a default Linux kernel). I suppose it's not easy to change (i.e configure or patch) the addresses which ThreadSanitizer mmaps? The code seems to come from LLVM, right? BTW, how do I know which LLVM tag/commit does the ThreadSanitizer code distributed as a binary blob in the source tarball come from? It doesn't seem to be documented in go/src/pkg/runtime/race/README. |
LLVM rev on which the binary is built is present in latest src/pkg/runtime/race/README files. Otherwise it must be noted in commit messages: https://code.google.com/p/go/source/browse/src/pkg/runtime/race/README Yes, the code comes from LLVM. It's not that it's very difficult to changes the mappings, but it is somewhat tricky. We have 4 different mappings: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform.h?view=markup The mapping is fixed during build. If you want to rebuild runtime, you need to run the following script: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/go/buildgo.sh?view=markup it will give you race_linux_amd64.syso, which you can copy to Go tree. |
Is there any interest in this issues? I am inclined to close as it is not particularly actionable. |
non-actionable |
Is there a solution/work-around to this bug? I'm running a grsec kernel and keep running into:
This happens for quite a few libraries including go-sqlite3. This makes it nearly impossible to develop Go on a grsec kernel. |
This isn't really non-actionable. Go could ask for a RANDMMAP exception by applying the appropriate extended attribute to the executable it builds if it knows it's going to be required (i.e. sanitizers are used). It's as simple as Ideally, the sanitizers wouldn't make these non-portable assumptions about the address space. There's absolutely no guarantee of it working on all configurations of future upstream Linux kernel versions either. I really wouldn't expect that to be considered an ABI break. Making an assumption that the address space is a precise size is as bad as a program breaking if |
@dmix does the setfattr command help? |
@dvyukov I'm not sure which binary to set flags on TBH. Since the error happens while installing go-sqlite3, not running it. I tried running strace to see which binaries get called during install and tried running setfattr on a few of them but no luck: https://gist.github.com/dmix/5a6e3fb75372876a7c2e Including:
Any idea which binaries need to be flagged? |
@dmix you need to run strace with -f flag to trace subprocesses Also, I don't understand how race detector is involved if you run just 'go install'. Have you done 'go install -race std'? |
Here is strace -f output https://gist.github.com/dmix/f47f304c40e1d331ea5d I tried set the flags on all binaries in /usr/lib/go/ subdirectories. I havent installed race std, I'm pretty much using a clean install of go via archlinux repo: https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/go |
The binary that crashes is cgo:
I don't understand why it is race-enabled. |
@dvyukov output of nm -A https://gist.github.com/dmix/10361e8a3d9acab00927 I ran |
Yes, it is race-enabled. And it is wrong. There is something wrong with the way you build Go. |
I manually downloaded Go from Arch repo here: https://www.archlinux.org/packages/community/x86_64/go/ Compared my local I downloaded I'll get in touch with the Arch package maintainers to see why they are packaging it with race enabled. |
I'm pretty sure they have made the same mistake that our
makerelease script made (it used to generate Go 1.4 binary
distributions with race-enabled commands.)
It's not trivial to install race packages while not installing race
enabled cmmands in Go 1.4.x.
one workaround is https://golang.org/cl/2995
|
by wizeman@wizy.org:
The text was updated successfully, but these errors were encountered: