ANDROID: GKI: Enable bounds sanitizer

Bounds sanitizer, a part of UndefinedBehaviorSanitizer (UBSan), inserts
run time bounds checks when accessing structs and arrays of constant
size known at compile time (e.g. in `foo[i]` for `char foo[8]`, `i` will
be checked to be not greater than 8).

The change have been tested to not have measurable performance impact.

Bug: 175004266
Signed-off-by: Elena Petrova <lenaptr@google.com>
Change-Id: Ie02ac1b210eeea05ad9bb0bae4b60660648ae776
This commit is contained in:
Elena Petrova
2020-12-07 16:23:01 +00:00
committed by Alistair Delva
parent aa21ac2d00
commit 9de75d9cb5
2 changed files with 16 additions and 0 deletions

View File

@@ -608,6 +608,14 @@ CONFIG_DEBUG_INFO_DWARF4=y
CONFIG_HEADERS_INSTALL=y
# CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
CONFIG_MAGIC_SYSRQ=y
CONFIG_UBSAN=y
CONFIG_UBSAN_TRAP=y
CONFIG_UBSAN_LOCAL_BOUNDS=y
# CONFIG_UBSAN_SHIFT is not set
# CONFIG_UBSAN_SIGNED_OVERFLOW is not set
# CONFIG_UBSAN_OBJECT_SIZE is not set
# CONFIG_UBSAN_BOOL is not set
# CONFIG_UBSAN_ENUM is not set
CONFIG_PAGE_OWNER=y
CONFIG_DEBUG_STACK_USAGE=y
CONFIG_DEBUG_MEMORY_INIT=y

View File

@@ -550,6 +550,14 @@ CONFIG_DEBUG_INFO_DWARF4=y
CONFIG_HEADERS_INSTALL=y
# CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
CONFIG_MAGIC_SYSRQ=y
CONFIG_UBSAN=y
CONFIG_UBSAN_TRAP=y
CONFIG_UBSAN_LOCAL_BOUNDS=y
# CONFIG_UBSAN_SHIFT is not set
# CONFIG_UBSAN_SIGNED_OVERFLOW is not set
# CONFIG_UBSAN_OBJECT_SIZE is not set
# CONFIG_UBSAN_BOOL is not set
# CONFIG_UBSAN_ENUM is not set
CONFIG_PAGE_OWNER=y
CONFIG_DEBUG_STACK_USAGE=y
CONFIG_DEBUG_MEMORY_INIT=y