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: find_boot_option() needs to return the index for the boot entry in optnum #396

Merged
merged 1 commit into from
Aug 10, 2021

Conversation

jsetje
Copy link
Collaborator

@jsetje jsetje commented Jul 27, 2021

The CopyMem() calls in add_to_boot_list() expect that
find_boot_option() returned an index to the matching entry in the
BootOrder array. The previous code returned the numerical portion of
the boot entry label, which in some cases resulted in -1 *
sizeof(CHAR16) being passed to CopyMem() which would in turn corrupt
the running firmware resulting in an exception and a failure to boot
or reset.

…ntry in optnum

The CopyMem() calls in add_to_boot_list() expect that
find_boot_option() returned an index to the matching entry in the
BootOrder array. The previous code returned the numerical portion of
the boot entry label, which in some cases resulted in -1 *
sizeof(CHAR16) being passed to CopyMem() which would in turn corrupt
the running firmware resulting in an exception and a failure to boot
or reset.
@jsetje jsetje changed the title find_boot_option() needs to return the index for the boot entry in optnum fallback: find_boot_option() needs to return the index for the boot entry in optnum Jul 27, 2021
@jsetje jsetje requested a review from vathpela July 27, 2021 17:23
Copy link
Collaborator

@julian-klode julian-klode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all seems to make sense to me.

@julian-klode
Copy link
Collaborator

@jsetje still marked draft, intentional?

@jsetje jsetje marked this pull request as ready for review July 28, 2021 17:58
@jsetje
Copy link
Collaborator Author

jsetje commented Jul 28, 2021

This appears to do the right thing on the systems I currently have access to. I'm continuing to test.

@jsetje
Copy link
Collaborator Author

jsetje commented Jul 28, 2021

@jsetje still marked draft, intentional?

At the time yes, I hadn't tested adding a new device to a previously booted system yet, which seemed like a key case I should cover.

@vathpela vathpela merged commit 1b30c2b into rhboot:main Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

re-entering fallback on an already configured system can result in unpredictable behavior
3 participants