objtool: Disable CFI warnings
JIRA: https://issues.redhat.com/browse/RHEL-255 Conflicts: tools/objtool/check.c - cs-9 already has upstream 9440155ccb94 ("ftrace: Add HAVE_DYNAMIC_FTRACE_NO_PATCHABLE"), which introduced __patchable_function_entries commit 3c68a92d17add767109441f4040391b9e8a14a98 Author: Sami Tolvanen <samitolvanen@google.com> Date: Thu Sep 8 14:54:59 2022 -0700 objtool: Disable CFI warnings The __cfi_ preambles contain a mov instruction that embeds the KCFI type identifier in the following format: ; type preamble __cfi_function: mov <id>, %eax function: ... While the preamble symbols are STT_FUNC and contain valid instructions, they are never executed and always fall through. Skip the warning for them. .kcfi_traps sections point to CFI traps in text sections. Also skip the warning about them referencing !ENDBR instructions. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Tested-by: Kees Cook <keescook@chromium.org> Tested-by: Nathan Chancellor <nathan@kernel.org> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20220908215504.3686827-18-samitolvanen@google.com Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
This commit is contained in:
parent
6054303c9e
commit
a3048abbe6
|
@ -3317,6 +3317,10 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
|
|||
next_insn = next_insn_to_validate(file, insn);
|
||||
|
||||
if (func && insn->func && func != insn->func->pfunc) {
|
||||
/* Ignore KCFI type preambles, which always fall through */
|
||||
if (!strncmp(func->name, "__cfi_", 6))
|
||||
return 0;
|
||||
|
||||
WARN("%s() falls through to next function %s()",
|
||||
func->name, insn->func->name);
|
||||
return 1;
|
||||
|
@ -4115,6 +4119,7 @@ static int validate_ibt(struct objtool_file *file)
|
|||
!strcmp(sec->name, "__ex_table") ||
|
||||
!strcmp(sec->name, "__jump_table") ||
|
||||
!strcmp(sec->name, "__mcount_loc") ||
|
||||
!strcmp(sec->name, ".kcfi_traps") ||
|
||||
strstr(sec->name, "__patchable_function_entries"))
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in New Issue