Message ID | 20220513202159.1550547-16-samitolvanen@google.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | KCFI support | expand |
On Fri, May 13, 2022 at 01:21:53PM -0700, Sami Tolvanen wrote: > The __cfi_ preambles contain valid instructions, which embed KCFI > type information in the following format: > > __cfi_function: > int3 > int3 > mov <id>, %eax > int3 > int3 > function: > ... > > While the preambles are STT_FUNC and contain valid instructions, > they are not executed and always fall through. Skip the warning for > them. > > Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Kees Cook <keescook@chromium.org>
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index ca5b74603008..88f005ae6dcc 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3311,6 +3311,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;
The __cfi_ preambles contain valid instructions, which embed KCFI type information in the following format: __cfi_function: int3 int3 mov <id>, %eax int3 int3 function: ... While the preambles are STT_FUNC and contain valid instructions, they are not executed and always fall through. Skip the warning for them. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> --- tools/objtool/check.c | 4 ++++ 1 file changed, 4 insertions(+)