* [PATCH 1/2] efi/runtime-wrappers: mark efi_rts_park_worker() as __noreturn
2026-07-13 13:06 [PATCH 0/2] efi/runtime-wrappers: fix linker warnings Breno Leitao
@ 2026-07-13 13:06 ` Breno Leitao
2026-07-13 13:06 ` [PATCH 2/2] efi/runtime-wrappers: mark efi_runtime_lock_owner as __used Breno Leitao
2026-07-14 6:50 ` [PATCH 0/2] efi/runtime-wrappers: fix linker warnings Ard Biesheuvel
2 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2026-07-13 13:06 UTC (permalink / raw)
To: Ard Biesheuvel, Ilias Apalodimas, Josh Poimboeuf, Peter Zijlstra,
Catalin Marinas
Cc: linux-efi, linux-kernel, Breno Leitao, kernel-team,
kernel test robot
efi_rts_park_worker() loops in schedule() forever and never returns, but
it is not annotated as such. When efi_crash_gracefully_on_page_fault()
calls it, objtool cannot tell the call is a dead end and warns about the
unreachable code that follows it:
vmlinux.o: warning: objtool: efi_crash_gracefully_on_page_fault+0xc3: efi_rts_park_worker() missing __noreturn in .c/.h or NORETURN() in noreturns.h
Mark both the declaration and the definition __noreturn, and add the
function to objtool's noreturn list.
Fixes: 3e5ba97c181e ("efi/runtime-wrappers: factor out efi_rts_park_worker()")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202607100848.iWPxdkhX-lkp@intel.com/
Signed-off-by: Breno Leitao <leitao@debian.org>
---
drivers/firmware/efi/runtime-wrappers.c | 2 +-
include/linux/efi.h | 2 +-
tools/objtool/noreturns.h | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c
index 591a725b10613..6f42da11a9178 100644
--- a/drivers/firmware/efi/runtime-wrappers.c
+++ b/drivers/firmware/efi/runtime-wrappers.c
@@ -224,7 +224,7 @@ extern struct semaphore __efi_uv_runtime_lock __alias(efi_runtime_lock);
* have been disabled and its efi_rts_work is abandoned. Loop in schedule()
* so a spurious wakeup cannot resume it.
*/
-void efi_rts_park_worker(void)
+void __noreturn efi_rts_park_worker(void)
{
for (;;) {
set_current_state(TASK_IDLE);
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 015505423277e..b3c83516593d1 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1256,7 +1256,7 @@ extern struct efi_runtime_work efi_rts_work;
/* Workqueue to queue EFI Runtime Services */
extern struct workqueue_struct *efi_rts_wq;
-void efi_rts_park_worker(void);
+void __noreturn efi_rts_park_worker(void);
struct linux_efi_memreserve {
int size; // allocated size of the array
diff --git a/tools/objtool/noreturns.h b/tools/objtool/noreturns.h
index 14f8ab653449c..0e9dfd0a2446c 100644
--- a/tools/objtool/noreturns.h
+++ b/tools/objtool/noreturns.h
@@ -26,6 +26,7 @@ NORETURN(cpu_startup_entry)
NORETURN(do_exit)
NORETURN(do_group_exit)
NORETURN(do_task_dead)
+NORETURN(efi_rts_park_worker)
NORETURN(ex_handler_msr_mce)
NORETURN(hlt_play_dead)
NORETURN(hv_ghcb_terminate)
--
2.53.0-Meta
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] efi/runtime-wrappers: mark efi_runtime_lock_owner as __used
2026-07-13 13:06 [PATCH 0/2] efi/runtime-wrappers: fix linker warnings Breno Leitao
2026-07-13 13:06 ` [PATCH 1/2] efi/runtime-wrappers: mark efi_rts_park_worker() as __noreturn Breno Leitao
@ 2026-07-13 13:06 ` Breno Leitao
2026-07-14 6:50 ` [PATCH 0/2] efi/runtime-wrappers: fix linker warnings Ard Biesheuvel
2 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2026-07-13 13:06 UTC (permalink / raw)
To: Ard Biesheuvel, Ilias Apalodimas, Josh Poimboeuf, Peter Zijlstra,
Catalin Marinas
Cc: linux-efi, linux-kernel, Breno Leitao, kernel-team,
kernel test robot
efi_runtime_lock_owner is only ever read by efi_runtime_assert_lock_held().
When CONFIG_BUG=n, WARN_ON() collapses to a statement that discards its
condition, so the compiler drops that read, treats the variable as
write-only and eliminates it. Debug info still references the symbol, so a
build carrying it (e.g. CONFIG_DEBUG_INFO_SPLIT) fails to link:
ld: drivers/firmware/efi/runtime-wrappers.o:(.debug_addr+0x104): undefined reference to `efi_runtime_lock_owner'
Mark the variable __used so its storage is always emitted. This seems to
be better than alternatives (READ_ONCE/__maybe_unused).
Fixes: a2860501203c ("efi/runtime-wrappers: Keep track of the efi_runtime_lock owner")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202607100518.uMJJPDfP-lkp@intel.com/
Signed-off-by: Breno Leitao <leitao@debian.org>
---
drivers/firmware/efi/runtime-wrappers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c
index 6f42da11a9178..2344b9d1e81f8 100644
--- a/drivers/firmware/efi/runtime-wrappers.c
+++ b/drivers/firmware/efi/runtime-wrappers.c
@@ -210,7 +210,7 @@ void efi_call_virt_check_flags(unsigned long flags, const void *caller)
*/
static DEFINE_SEMAPHORE(efi_runtime_lock, 1);
-static struct task_struct *efi_runtime_lock_owner;
+static struct task_struct *efi_runtime_lock_owner __used;
/*
* Expose the EFI runtime lock to the UV platform
--
2.53.0-Meta
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] efi/runtime-wrappers: fix linker warnings
2026-07-13 13:06 [PATCH 0/2] efi/runtime-wrappers: fix linker warnings Breno Leitao
2026-07-13 13:06 ` [PATCH 1/2] efi/runtime-wrappers: mark efi_rts_park_worker() as __noreturn Breno Leitao
2026-07-13 13:06 ` [PATCH 2/2] efi/runtime-wrappers: mark efi_runtime_lock_owner as __used Breno Leitao
@ 2026-07-14 6:50 ` Ard Biesheuvel
2 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2026-07-14 6:50 UTC (permalink / raw)
To: Breno Leitao, Ilias Apalodimas, Josh Poimboeuf, Peter Zijlstra,
Catalin Marinas
Cc: linux-efi, linux-kernel, kernel-team, kernel test robot
On Mon, 13 Jul 2026, at 16:06, Breno Leitao wrote:
> When I've submitted my last patchset titled "efi/runtime-wrappers: bound
> the wait for EFI runtime service calls", I've got two reports
>
> 1) efi_rts_park_worker() loops forever and never returns, but wasn't
> marked __noreturn, so objtool warns about the unreachable code after
> the call.
> https://lore.kernel.org/all/202607100848.iWPxdkhX-lkp@intel.com/
>
> 2) efi_runtime_lock_owner is optimised away under CONFIG_BUG=n, leaving a
> dangling debug-info reference that breaks the link.
> https://lore.kernel.org/all/202607100518.uMJJPDfP-lkp@intel.com/
>
> Patch 1 fixes the objtool warning; patch 2 fixes the link error.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> Breno Leitao (2):
> efi/runtime-wrappers: mark efi_rts_park_worker() as __noreturn
> efi/runtime-wrappers: mark efi_runtime_lock_owner as __used
>
Queued up now, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread