-
Notifications
You must be signed in to change notification settings - Fork 707
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
Unix: Avoid concurrency hazard in signal handler registration #5272
Unix: Avoid concurrency hazard in signal handler registration #5272
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @llvm-beanz! I was about to ping this in a few minutes as we've been looking forward to integrating the latest DXC with this fix hopefully addressing this issue, but would also like to discuss enabling asserts more broadly: what is your thought on that? Should I create a new discussion item for it? |
Several static functions from the signal API can be invoked simultaneously; RemoveFileOnSignal for instance can be called indirectly by multiple parallel loadModule() invocations, which might lead to the assertion: Assertion failed: (NumRegisteredSignals < array_lengthof(RegisteredSignalInfo) && "Out of space for signal handlers!"), function RegisterHandler, file /llvm/lib/Support/Unix/Signals.inc, line 105. RemoveFileOnSignal calls RegisterHandlers(), which isn't currently mutex protected, leading to the behavior above. This potentially affect a few other users of RegisterHandlers() too. rdar://problem/30381224 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298871 91177308-0d34-0410-b5e6-96231b3b80d8
f0f585a
to
9fc8942
Compare
I think it kinda depends what you mean. DXC converts some asserts to exceptions (which I hate), and other asserts get compiled out in Release builds, but we have a CMake option to enable them. We don't really use GitHub discussions. Filing an issue might be the best forum for a discussion. |
Meant an issue (separate from this PR), discussion boards are disabled for this project.
Simply said I think it's worthwhile to have those retained, by changing the default of this CMake option to always be enabled. |
The 30-second answer to this is no, we won't do that. Enabling asserts has a significant negative impact on performance for LLVM because it enables a bunch of validation checks that can be expensive. |
Okay. Will see how much it impacts our build times as we have quite a few shaders, and maybe compile the library with that enabled for our own consumption: we've ran into far too many bugs and issues to not have asserts. |
Fixes #5271
backported from llvm-mirror/llvm@fa92ec8
Note that this doesn't touch a similar possible race condition for
UnregisterHandlers()
.Several static functions from the signal API can be invoked simultaneously; RemoveFileOnSignal for instance can be called indirectly by multiple parallel loadModule() invocations, which might lead to the assertion:
Assertion failed: (NumRegisteredSignals < array_lengthof(RegisteredSignalInfo) && "Out of space for signal handlers!"),
function RegisterHandler, file /llvm/lib/Support/Unix/Signals.inc, line 105.
RemoveFileOnSignal calls RegisterHandlers(), which isn't currently mutex protected, leading to the behavior above. This potentially affect a few other users of RegisterHandlers() too.
rdar://problem/30381224
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298871 91177308-0d34-0410-b5e6-96231b3b80d8