Re: [PATCH 01/13] x86/traps: Make exc_double_fault() consistently noreturn

From: Brendan Jackman
Date: Mon Mar 17 2025 - 04:26:54 EST


On Fri, Mar 14, 2025 at 12:28:59PM -0700, Josh Poimboeuf wrote:
> The CONFIG_X86_ESPFIX64 version of exc_double_fault() can return to its
> caller, but the !CONFIG_X86_ESPFIX64 version never does. In the latter
> case the compiler and/or objtool may consider it to be implicitly
> noreturn.
>
> However, due to the currently inflexible way objtool detects noreturns,
> a function's noreturn status needs to be consistent across configs.
>
> The current workaround for this issue is to suppress unreachable
> warnings for exc_double_fault()'s callers. Unfortunately that can
> result in ORC coverage gaps and potentially worse issues like inert
> static calls and silently disabled CPU mitigations.
>
> Instead, prevent exc_double_fault() from ever being implicitly marked
> noreturn by forcing a return behind a never-taken conditional.
>
> Until a more integrated noreturn detection method exists, this is likely
> the least objectionable workaround.

Yeah it's pretty nasty, but I don't have a better idea. And we do
really want objtool to work on this code. (I am taking your word for
it on the objtool side issues, I have not researched that).

Reviewed-by: Brendan Jackman <jackmanb@xxxxxxxxxx>