summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHarshit Sharma <harshitsharmajs@gmail.com>2020-07-06 23:38:31 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-08-21 07:35:39 +0000
commit3b9cc859ff64a55cb6fbd247b1c2680d13716d91 (patch)
tree511fd9c7b64a592b804a0f7e7aff12e6e4636565 /src
parent2bcaba0fd4f61493a02f11ad01d0677164e2e86e (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/Kconfig5
-rw-r--r--src/lib/Makefile.inc3
2 files changed, 7 insertions, 1 deletions
diff --git a/src/Kconfig b/src/Kconfig
index 1540c567e4..f8af522823 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -283,6 +283,11 @@ config ASAN_IN_RAMSTAGE
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 0b4342764f..e33a44998c 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -9,7 +9,8 @@ endif
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 \