diff options
author | Kostya Serebryany <kcc@google.com> | 2013-12-11 14:26:41 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2013-12-11 14:26:41 +0000 |
commit | 183590d46e44e59ab58b807fd60acb8f145f3464 (patch) | |
tree | 2cf531ea34d08ecb1be773a1abdd4c4a8cbf76d4 /lib/asan/asan_poisoning.cc | |
parent | 21aedb6e552cb18b48be973c0e2088a0440f29d7 (diff) | |
download | compiler-rt-183590d46e44e59ab58b807fd60acb8f145f3464.tar.gz |
[asan] when a fake stack is being unmapped also flush the corresponding shadow
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197040 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_poisoning.cc')
-rw-r--r-- | lib/asan/asan_poisoning.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/asan/asan_poisoning.cc b/lib/asan/asan_poisoning.cc index 28b22751c..a4e6c0a23 100644 --- a/lib/asan/asan_poisoning.cc +++ b/lib/asan/asan_poisoning.cc @@ -50,6 +50,15 @@ struct ShadowSegmentEndpoint { } }; +void FlushUnneededASanShadowMemory(uptr p, uptr size) { + // Since asan's mapping is compacting, the shadow chunk may be + // not page-aligned, so we only flush the page-aligned portion. + uptr page_size = GetPageSizeCached(); + uptr shadow_beg = RoundUpTo(MemToShadow(p), page_size); + uptr shadow_end = RoundDownTo(MemToShadow(p + size), page_size); + FlushUnneededShadowMemory(shadow_beg, shadow_end - shadow_beg); +} + } // namespace __asan // ---------------------- Interface ---------------- {{{1 |