[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220704014046.34596-2-haibo.li@mediatek.com>
Date: Mon, 4 Jul 2022 09:40:45 +0800
From: Haibo Li <haibo.li@...iatek.com>
To: Sami Tolvanen <samitolvanen@...gle.com>
CC: <xiaoming.yu@...iatek.com>, Kees Cook <keescook@...omium.org>,
"Nathan Chancellor" <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
"Christophe Leroy" <christophe.leroy@...roup.eu>,
André Almeida <andrealmeid@...lia.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Juergen Gross <jgross@...e.com>,
Haibo Li <haibo.li@...iatek.com>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
Aaron Tomlin <atomlin@...hat.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
<linux-kernel@...r.kernel.org>, <llvm@...ts.linux.dev>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
Lecopzer Chen <lecopzer.chen@...iatek.com>
Subject: [PATCH v2 1/2] cfi: enable sanitize for cfi.c
currenly,cfi.c is excluded from cfi sanitize because of cfi handler.
The side effect is that we can not transfer function pointer to
other files which enable cfi sanitize.
Enable cfi sanitize for cfi.c and bypass cfi check for __cfi_slowpath_diag
Signed-off-by: Haibo Li <haibo.li@...iatek.com>
Signed-off-by: Lecopzer Chen <lecopzer.chen@...iatek.com>
---
kernel/Makefile | 3 ---
kernel/cfi.c | 2 +-
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/Makefile b/kernel/Makefile
index a7e1f49ab2b3..a997bef1a200 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -40,9 +40,6 @@ KCSAN_SANITIZE_kcov.o := n
UBSAN_SANITIZE_kcov.o := n
CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack) -fno-stack-protector
-# Don't instrument error handlers
-CFLAGS_REMOVE_cfi.o := $(CC_FLAGS_CFI)
-
obj-y += sched/
obj-y += locking/
obj-y += power/
diff --git a/kernel/cfi.c b/kernel/cfi.c
index 08102d19ec15..6c8ae07b5835 100644
--- a/kernel/cfi.c
+++ b/kernel/cfi.c
@@ -311,7 +311,7 @@ static inline cfi_check_fn find_check_fn(unsigned long ptr)
return fn;
}
-void __cfi_slowpath_diag(uint64_t id, void *ptr, void *diag)
+void __nocfi __cfi_slowpath_diag(u64 id, void *ptr, void *diag)
{
cfi_check_fn fn = find_check_fn((unsigned long)ptr);
--
2.25.1
Powered by blists - more mailing lists