-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: signal handling: runtime bypasses TSAN/MSAN sigaction interceptors #17753
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
Comments
Thinking about this some more, I think the right fix is to do something along the lines of Here's my reasoning: I expect that a lot of Go users have more control over which Go version they're using than over their C compiler, and it's easier to build a fresh-from-source Go toolchain than a fresh-from-source C toolchain if they're in an environment that tends to significantly lag upstream releases. Hooking the runtime potentially fixes it across all C toolchains in a way that Go users can control more easily. |
Sounds good to me. |
I agree that routing through the C library Note: on GNU/Linux the |
I'm wondering about the general question of how many syscalls should
a cgo program uses the libc version and not calling the syscall directly.
for example, I remember there is (was) an issue about making transparent
socks proxy work by using libc socket functions rather than issuing syscall
directly.
Where should we draw the line?
|
@minux One point to draw the line would be between "bug" and "feature". The |
Is someone going to work on this for Go 1.8? |
I've got a change pending, but I've hit a couple snags during testing. (I may need some help sorting out a bad interaction between |
CL https://golang.org/cl/33142 mentions this issue. |
go version devel +09bb643 Wed Nov 2 20:49:58 2016 +0000 linux/amd64
What did you do?
What did you expect to see?
The test should pass (as it does without the
-fsanitize=thread
flags).What did you see instead?
It appears that TSAN and MSAN replace the libc
sigaction
function with their own versions, and whensigaction
is called they return the rememberedstruct sigaction
previously passed to the libc function rather than calling all the way down to the OS.One possible fix would be to make TSAN and MSAN make a real
sigaction
syscall to verify the actual handler before returning the cached one.Another would be to make the Go runtime use the libc
sigaction
function (instead of making the system call directly from Go) when the sanitizers are in use (e.g. as we do today formmap
viax_cgo_mmap
).The text was updated successfully, but these errors were encountered: