Re: [PATCH v2] x86/ftrace: Remove OBJECT_FILES_NON_STANDARD usage

From: Steven Rostedt
Date: Fri Jun 17 2022 - 18:52:10 EST


On Fri, 3 Jun 2022 08:04:44 -0700
Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:

> The file-wide OBJECT_FILES_NON_STANDARD annotation is used with
> CONFIG_FRAME_POINTER to tell objtool to skip the entire file when frame
> pointers are enabled. However that annotation is now deprecated because
> it doesn't work with IBT, where objtool runs on vmlinux.o instead of
> individual translation units.
>
> Instead, use more fine-grained function-specific annotations:
>
> - The 'save_mcount_regs' macro does funny things with the frame pointer.
> Use STACK_FRAME_NON_STANDARD_FP to tell objtool to ignore the
> functions using it.
>
> - The return_to_handler() "function" isn't actually a callable function.
> Instead of being called, it's returned to. The real return address
> isn't on the stack, so unwinding is already doomed no matter which
> unwinder is used. So just remove the STT_FUNC annotation, telling
> objtool to ignore it. That also removes the implicit
> ANNOTATE_NOENDBR, which now needs to be made explicit.
>
> Fixes the following warning:
>
> vmlinux.o: warning: objtool: __fentry__+0x16: return with modified stack frame
>
> Fixes: ed53a0d97192 ("x86/alternative: Use .ibt_endbr_seal to seal indirect calls")
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> ---
> v2:
> - fix return_to_handler()

Acked-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>

-- Steve