[PATCH v3 01/44] efi/runtime-wrappers: Restore IRQ flags before proceeding with prints

Jinjie Ruan ruanjinjie at huawei.com
Wed Dec 2 18:11:17 PST 2026



在 2026/11/30 23:54, Vladimir Murzin 写道:
> Sashiko reported that in case live IRQ flags do not match expected one
> after EFI runtime call we proceed with prints before restoring IRQ
> flags. That creates window where prints executed with unexpected IRQ
> state. Instead, switch the order of operations: first restore IRQ
> flags to know good value and only then proceed with prints.
> 
> Signed-off-by: Vladimir Murzin <vladimir.murzin at arm.com>

Maybe a Fixes and cc stable tag are needed, otherwise LGTM.

Reviewed-by: Jinjie Ruan <ruanjinjie at huawei.com>

> ---
>  drivers/firmware/efi/runtime-wrappers.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c
> index eea4f32e6474..20d63d028922 100644
> --- a/drivers/firmware/efi/runtime-wrappers.c
> +++ b/drivers/firmware/efi/runtime-wrappers.c
> @@ -165,14 +165,17 @@ void efi_call_virt_check_flags(unsigned long flags, const void *caller)
>  
>  	cur_flags = efi_call_virt_save_flags();
>  
> -	mismatch = flags ^ cur_flags;
> -	if (!WARN_ON_ONCE(mismatch & ARCH_EFI_IRQ_FLAGS_MASK))
> +	mismatch = (flags ^ cur_flags) & ARCH_EFI_IRQ_FLAGS_MASK;
> +
> +	if (!mismatch)
>  		return;
>  
> +	arch_efi_restore_flags(flags);
> +
> +	WARN_ON_ONCE(1);
>  	add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_NOW_UNRELIABLE);
>  	pr_err_ratelimited(FW_BUG "IRQ flags corrupted (0x%08lx=>0x%08lx) by EFI call from %pS\n",
>  			   flags, cur_flags, caller ?: __builtin_return_address(0));
> -	arch_efi_restore_flags(flags);
>  }
>  
>  /*




More information about the linux-arm-kernel mailing list