-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcompiler-rt:asanAddress sanitizerAddress sanitizerllvm:transformsplatform:windows
Description
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:
char buff1[6] = "hello";
char buff2[6] = "hello";
int main(int argc, char **argv) {
int result = 1;
try {
throw 1;
} catch (...) {
// make asan generate call to __asan_memcpy that should report an error due to memory overflow.
__builtin_memcpy(buff1, buff2 + 3, 6);
result = 0;
}
return result;
}
See in Compiler Explorer: https://godbolt.org/z/Tacdhsz4T
Notice, in the LLVM Opt Pipeline Viewer, the WinEHPrepare pass of main: the entire catch Basic block and successors get transformed into a single unreachable statement.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcompiler-rt:asanAddress sanitizerAddress sanitizerllvm:transformsplatform:windows