Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fallback: Fix for BootOrder crash when index returned by find_boot_option() is not in current BootOrder list #422

Merged
merged 2 commits into from
Oct 12, 2021

Commits on Oct 5, 2021

  1. Revert "fallback: find_boot_option() needs to return the index for th…

    …e boot entry in optnum"
    
    This reverts commit 1b30c2b.
    
    This commit was creating duplicated entries when the "Linux" entry was
    not already in the BootOrder list, which may happen upon firmware reset.
    rmetrich committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    4cad659 View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2021

  1. fallback: fix crash when boot entry index >= size of BootOrder list

    Seen on Dell PowerEdge R740 when booting with BOOTX64 constantly.
    
    This patch keeps the behaviour previous to commit #1b30c2b by returning
    the index of the "Linux" entry.
    Then a check is made to find the entry in the current BootOrder:
    - if it isn't there, prepend the entry and copy the rest (this enlarges
      the BootOrder array by 1)
    - if it's there, prepend the entry and copy all remaining entries
    
    ------------------------------------------------------------------------------
    
    Example of outputs on a Dell PowerEdge R740:
    - 0000 is BOOTX64 entry
    - other entries are Dell's default ones (internal, no "Linux" there)
    
    1. Entry not already existing in BootOrder
    
    ----
    set_boot_order:486: Original nbootorder: 3
    Original BootOrder: 0000 0003 0004
     :
    add_to_boot_list:578: device path: "HD(1,GPT,99D47E76-590F-48FD-8FD6-0A0CE790D635)/\EFI\redhat\shimx64.efi"
    find_boot_option:454: Found boot entry "Boot0005" with label "Red Hat Enterprise Linux" for file "\EFI\redhat\shimx64.efi"
    add_to_boot_list:623: New nbootorder: 4
    BootOrder: 0005 0000 0003 0004
    find_boot_options:937: Found directory named "Dell"
    update_boot_order:509: nbootorder: 4
    BootOrder: 0005 0000 0003 0004
    ----
    
    2. Entry not existing at all
    
    ----
    set_boot_order:486: Original nbootorder: 3
    Original BootOrder: 0000 0001 0002
     :
    add_to_boot_list:578: device path: "HD(1,GPT,99D47E76-590F-48FD-8FD6-0A0CE790D635)/\EFI\redhat\shimx64.efi"
    add_boot_option:245: Creating boot entry "Boot0005" with label "Red Hat Enterprise Linux" for file "\EFI\redhat\shimx64.efi"
    add_boot_option:282: nbootorder: 4
    BootOrder: 0005 0000 0001 0002
    find_boot_options:937: Found directory named "Dell"
    update_boot_order:509: nbootorder: 4
    BootOrder: 0005 0000 0001 0002
    ----
    
    3. Entry already existing in BootOrder
    
    ----
    set_boot_order:486: Original nbootorder: 4
    Original BootOrder: 0000 0005 0001 0002
     :
    add_to_boot_list:578: device path: "HD(1,GPT,99D47E76-590F-48FD-8FD6-0A0CE790D635)/\EFI\redhat\shimx64.efi"
    find_boot_option:454: Found boot entry "Boot0005" with label "Red Hat Enterprise Linux" for file "\EFI\redhat\shimx64.efi"
    add_to_boot_list:623: New nbootorder: 4
    BootOrder: 0005 0000 0001 0002
    find_boot_options:937: Found directory named "Dell"
    update_boot_order:509: nbootorder: 4
    BootOrder: 0005 0000 0001 0002
    ----
    rmetrich committed Oct 6, 2021
    Configuration menu
    Copy the full SHA
    572038b View commit details
    Browse the repository at this point in the history