* FAILED: patch "[PATCH] efi/libstub: arm64: Don't use the platform register x18" failed to apply to 6.1-stable tree
@ 2026-11-07 10:49 Sasha Levin
2026-11-09 13:03 ` [PATCH -stable] efi/libstub: arm64: Don't use the platform register x18 Ard Biesheuvel
0 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2026-11-07 10:49 UTC (permalink / raw)
To: ardb; +Cc: stable
The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 4c86b5f3fa78347fa9cbc9e8ec06615b2f80e397
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '20261107054932-failed-6.1-4c86b5f3fa78@kernel.org' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 4c86b5f3fa78347fa9cbc9e8ec06615b2f80e397 Mon Sep 17 00:00:00 2001
From: Ard Biesheuvel <ardb@kernel.org>
Date: Thu, 15 Oct 2026 13:38:58 +0200
Subject: [PATCH] efi/libstub: arm64: Don't use the platform register x18
The UEFI specification designates x18, the platform register, as "do not
use" on AArch64, so that UEFI code is compatible both with an OS that
assigns a fixed role to x18, and with one that uses it as a temporary
register.
The arm64 EFI stub and the EFI zboot decompressor only avoid x18 if the
kernel is built with shadow call stacks, as that is the only case where
-ffixed-x18 is added to KBUILD_CFLAGS, which the stub inherits.
Otherwise, the compiler is free to use x18 as a temporary register, and
it does so.
So pass -ffixed-x18 unconditionally when building the stub for arm64,
so that the image can be run by loaders that rely on x18 being left
alone, such as a kernel that uses it for its shadow call stack.
Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/libstub/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 564773c89d146..e13d4dfe27c58 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -21,7 +21,7 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ $(CC_FLAGS_DIALECT) \
# arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly
# disable the stackleak plugin
-cflags-$(CONFIG_ARM64) += -fpie $(DISABLE_KSTACK_ERASE) \
+cflags-$(CONFIG_ARM64) += -fpie $(DISABLE_KSTACK_ERASE) -ffixed-x18 \
-fno-unwind-tables -fno-asynchronous-unwind-tables
cflags-$(CONFIG_ARM) += -DEFI_HAVE_STRLEN -DEFI_HAVE_STRNLEN \
-DEFI_HAVE_MEMCHR -DEFI_HAVE_STRRCHR \
--
2.53.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH -stable] efi/libstub: arm64: Don't use the platform register x18
2026-11-07 10:49 FAILED: patch "[PATCH] efi/libstub: arm64: Don't use the platform register x18" failed to apply to 6.1-stable tree Sasha Levin
@ 2026-11-09 13:03 ` Ard Biesheuvel
2026-11-10 20:59 ` Sasha Levin
0 siblings, 1 reply; 6+ messages in thread
From: Ard Biesheuvel @ 2026-11-09 13:03 UTC (permalink / raw)
To: stable; +Cc: Ard Biesheuvel
From: Ard Biesheuvel <ardb@kernel.org>
commit 4c86b5f3fa78347fa9cbc9e8ec06615b2f80e397 upstream
The UEFI specification designates x18, the platform register, as "do not
use" on AArch64, so that UEFI code is compatible both with an OS that
assigns a fixed role to x18, and with one that uses it as a temporary
register.
The arm64 EFI stub and the EFI zboot decompressor only avoid x18 if the
kernel is built with shadow call stacks, as that is the only case where
-ffixed-x18 is added to KBUILD_CFLAGS, which the stub inherits.
Otherwise, the compiler is free to use x18 as a temporary register, and
it does so.
So pass -ffixed-x18 unconditionally when building the stub for arm64,
so that the image can be run by loaders that rely on x18 being left
alone, such as a kernel that uses it for its shadow call stack.
Cc: <stable@vger.kernel.org> # 6.1.y and older
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/libstub/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 748781c25787..b85d3cae997e 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -19,7 +19,7 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \
# arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly
# disable the stackleak plugin
cflags-$(CONFIG_ARM64) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \
- -fpie $(DISABLE_STACKLEAK_PLUGIN) \
+ -fpie $(DISABLE_STACKLEAK_PLUGIN) -ffixed-x18 \
$(call cc-option,-mbranch-protection=none)
cflags-$(CONFIG_ARM) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \
-fno-builtin -fpic \
--
2.56.0.455.g6c5a503b38-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* FAILED: patch "[PATCH] efi/libstub: arm64: Don't use the platform register x18" failed to apply to 6.12-stable tree
@ 2026-11-07 10:22 Sasha Levin
2026-11-09 12:21 ` [PATCH -stable] efi/libstub: arm64: Don't use the platform register x18 Ard Biesheuvel
0 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2026-11-07 10:22 UTC (permalink / raw)
To: ardb; +Cc: stable
The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 4c86b5f3fa78347fa9cbc9e8ec06615b2f80e397
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '20261107052256-failed-6.12-4c86b5f3fa78@kernel.org' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 4c86b5f3fa78347fa9cbc9e8ec06615b2f80e397 Mon Sep 17 00:00:00 2001
From: Ard Biesheuvel <ardb@kernel.org>
Date: Thu, 15 Oct 2026 13:38:58 +0200
Subject: [PATCH] efi/libstub: arm64: Don't use the platform register x18
The UEFI specification designates x18, the platform register, as "do not
use" on AArch64, so that UEFI code is compatible both with an OS that
assigns a fixed role to x18, and with one that uses it as a temporary
register.
The arm64 EFI stub and the EFI zboot decompressor only avoid x18 if the
kernel is built with shadow call stacks, as that is the only case where
-ffixed-x18 is added to KBUILD_CFLAGS, which the stub inherits.
Otherwise, the compiler is free to use x18 as a temporary register, and
it does so.
So pass -ffixed-x18 unconditionally when building the stub for arm64,
so that the image can be run by loaders that rely on x18 being left
alone, such as a kernel that uses it for its shadow call stack.
Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/libstub/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 564773c89d146..e13d4dfe27c58 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -21,7 +21,7 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ $(CC_FLAGS_DIALECT) \
# arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly
# disable the stackleak plugin
-cflags-$(CONFIG_ARM64) += -fpie $(DISABLE_KSTACK_ERASE) \
+cflags-$(CONFIG_ARM64) += -fpie $(DISABLE_KSTACK_ERASE) -ffixed-x18 \
-fno-unwind-tables -fno-asynchronous-unwind-tables
cflags-$(CONFIG_ARM) += -DEFI_HAVE_STRLEN -DEFI_HAVE_STRNLEN \
-DEFI_HAVE_MEMCHR -DEFI_HAVE_STRRCHR \
--
2.53.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH -stable] efi/libstub: arm64: Don't use the platform register x18
2026-11-07 10:22 FAILED: patch "[PATCH] efi/libstub: arm64: Don't use the platform register x18" failed to apply to 6.12-stable tree Sasha Levin
@ 2026-11-09 12:21 ` Ard Biesheuvel
2026-11-09 12:56 ` Ard Biesheuvel
2026-11-09 15:53 ` Sasha Levin
0 siblings, 2 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2026-11-09 12:21 UTC (permalink / raw)
To: stable; +Cc: Ard Biesheuvel
From: Ard Biesheuvel <ardb@kernel.org>
commit 4c86b5f3fa78347fa9cbc9e8ec06615b2f80e397 upstream
The UEFI specification designates x18, the platform register, as "do not
use" on AArch64, so that UEFI code is compatible both with an OS that
assigns a fixed role to x18, and with one that uses it as a temporary
register.
The arm64 EFI stub and the EFI zboot decompressor only avoid x18 if the
kernel is built with shadow call stacks, as that is the only case where
-ffixed-x18 is added to KBUILD_CFLAGS, which the stub inherits.
Otherwise, the compiler is free to use x18 as a temporary register, and
it does so.
So pass -ffixed-x18 unconditionally when building the stub for arm64,
so that the image can be run by loaders that rely on x18 being left
alone, such as a kernel that uses it for its shadow call stack.
Cc: <stable@vger.kernel.org> # 6.12.y and older
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/libstub/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 1141cd06011f..d33c02e58717 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -22,7 +22,7 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -std=gnu11 \
# arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly
# disable the stackleak plugin
-cflags-$(CONFIG_ARM64) += -fpie $(DISABLE_STACKLEAK_PLUGIN) \
+cflags-$(CONFIG_ARM64) += -fpie $(DISABLE_STACKLEAK_PLUGIN) -ffixed-x18 \
-fno-unwind-tables -fno-asynchronous-unwind-tables
cflags-$(CONFIG_ARM) += -DEFI_HAVE_STRLEN -DEFI_HAVE_STRNLEN \
-DEFI_HAVE_MEMCHR -DEFI_HAVE_STRRCHR \
--
2.56.0.455.g6c5a503b38-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH -stable] efi/libstub: arm64: Don't use the platform register x18
2026-11-09 12:21 ` [PATCH -stable] efi/libstub: arm64: Don't use the platform register x18 Ard Biesheuvel
@ 2026-11-09 12:56 ` Ard Biesheuvel
2026-11-09 15:53 ` Sasha Levin
1 sibling, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2026-11-09 12:56 UTC (permalink / raw)
To: stable
On Mon, 9 Nov 2026, at 13:21, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
>
> commit 4c86b5f3fa78347fa9cbc9e8ec06615b2f80e397 upstream
>
> The UEFI specification designates x18, the platform register, as "do not
> use" on AArch64, so that UEFI code is compatible both with an OS that
> assigns a fixed role to x18, and with one that uses it as a temporary
> register.
>
> The arm64 EFI stub and the EFI zboot decompressor only avoid x18 if the
> kernel is built with shadow call stacks, as that is the only case where
> -ffixed-x18 is added to KBUILD_CFLAGS, which the stub inherits.
> Otherwise, the compiler is free to use x18 as a temporary register, and
> it does so.
>
> So pass -ffixed-x18 unconditionally when building the stub for arm64,
> so that the image can be run by loaders that rely on x18 being left
> alone, such as a kernel that uses it for its shadow call stack.
>
> Cc: <stable@vger.kernel.org> # 6.12.y and older
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> drivers/firmware/efi/libstub/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
This applies to 6.12 and 6.8 only - I'll have another one out
for the older ones.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -stable] efi/libstub: arm64: Don't use the platform register x18
2026-11-09 12:21 ` [PATCH -stable] efi/libstub: arm64: Don't use the platform register x18 Ard Biesheuvel
2026-11-09 12:56 ` Ard Biesheuvel
@ 2026-11-09 15:53 ` Sasha Levin
1 sibling, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-11-09 15:53 UTC (permalink / raw)
To: stable; +Cc: Sasha Levin, Ard Biesheuvel, Ard Biesheuvel
> efi/libstub: arm64: Don't use the platform register x18
Queued for 6.12 and 6.6, thanks.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-10 21:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07 10:49 FAILED: patch "[PATCH] efi/libstub: arm64: Don't use the platform register x18" failed to apply to 6.1-stable tree Sasha Levin
2026-11-09 13:03 ` [PATCH -stable] efi/libstub: arm64: Don't use the platform register x18 Ard Biesheuvel
2026-11-10 20:59 ` Sasha Levin
-- strict thread matches above, loose matches on Subject: below --
2026-11-07 10:22 FAILED: patch "[PATCH] efi/libstub: arm64: Don't use the platform register x18" failed to apply to 6.12-stable tree Sasha Levin
2026-11-09 12:21 ` [PATCH -stable] efi/libstub: arm64: Don't use the platform register x18 Ard Biesheuvel
2026-11-09 12:56 ` Ard Biesheuvel
2026-11-09 15:53 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox