FROMLIST: 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

Change-Id: Id026c6becf074eb828e4b3d642ab791d6cedf82c
Signed-off-by: Haibo Li <haibo.li@mediatek.com>
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Link: https://lore.kernel.org/lkml/20220704014046.34596-2-haibo.li@mediatek.com/
Bug: 236922027
Bug: 257362811
[ Sami: Fixed ABI changes ]
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
Haibo Li
2022-07-04 09:40:45 +08:00
committed by Todd Kjos
parent 432cf292eb
commit 9b7bf9c529
2 changed files with 6 additions and 4 deletions

View File

@@ -41,9 +41,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/

View File

@@ -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)
static inline void __nocfi ___cfi_slowpath_diag(uint64_t id, void *ptr, void *diag)
{
cfi_check_fn fn = find_check_fn((unsigned long)ptr);
@@ -320,6 +320,11 @@ void __cfi_slowpath_diag(uint64_t id, void *ptr, void *diag)
else /* Don't allow unchecked modules */
handle_cfi_failure(ptr);
}
void __cfi_slowpath_diag(uint64_t id, void *ptr, void *diag)
{
___cfi_slowpath_diag(id, ptr, diag);
}
EXPORT_SYMBOL(__cfi_slowpath_diag);
#else /* !CONFIG_MODULES */