From f0628f77e2357a7c57d9b49b26d05d91a9c9603f Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Sun, 2 Nov 2025 05:57:24 -0500 Subject: [PATCH] fix(shim): repair x86_64 shim verification by using the SYSV calling convention --- src/integrations/shim.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/integrations/shim.rs b/src/integrations/shim.rs index 0bf555d..e85a9a0 100644 --- a/src/integrations/shim.rs +++ b/src/integrations/shim.rs @@ -134,6 +134,13 @@ pub enum ShimVerificationOutput { #[unsafe_protocol(ShimSupport::SHIM_LOCK_GUID)] struct ShimLockProtocol { /// Verify the data in `buffer` with the size `buffer_size` to determine if it is valid. + /// NOTE: On x86_64, this function uses SYSV calling conventions. On aarch64 it uses the + /// efiapi calling convention. This is truly wild, but you can verify it yourself by + /// looking at: https://github.com/rhboot/shim/blob/15.8/shim.h#L207-L212 + /// There is no calling convention declared like there should be. + #[cfg(target_arch = "x86_64")] + pub shim_verify: unsafe extern "sysv64" fn(buffer: *const c_void, buffer_size: u32) -> Status, + #[cfg(target_arch = "aarch64")] pub shim_verify: unsafe extern "efiapi" fn(buffer: *const c_void, buffer_size: u32) -> Status, /// Unused function that is defined by the shim. _generate_header: *mut c_void,