Re: [PATCH] x86/efi: Fix graceful fault handling after FPU softirq changes
From: Ard Biesheuvel
Date: Thu Apr 30 2026 - 04:39:24 EST
On Thu, 30 Apr 2026, at 09:41, Ivan Hu wrote:
> Since commit d02198550423 ("x86/fpu: Improve crypto performance by
> making kernel-mode FPU reliably usable in softirqs"), kernel_fpu_begin()
> calls fpregs_lock() which uses local_bh_disable() instead of the
> previous preempt_disable(). This sets SOFTIRQ_OFFSET in preempt_count
> during the entire EFI runtime service call, causing in_interrupt() to
> return true in normal task context.
>
> The graceful page fault handler efi_crash_gracefully_on_page_fault()
> uses in_interrupt() to bail out for faults in real interrupt context.
> With SOFTIRQ_OFFSET now set, the handler always bails out, leaving EFI
> firmware page faults unhandled. This escalates to die() which also sees
> in_interrupt() as true and calls panic("Fatal exception in interrupt"),
> resulting in a hard system freeze. On systems with buggy firmware that
> triggers page faults during EFI runtime calls (e.g., accessing unmapped
> memory in GetTime()), this causes an unrecoverable hang instead of the
> expected graceful EFI_ABORTED recovery.
>
> Fix by replacing in_interrupt() with in_hardirq() || in_nmi(). This
> preserves the original intent of bailing for genuine hardware interrupt
> or NMI faults, while no longer falsely triggering from the FPU code
> path's local_bh_disable(). This is safe because softirqs cannot run
> during EFI calls (they are explicitly blocked by fpregs_lock()), so
> they can never be the source of a page fault in this context.
>
> Fixes: d02198550423 ("x86/fpu: Improve crypto performance by making
> kernel-mode FPU reliably usable in softirqs")
> Signed-off-by: Ivan Hu <ivan.hu@xxxxxxxxxxxxx>
> ---
> arch/x86/platform/efi/quirks.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Acked-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
I'll take this via the EFI tree unless -tip prefers to take it.