Skip to content

Commit

Permalink
[Review] core: asan: KASAN and ASLR are incompatible
Browse files Browse the repository at this point in the history
When squashing I will replace the commit message with the following:

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 offset becomes invalid because of the random ASLR offset.

For KASAN to work with ASLR, we would need to either keep the shadow
area at the expected offset (which is may not be very easy, I have not
investigated in more details) or provide the shadow offset dynamically.
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
jforissier committed Aug 28, 2023
1 parent 7395e18 commit c92dc1c
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit c92dc1c

Please sign in to comment.