-
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/cgo: panic from callbacks does not work with -fsanitize=address/thread #16150
Comments
@kubabrecka @ramosian-glider @kcc |
Checking out HEAD of keroserene/go-webrtc and running,
seems to produce it ~4% of the time for me. It's transient. But I guess you want an isolated test case ... |
@arlolra Does it happen without -race? I am surprised it works in some cases, asan and tsan are not supposed to be enabled at the same time. Clang/gcc should not allow that, but it is not detected in such inter-language configuration. |
I don't think |
Yes, but anecdotally less often.
"clang: error: invalid argument '-fsanitize=address' not allowed with '-fsanitize=thread'" I see.
Ok, good to know. Thanks all! |
I've tried to build it on linux with latest clang, and the build reasonably fails with lots of:
These symbols are in fact defined by asan and race runtimes. Without -race it seems to work. I run the test 12'000 times without failures. |
Thanks for looking into this.
If you look at the matrix I've been using, it's gcc on linux and clang on darwin. Guess that's why I didn't see the duplicate symbols failures.
Above I said I've only seen this with clang. I should have specified further, clang on darwin. Is that where you ran your tests? I made this commit yesterday to separate the asan and tsan runs. But, I'm still seeing it on occasion, both locally and in CI. |
For example, here's fresh failure from just now https://travis-ci.org/keroserene/go-webrtc/jobs/139634816 |
I've tested on linux. What version of clang are you using? |
|
@kubabrecka is it the latest clang on mac? |
I believe so, see: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions |
@dvyukov, what's the status here? |
I still can't reproduce this, but I think I know why it happens. The program panics from a cgo callback, this effectively does longjmp for C code and longjmp (and other noreturn functions) require special handling for asan/tsan (msan seems to be OK). I've added throw into unwindm and it fired here:
|
This also makes TestCallbackPanicLoop from misc/cgo crash with -fsanitize=thread. |
For asan we need to call |
@dvyukov The best idea I've come up with so far is to hook on to the current context parameter that is already passed through |
I was thinking about adding a runtime hook Re another asm function. I think we can reuse runtime·racecall, it can call any sanitizer function with up to 4 arguments. |
OK, your runtime hook sounds good to me. As far as I can see you can't reuse |
I meant to move it to asm_amd64.s and rename to not be race-specific. We will now need that piece of code for race, msan, tsan and asan, duplicating it 4 times does not make sense. And asan/tsan will be detected sort of at runtime in the init callback scheme, so we will need to compile it in unconditionally anyway. |
Unfortunately I did not have time today to work on this. Next week I am on a conference. Week after next I am in a business trip, not sure if I will have time to work on this. |
This had already been disabled for darwin because of keroserene#43 golang/go#16150. Upgrading the Travis dist from trusty to xenial also seems to cause an error on linux: keroserene#81 (comment)
This had already been disabled for darwin because of #43 golang/go#16150. Upgrading the Travis dist from trusty to xenial also seems to cause an error on linux: #81 (comment)
Until upstream resolves golang/go#16150 Fixes #95
Until upstream resolves golang/go#16150 Fixes #95
Until upstream resolves golang/go#16150 Fixes #95
Version:
go1.6 darwin/amd64
As far as I can tell, this is all that's happening:
In go,
In c++,
But maybe I'm missing something obvious.
Have a look,
https://travis-ci.org/keroserene/go-webrtc/jobs/139389584
I've only been able to reproduce this w/ clang.
/cc @dvyukov
The text was updated successfully, but these errors were encountered: