Kconfig: Update ASan config options

Instead of enabling ASAN_IN_ROMSTAGE from Kconfig file in a
platform's dedicated directory, let's introduce a new config
option HAVE_ASAN_IN_ROMSTAGE to denote if a given platform
supports ASan in romstage.

Similary, use HAVE_ASAN_IN_RAMSTAGE to indicate
if a given platform supports ASan in ramstage. Consequently, we
no longer have to make ASan x86 specific.

Change-Id: I36b144305465052718f245cacf61d3ca44dfb4b4
Signed-off-by: Harshit Sharma <harshitsharmajs@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44258
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
This commit is contained in:
Harshit Sharma 2020-08-05 21:16:31 -07:00 committed by Patrick Georgi
parent a6ebe08333
commit 0b1ec5ad77
1 changed files with 25 additions and 11 deletions

View File

@ -270,10 +270,31 @@ config UBSAN
say N because it adds a small performance penalty and may abort say N because it adds a small performance penalty and may abort
on code that happens to work in spite of the UB. on code that happens to work in spite of the UB.
config ASAN_IN_RAMSTAGE config HAVE_ASAN_IN_ROMSTAGE
bool "Address sanitizer support" bool
depends on ARCH_X86
default n default n
config ASAN_IN_ROMSTAGE
bool
default n
help
Enable address sanitizer in romstage for platform.
config HAVE_ASAN_IN_RAMSTAGE
bool
default n
config ASAN_IN_RAMSTAGE
bool
default n
help
Enable address sanitizer in ramstage for platform.
config ASAN
bool "Address sanitizer support"
default n
select ASAN_IN_ROMSTAGE if HAVE_ASAN_IN_ROMSTAGE
select ASAN_IN_RAMSTAGE if HAVE_ASAN_IN_RAMSTAGE
help help
Enable address sanitizer - runtime memory debugger, Enable address sanitizer - runtime memory debugger,
designed to find out-of-bounds accesses and use-after-scope bugs. designed to find out-of-bounds accesses and use-after-scope bugs.
@ -283,18 +304,11 @@ config ASAN_IN_RAMSTAGE
If unsure, say N. If unsure, say N.
if ASAN_IN_RAMSTAGE if ASAN
comment "Before using this feature, make sure that " comment "Before using this feature, make sure that "
comment "asan_shadow_offset_callback patch is applied to GCC." comment "asan_shadow_offset_callback patch is applied to GCC."
endif endif
config ASAN_IN_ROMSTAGE
bool
depends on ASAN_IN_RAMSTAGE
default n
help
Enable address sanitizer in romstage for platform.
choice choice
prompt "Stage Cache for ACPI S3 resume" prompt "Stage Cache for ACPI S3 resume"
default NO_STAGE_CACHE if !HAVE_ACPI_RESUME default NO_STAGE_CACHE if !HAVE_ACPI_RESUME