Skip to content

Commit

Permalink
cfi: print target address on failure
Browse files Browse the repository at this point in the history
Bug: 78862212
Bug: 67506682
Change-Id: Ifaa3e3f8fc5f19649f4857d185d50383b4a89055
Signed-off-by: Sami Tolvanen <[email protected]>
  • Loading branch information
samitolvanen authored and pundiramit committed Aug 28, 2018
1 parent a9f1777 commit aee4744
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions kernel/cfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#define cfi_slowpath_handler __cfi_slowpath
#endif /* CONFIG_CFI_PERMISSIVE */

static inline void handle_cfi_failure()
static inline void handle_cfi_failure(void *ptr)
{
#ifdef CONFIG_CFI_PERMISSIVE
WARN_RATELIMIT(1, "CFI failure:\n");
WARN_RATELIMIT(1, "CFI failure (target: [<%px>] %pF):\n", ptr, ptr);
#else
pr_err("CFI failure:\n");
pr_err("CFI failure (target: [<%px>] %pF):\n", ptr, ptr);
BUG();
#endif
}
Expand Down Expand Up @@ -283,18 +283,18 @@ void cfi_slowpath_handler(uint64_t id, void *ptr, void *diag)
if (likely(check))
check(id, ptr, diag);
else /* Don't allow unchecked modules */
handle_cfi_failure();
handle_cfi_failure(ptr);
}
EXPORT_SYMBOL(cfi_slowpath_handler);
#endif /* CONFIG_MODULES */

void cfi_failure_handler(void *data, void *value, void *vtable)
void cfi_failure_handler(void *data, void *ptr, void *vtable)
{
handle_cfi_failure();
handle_cfi_failure(ptr);
}
EXPORT_SYMBOL(cfi_failure_handler);

void __cfi_check_fail(void *data, void *value)
void __cfi_check_fail(void *data, void *ptr)
{
handle_cfi_failure();
handle_cfi_failure(ptr);
}

0 comments on commit aee4744

Please sign in to comment.