diff options
author | Alvin Wong <alvin@alvinhc.com> | 2023-04-23 23:42:21 +0800 |
---|---|---|
committer | Alvin Wong <alvin@alvinhc.com> | 2023-05-03 00:23:12 +0800 |
commit | 0d5b51e0ac885b6119e788cf6f0a6836c3908afc (patch) | |
tree | 0cbd5594579bb4a25f490c9608aa2200f62cf166 /llvm/unittests/Support/VirtualFileSystemTest.cpp | |
parent | e6ffd42a933e74e2b634e84ef8666483e53552f3 (diff) | |
download | llvm-0d5b51e0ac885b6119e788cf6f0a6836c3908afc.zip llvm-0d5b51e0ac885b6119e788cf6f0a6836c3908afc.tar.gz llvm-0d5b51e0ac885b6119e788cf6f0a6836c3908afc.tar.bz2 |
[sanitizer][asan][win] Only unmap unneeded shadow memory on x86_64
D21942 / 1128db8fe1c13800ebc77206efc50d0a219b8750 added support for
committing shadow memory on demand on Win 64-bit. The reason it is not
enabled on 32-bit wasn't clear but the page table overhead on Windows 7
may be a contributing factor.
In `AsanMapUnmapCallback::OnUnmap`, `FlushUnneededASanShadowMemory` is
called to release shadow memory. It calls `ReleaseMemoryPagesToOS`,
which had been a no-op on Windows, until D95892 /
81b1d3da094c54ffd75e05c8d4683792edf17f4c in which it was changed to
unmap full pages that the memory region covers. This was done on both
32-bit and 64-bit.
AddressSanitizerInterface.GetHeapSizeTest appears to fail on i686
targets as a side effect of this. This test allocates and frees a huge
chunk of memory which causes shadow memory to be unmapped immediately.
When the test allocates the chunk of memory a second time, asan tries to
reuse the same shadow memory region, but because the shadow memory has
now been unmapped, it causes an access violation and crashes the test.
x86_64 is not affected, because the code that handles commiting shadow
memory on demand also handles this situation, allowing the test to work
without crashing.
Therefore, this patch changes `FlushUnneededASanShadowMemory` on Windows
to only release/unmap the shadow memory on x86_64 to stop this from
happening on i686.
Differential Revision: https://reviews.llvm.org/D149025
Diffstat (limited to 'llvm/unittests/Support/VirtualFileSystemTest.cpp')
0 files changed, 0 insertions, 0 deletions