Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/43164 )
Change subject: lib: Update ASan compiler flags and Kconfig help text ......................................................................
lib: Update ASan compiler flags and Kconfig help text
An additional compiler flag is added to make use of the shadow offset callback feature we introduced in our GCC patch. Also, a comment is added to tell user that this GCC patch needs to be applied in order to use ASan.
Change-Id: Ia187e4991bf808f4ae137eff0ffdb9baea0085e9 Signed-off-by: Harshit Sharma harshitsharmajs@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/43164 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Werner Zeh werner.zeh@siemens.com --- M src/Kconfig M src/lib/Makefile.inc 2 files changed, 7 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Werner Zeh: Looks good to me, approved
diff --git a/src/Kconfig b/src/Kconfig index 1540c56..f8af522 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -283,6 +283,11 @@
If unsure, say N.
+if ASAN_IN_RAMSTAGE + comment "Before using this feature, make sure that " + comment "asan_shadow_offset_callback patch is applied to GCC." +endif + choice prompt "Stage Cache for ACPI S3 resume" default NO_STAGE_CACHE if !HAVE_ACPI_RESUME diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index 0b43427..e33a449 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -9,7 +9,8 @@
ifeq ($(CONFIG_ASAN_IN_RAMSTAGE),y) ramstage-y += asan.c -CFLAGS_asan += -fsanitize=kernel-address \ +# Ensure that asan_shadow_offset_callback patch is applied to GCC before ASan is used. +CFLAGS_asan += -fsanitize=kernel-address --param asan-use-shadow-offset-callback=1 \ --param asan-stack=1 --param asan-globals=1 \ --param asan-instrumentation-with-call-threshold=0 \ -fsanitize-address-use-after-scope \