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

What happens if LoadOption is L"\0" ? #95

Closed
edjee opened this issue Sep 8, 2017 · 2 comments
Closed

What happens if LoadOption is L"\0" ? #95

edjee opened this issue Sep 8, 2017 · 2 comments

Comments

@edjee
Copy link

edjee commented Sep 8, 2017

shim/shim.c

Line 2531 in e06765a

UINTN strings = count_ucs2_strings(li->LoadOptions,

Hi @vathpela , may I ask about the function "set_second_stage" in shim.c ?

If the LoadOption data happens to be L"\0" , what's the expected results?
I found that the function "count_ucs2_strings" returns 1, when the input is L"\0".

In such a case, do we want to fall back to DEFAULT_LOADER? Or halt?

@edjee
Copy link
Author

edjee commented Sep 11, 2017

To me it's strange that count_ucs2_strings() returns 1 for the input L"\0".
Is that an expected behavior? Shouldn't it return 0?

@vathpela
Copy link
Contributor

vathpela commented Mar 6, 2018

L"\0" is one string of length 0. That looks right to me.
I think we want DEFAULT_LOADER in this case.

vathpela added a commit that referenced this issue Mar 6, 2018
I don't know when or why we ever see this, but it's easy enough to
avoid.

Resolves github issue #95

Signed-off-by: Peter Jones <pjones@redhat.com>
@vathpela vathpela closed this as completed Mar 6, 2018
frozencemetery added a commit to frozencemetery/shim that referenced this issue Aug 23, 2022
In 6c8d08c ("shim: Ignore UEFI
LoadOptions that are just NUL characters."), a check was added to
discard load options that are entirely NUL.  We now see some firmwares
that start LoadOptions with a NUL, and then follow it with garbage (path
to directory containing loaders).  Widen the check to just discard
anything that starts with a NUL.

Resolves: rhboot#490
Related: rhboot#95
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=2113005
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
frozencemetery added a commit to frozencemetery/shim that referenced this issue Aug 25, 2022
In 6c8d08c ("shim: Ignore UEFI
LoadOptions that are just NUL characters."), a check was added to
discard load options that are entirely NUL.  We now see some firmwares
that start LoadOptions with a NUL, and then follow it with garbage (path
to directory containing loaders).  Widen the check to just discard
anything that starts with a NUL.

Resolves: rhboot#490
Related: rhboot#95
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=2113005
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
vathpela pushed a commit that referenced this issue Sep 1, 2022
In 6c8d08c ("shim: Ignore UEFI
LoadOptions that are just NUL characters."), a check was added to
discard load options that are entirely NUL.  We now see some firmwares
that start LoadOptions with a NUL, and then follow it with garbage (path
to directory containing loaders).  Widen the check to just discard
anything that starts with a NUL.

Resolves: #490
Related: #95
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=2113005
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
brianredbeard pushed a commit to brianredbeard/redhat-efi-boot-shim that referenced this issue Feb 22, 2024
In 6c8d08c ("shim: Ignore UEFI
LoadOptions that are just NUL characters."), a check was added to
discard load options that are entirely NUL.  We now see some firmwares
that start LoadOptions with a NUL, and then follow it with garbage (path
to directory containing loaders).  Widen the check to just discard
anything that starts with a NUL.

Resolves: rhboot#490
Related: rhboot#95
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=2113005
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
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

No branches or pull requests

2 participants