Thread (12 messages) 12 messages, 3 authors, 2025-11-17

Re: [PATCH 2/2] arm64: efi: Pass reboot cmd parameter to efi_reboot()

From: Ard Biesheuvel <ardb@kernel.org>
Date: 2025-11-14 09:35:48
Also in: linux-arm-msm, linux-efi, lkml

On Fri, 14 Nov 2025 at 10:33, Ard Biesheuvel [off-list ref] wrote:
On Fri, 14 Nov 2025 at 10:31, Sumit Garg [off-list ref] wrote:
quoted
On Fri, Nov 14, 2025 at 10:26:03AM +0100, Ard Biesheuvel wrote:
quoted
On Fri, 14 Nov 2025 at 09:51, Sumit Garg [off-list ref] wrote:
quoted
From: Sumit Garg <redacted>

EFI ResetSystem runtime service allows for platform specific reset type
allowing the OS to pass reset data for the UEFI implementation to take
corresponding action. So lets pass the reboot cmd parameter for the EFI
driver to determine whether it's a platform specific reset requested or
not.

Signed-off-by: Sumit Garg <redacted>
---
 arch/arm64/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index fba7ca102a8c..51784986c568 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -136,7 +136,7 @@ void machine_restart(char *cmd)
         * ResetSystem().
         */
        if (efi_enabled(EFI_RUNTIME_SERVICES))
-               efi_reboot(reboot_mode, NULL);
+               efi_reboot(reboot_mode, cmd);
I agree with the general principle. However, there are already
existing callers of kernel_restart() that would end up passing a
random string to efi_reboot(), resulting in platform specific reset
with undefined result.
Yeah true but the UEFI spec says:

"If the platform does not recognize the EFI_GUID in ResetData the platform
must pick a supported reset type to perform. The platform may optionally
log the parameters from any non-normal reset that occurs."

So, in these cases the UEFI implementation can fallback to normal reset
optionally logging the reset data being passed. Does that sounds
reasonable to you?
What the UEFI spec says might deviate from how real platforms in the
field will behave when being passed a reset type that nobody ever
tried passing before.
Also, the GUID is expected to follow an unbounded NULL terminated
UTF-16 string in memory, so we could easily cause a crash by doing
this if \0\0 doesn't appear in the memory following the string.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help