Re: [PATCH v2] objtool: ignore unreachable trap after call to noreturn functions
From: Josh Poimboeuf
Date: Mon Sep 21 2020 - 11:19:29 EST
On Sat, Sep 19, 2020 at 09:41:18AM +0300, Ilie Halip wrote:
> With CONFIG_UBSAN_TRAP enabled, the compiler may insert a trap instruction
> after a call to a noreturn function. In this case, objtool warns that the
> ud2 instruction is unreachable.
>
> This is a behavior seen with clang, from the oldest version capable of
> building the mainline x64_64 kernel (9.0), to the latest experimental
> version (12.0).
>
> objtool silences similar warnings (trap after dead end instructions), so
> so expand that check to include dead end functions.
>
> Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> Cc: Rong Chen <rong.a.chen@xxxxxxxxx>
> Cc: Marco Elver <elver@xxxxxxxxxx>
> Cc: Philip Li <philip.li@xxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: kasan-dev@xxxxxxxxxxxxxxxx
> Cc: x86@xxxxxxxxxx
> Cc: clang-built-linux@xxxxxxxxxxxxxxxx
> BugLink: https://github.com/ClangBuiltLinux/linux/issues/1148
> Link: https://lore.kernel.org/lkml/CAKwvOdmptEpi8fiOyWUo=AiZJiX+Z+VHJOM2buLPrWsMTwLnyw@xxxxxxxxxxxxxx
> Suggested-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> Tested-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
> Signed-off-by: Ilie Halip <ilie.halip@xxxxxxxxx>
> ---
>
> Changed in v2:
> - added a mention that this is a clang issue across all versions
> - added Nick's Reviewed-by, Tested-by
> - added Reported-by
Thanks. Queued.
--
Josh