Skip to content

[Patch] Fix ALLOW_32BIT_KERNEL_ON_X64 and Remove Redundant Code #796

@TBOpen

Description

@TBOpen

I sent you (peter) something similar via email in 2021 but never heard back so just ignored, but now I'll post here as issue. This relates back to issue #30 here where I sent you a patch that was implemented with some differences. I don't recall if this bug was introduced in that first round or added later but I've simply been fixing it on each submission. I took my main patch and manually split it so only the fix issue is addressed here.

Background: in rhboot/shim-review#544 (comment)

If you have any questions about it, just email back.

FWIW it may be easier to understand that block if rewritten as:

if (PEHdr->Pe32.FileHeader.Machine != machine_type) {
if (machine_type != IMAGE_FILE_MACHINE_I386 ||
PEHdr->Pe32.FileHeader.Machine != IMAGE_FILE_MACHINE_X64 ||
!allow_64_bit()) {
return 0;
}
}

Then it’s clearer to see it’s redundant on 32-bit builds (the code that follows that does the same thing) and breaks the ALLOW_32BIT_KERNEL_ON_X64 option on 64-bit builds (since that block doesn’t allow it through to check allow_32_bit). The logic of allow_32_bit and allow_64_bit is correct.

shim-16.1-fix.patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions