Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: asan: KASAN and ASLR are incompatible
The address sanitizer shadow offset address is given at compile time (CFG_ASAN_SHADOW_OFFSET) and is hard-coded by the compiler into the prologue of instrumented functions, for the purpose of initializing the shadow area for the stack (local variables). With ASLR turned on, this address becomes invalid because of the random ASLR offset. For KASAN to work with ASLR, we would need to be able to provide the shadow offset dynamically, translating CFG_ASAN_SHADOW_OFFSET to the proper VA including the ASLR offset. An attempt was made three years ago to extend the GCC compiler with such a feature [1] but there was no feedback from the maintainers [2]. Add a check in mk/config.mk so that KASAN and ASLR may not be enabled simultaneously. Link: https://blogs.coreboot.org/blog/2020/08/31/gsoc-address-sanitizer-wrap-up/ [1] Link: https://gcc.gnu.org/pipermail/gcc-patches/2020-July/550176.html [2] Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
- Loading branch information