Skip to content

Commit f0628f7

Browse files
committed
fix(shim): repair x86_64 shim verification by using the SYSV calling convention
1 parent cc37c2b commit f0628f7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/integrations/shim.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ pub enum ShimVerificationOutput {
134134
#[unsafe_protocol(ShimSupport::SHIM_LOCK_GUID)]
135135
struct ShimLockProtocol {
136136
/// Verify the data in `buffer` with the size `buffer_size` to determine if it is valid.
137+
/// NOTE: On x86_64, this function uses SYSV calling conventions. On aarch64 it uses the
138+
/// efiapi calling convention. This is truly wild, but you can verify it yourself by
139+
/// looking at: https://github.com/rhboot/shim/blob/15.8/shim.h#L207-L212
140+
/// There is no calling convention declared like there should be.
141+
#[cfg(target_arch = "x86_64")]
142+
pub shim_verify: unsafe extern "sysv64" fn(buffer: *const c_void, buffer_size: u32) -> Status,
143+
#[cfg(target_arch = "aarch64")]
137144
pub shim_verify: unsafe extern "efiapi" fn(buffer: *const c_void, buffer_size: u32) -> Status,
138145
/// Unused function that is defined by the shim.
139146
_generate_header: *mut c_void,

0 commit comments

Comments
 (0)