From 2bd0afe05adb45a58435de690d6d8bc86f227247 Mon Sep 17 00:00:00 2001 From: Ramon Pantin Date: Mon, 2 Mar 2020 17:57:57 -0800 Subject: [PATCH] ANDROID: CC_FLAGS_CFI add -fno-sanitize-blacklist Added the clang compiler option -fno-sanitize-blacklist to the CC_FLAGS_CFI variable. Without this flag, the make dependecy list files produced by clang, have the cfi_blacklist.txt as their first dependency. The dependecy lists are produced by the -Wp,-MD,filename option (for example: -Wp,-MD,mm/.mmap.o.d). The dependency lists are processed by the scripts/basic/fixdeps.c program, and are transformed into the .o.cmd files (for example: mm/.mmap.o.cmd). That file is meant to have the source code of the file listed in the source_* make variable (for example: source_mm/mmap.o). Instead of that that variable refers to the full pathname to the cfi_blacklist.txt file. Furthermore, the deps_* make variable is not supposed to include the source code file but it does include it. The cfi_blacklist.txt file is not required by the use of CFI for the kernel, use of the -fno-sanitize-blacklist causes the .o.cmd file to have the correct values in its source_* and dep_* variables. Signed-off-by: Ramon Pantin Bug: 150504710 Test: interactively Change-Id: Ia9ed73cb9739617a7c928b939cb4b3a6d77723b7 --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7b270bd640c4..04ed3bc59a15 100644 --- a/Makefile +++ b/Makefile @@ -843,7 +843,8 @@ export LTO_CFLAGS DISABLE_LTO endif ifdef CONFIG_CFI_CLANG -cfi-clang-flags += -fsanitize=cfi -fno-sanitize-cfi-canonical-jump-tables +cfi-clang-flags += -fsanitize=cfi -fno-sanitize-cfi-canonical-jump-tables \ + -fno-sanitize-blacklist DISABLE_CFI_CLANG := -fno-sanitize=cfi ifdef CONFIG_MODULES cfi-clang-flags += -fsanitize-cfi-cross-dso