diff options
author | Harshit Sharma <harshitsharmajs@gmail.com> | 2020-06-09 20:25:16 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-08-21 07:35:07 +0000 |
commit | 2bcaba0fd4f61493a02f11ad01d0677164e2e86e (patch) | |
tree | 8e9a40326efc6917611e99e79874fd536060d54a /src/lib/Makefile.inc | |
parent | 693f4a417984849cdb68d176ca162f477275ac3f (diff) |
lib: Add ASan stub
Add a Kconfig option to enable address sanitizer on x86 architecture.
Create ASan dummy functions. And add relevant gcc flags to compile
ramstage with ASan.
Change-Id: I6d87e48b6786f02dd46ea74e702f294082fd8891
Signed-off-by: Harshit Sharma <harshitsharmajs@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42271
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Diffstat (limited to 'src/lib/Makefile.inc')
-rw-r--r-- | src/lib/Makefile.inc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index 72d4f2414c..0b4342764f 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -7,6 +7,18 @@ ramstage-y += ubsan.c CFLAGS_ramstage += -fsanitize=undefined endif +ifeq ($(CONFIG_ASAN_IN_RAMSTAGE),y) +ramstage-y += asan.c +CFLAGS_asan += -fsanitize=kernel-address \ + --param asan-stack=1 --param asan-globals=1 \ + --param asan-instrumentation-with-call-threshold=0 \ + -fsanitize-address-use-after-scope \ + --param use-after-scope-direct-emission-threshold=0 +CFLAGS_ramstage += $(CFLAGS_asan) +# Allow memory access without __asan_load and __asan_store checks. +$(obj)/ramstage/lib/asan.o: CFLAGS_asan = +endif + decompressor-y += decompressor.c $(call src-to-obj,decompressor,$(dir)/decompressor.c): $(objcbfs)/bootblock.lz4 $(call src-to-obj,decompressor,$(dir)/decompressor.c): CCACHE_EXTRAFILES=$(objcbfs)/bootblock.lz4 |