-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Asan with Windows EH generates __asan_xxx runtime calls without required funclet tokens #64990
Comments
@llvm/issue-subscribers-bug |
This is true, this was the intended behavior. The thinking was:
It's the kind of error recovery that only a compiler engineer would think is reasonable ("What do you do when something impossible happens, abort and report an error? No, just delete the code, the impossible can't happen!"), but that's what we did, I can't really defend it too strongly. We could certainly revise the decision. The smallest most incremental change would be to replace the call with a trap followed by unreachable, which won't propagate backwards. |
Thanks for the explanation! I intended the scope of this issue to be limited to the bug where asan doesn't add a required funclet opbundle, causing UB. A patch is currently in review for this, which simply adds the missing opbundle. I wanted to isolate this bug as a new issue, as I realized that the patch I mentioned doesn't entirely fix the issues where it was described in the comments (#39667 and google/sanitizers#749). This way I could close this issue after the patch lands. |
…ality Previously, when ASan instrumentation introduced runtime calls into EH pads, the appropriate funclet token expected by WinEHPrepare were missing. The BB is then seen as invalid and discard by WinEHPrepare, leading to invalid code that crashes. Also fixed localescape test, switching its EH personality to match code without funclets. This PR is based on the Phabricator patch https://reviews.llvm.org/D143108 Fixes llvm#64990
…ality Previously, when ASan instrumentation introduced runtime calls into EH pads, the appropriate funclet token expected by WinEHPrepare were missing. The BB is then seen as invalid and discard by WinEHPrepare, leading to invalid code that crashes. Also fixed localescape test, switching its EH personality to match code without funclets. This PR is based on the Phabricator patch https://reviews.llvm.org/D143108 Fixes llvm#64990
…ality Previously, when ASan instrumentation introduced runtime calls into EH pads, the appropriate funclet token expected by WinEHPrepare were missing. The BB is then seen as invalid and discard by WinEHPrepare, leading to invalid code that crashes. Also fixed localescape test, switching its EH personality to match code without funclets. This PR is based on the Phabricator patch https://reviews.llvm.org/D143108 Fixes llvm#64990
…ality Previously, when ASan instrumentation introduced runtime calls into EH pads, the appropriate funclet token expected by WinEHPrepare were missing. The BB is then seen as invalid and discard by WinEHPrepare, leading to invalid code that crashes. Also fixed localescape test, switching its EH personality to match code without funclets. This PR is based on the Phabricator patch https://reviews.llvm.org/D143108 Fixes llvm#64990
…by EH personality (#82533) Previously, runtime calls introduced by ASan instrumentation into EH pads were missing the funclet token expected by WinEHPrepare. WinEHPrepare would then identify the containing BB as invalid and discard it, causing invalid code generation that most likely crashes. Also fixed localescape test, switching its EH personality to match code without funclets. This PR is based on the Phabricator patch https://reviews.llvm.org/D143108 Fixes #64990
This issue has been discussed in #39667 as well as google/sanitizers#749
As mentionned by @rnk in a comment: "ASan instrumentation isn't inserting calls into EH pads with the right funclet token bundle, so any attempts to do ASan checks inside funclets will be removed by WinEHPrepare. "
It seems that not only WinEHPrepare will remove the calls themselves but it also discards the entire Basic Block around it, replacing the content with
unreachable
statement.Here is a repro:
See in Compiler Explorer: https://godbolt.org/z/Tacdhsz4T
Notice, in the
LLVM Opt Pipeline Viewer
, theWinEHPrepare
pass ofmain
: the entirecatch
Basic block and successors get transformed into a singleunreachable
statement.The text was updated successfully, but these errors were encountered: