diff options
| author | Karl-Johan Karlsson <karl-johan.karlsson@ericsson.com> | 2019-10-30 07:45:39 +0100 |
|---|---|---|
| committer | Karl-Johan Karlsson <karl-johan.karlsson@ericsson.com> | 2019-10-30 09:32:19 +0100 |
| commit | 760ed8da98e3c4cd80e92bbdcc78c181f36f71d4 (patch) | |
| tree | 56d4113da037f37fe623bcf4643689227727d7bf /llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | |
| parent | f15cf93899df3e8863207b40c3900facb0ccc356 (diff) | |
| download | bcm5719-llvm-760ed8da98e3c4cd80e92bbdcc78c181f36f71d4.tar.gz bcm5719-llvm-760ed8da98e3c4cd80e92bbdcc78c181f36f71d4.zip | |
[AddressSanitizer] Only instrument globals of default address space
The address sanitizer ignore memory accesses from different address
spaces, however when instrumenting globals the check for different
address spaces is missing. This result in assertion failure. The fault
was found in an out of tree target.
The patch skip all globals of non default address space.
Reviewed By: leonardchan, vitalybuka
Differential Revision: https://reviews.llvm.org/D68790
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index d92ee11c2e1..554def59af1 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -1808,6 +1808,8 @@ bool ModuleAddressSanitizer::ShouldInstrumentGlobal(GlobalVariable *G) { if (GlobalsMD.get(G).IsBlacklisted) return false; if (!Ty->isSized()) return false; if (!G->hasInitializer()) return false; + // Only instrument globals of default address spaces + if (G->getAddressSpace()) return false; if (GlobalWasGeneratedByCompiler(G)) return false; // Our own globals. // Two problems with thread-locals: // - The address of the main thread's copy can't be computed at link-time. |

