From: Breno Leitao <leitao@debian.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Borislav Petkov <bp@suse.de>, Andy Lutomirski <luto@kernel.org>,
Kees Cook <kees@kernel.org>, Tony Luck <tony.luck@intel.com>,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
Thomas Gleixner <tglx@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, rmikey@meta.com
Subject: Re: [PATCH v2 6/6] efi/runtime-wrappers: retire the worker if a wedged call ever returns
Date: Tue, 16 Jun 2026 03:13:14 -0700 [thread overview]
Message-ID: <ajEfvzYRh9oUJWDf@gmail.com> (raw)
In-Reply-To: <b3780e66-dad0-4f39-9dc6-b74f23fabb62@app.fastmail.com>
Hello Ard,
On Fri, Jun 12, 2026 at 01:11:11PM +0200, Ard Biesheuvel wrote:
> On Fri, 12 Jun 2026, at 13:01, Breno Leitao wrote:
> > + /*
> > + * If __efi_queue_work() timed out and disabled runtime services, the
> > + * caller is gone and efi_rts_work is no longer ours: park the worker
> > + * so it never signals the stale completion or runs again.
> > + */
> > + if (!efi_enabled(EFI_RUNTIME_SERVICES))
> > + efi_rts_park_worker();
> > +
>
> So one thing to note here is that the arm64 version of the exception recovery
> (in efi_runtime_fixup_exception()) will also clear EFI_RUNTIME_SERVICES, and
> that will occur before this check. This means we will park the worker not only
> on a time out, but also on an sync exception in the firmware.
Correct. Just to clarify the code flow for a faulty EFI:
efi_call_rts (EFI faults)
-> __do_kernel_fault()
-> efi_runtime_fixup_exception() == true (clears EFI_RUNTIME_SERVICES, rewrites regs)
-> __efi_rt_asm_recover
-> caller of __efi_rt_asm_wrapper ->
-> back into efi_call_rts(), with status = EFI_ABORTED (and EFI_RUNTIME_SERVICES unset).
Previous it was completing (complete(&efi_rts_work.efi_rts_comp);) and
disabling the EFI_RUNTIME_SERVICES
With this change it is parking the workthread with falut as well (with
EFI_RUNTIME_SERVICES disabled).
> I suspect this is actually what we want, but it deserves to be called out.
I think so.
It would not be hard to park on timeout, probably adding a new variable to
track "tiemout operations":
if (!wait_for_completion_timeout(&efi_rts_work.efi_rts_comp, EFI_RTS_TIMEOUT)) {
pr_err("EFI runtime service %d wedged in firmware; disabling EFI runtime services\n", id);
+ WRITE_ONCE(efi_rts_work.timeout, true);
clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
return EFI_ABORT
}
Then Worker tail tests the timeout field, not the bit:
if (READ_ONCE(efi_rts_work.field))
efi_rts_park_worker();
But, from my newbie view, you want to park in both cases.
Thanks for the heads-up,
--breno
prev parent reply other threads:[~2026-06-16 10:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 11:01 [PATCH v2 0/6] efi/runtime-wrappers: bound the wait for EFI runtime service calls Breno Leitao
2026-06-12 11:01 ` [PATCH v2 1/6] efi: fix stale reference to efi_recover_from_page_fault() Breno Leitao
2026-06-12 11:01 ` [PATCH v2 2/6] efi/runtime-wrappers: handle queue_work() failure with goto exit Breno Leitao
2026-06-12 11:01 ` [PATCH v2 3/6] efi/runtime-wrappers: check EFI_RUNTIME_SERVICES before using efi_rts_work Breno Leitao
2026-06-12 11:01 ` [PATCH v2 4/6] efi/runtime-wrappers: bound the wait for EFI runtime service calls Breno Leitao
2026-06-12 11:01 ` [PATCH v2 5/6] efi/runtime-wrappers: honour EFI_RUNTIME_SERVICES in the non-blocking paths Breno Leitao
2026-06-16 12:10 ` Breno Leitao
2026-06-12 11:01 ` [PATCH v2 6/6] efi/runtime-wrappers: retire the worker if a wedged call ever returns Breno Leitao
2026-06-12 11:11 ` Ard Biesheuvel
2026-06-16 10:13 ` Breno Leitao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ajEfvzYRh9oUJWDf@gmail.com \
--to=leitao@debian.org \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=dave.hansen@linux.intel.com \
--cc=gpiccoli@igalia.com \
--cc=hpa@zytor.com \
--cc=ilias.apalodimas@linaro.org \
--cc=kees@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=rmikey@meta.com \
--cc=tglx@kernel.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.