Add check for not-in-mapping addr for mmap. This will fix the
failure of SanitizerCommon-asan-x86_64-Linux::Linux/mmap_56bit_test.c
in machine that support 5-level paging. Without this check if user
try to mmap a address outside ASAN mapping, then ASAN will use that
address to calculate and get the invalid shadow memory address, which
then lead to SEGV.
Details
Details
- Reviewers
vitalybuka kstoimenov
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/asan/asan_interceptors.cpp | ||
---|---|---|
156 | Please check https://reviews.llvm.org/D154659#inline-1495335 Asan is suppose to work with prebuild non-instrumented code, so we are not as aggressive here. | |
compiler-rt/lib/asan/asan_mapping.h | ||
389 | we should not allow mapping in AddrIsInShadow |
Comment Actions
Asan is suppose to work with prebuild non-instrumented code, so we are not as aggressive here.
Yeah, I forgot about that. I guess if prebuild non-instrumented code are using mmap to operate memory regions outside ASAN mapping, as long as they keep those addresses to themselves(not passing those not-in-mapping addresses to instrumented code), then it will be fine.
However, there is no guarantee for that. But that looks like a dilemma to me.
Please check https://reviews.llvm.org/D154659#inline-1495335
Asan is suppose to work with prebuild non-instrumented code, so we are not as aggressive here.
Maybe it's fine if we update the check for protect_shadow_gap=0