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

Random crashes with SimpleTextOutput Protocol on VirtualBox #121

Closed
imtsuki opened this issue Feb 28, 2020 · 0 comments · Fixed by #122
Closed

Random crashes with SimpleTextOutput Protocol on VirtualBox #121

imtsuki opened this issue Feb 28, 2020 · 0 comments · Fixed by #122

Comments

@imtsuki
Copy link
Contributor

imtsuki commented Feb 28, 2020

Lately, I am experiencing random crashes with uefi-rs running on VirtualBox while writing to stdout. The panic message is like the following:

Panic in /Users/tsuki/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/uefi-0.4.3/src/logger.rs at (59, 13):
ERROR: called `Result::unwrap()` on an `Err` value: Error

After investigation, it turns out the following code causes this problem:

self.output_string(text)
.warning_as_error()
.map_err(|_| fmt::Error)

Where the UEFI firmware shipped with VirtualBox will report EFI_DEVICE_ERROR when we're outputting too fast, probably, I'm not sure.

Personally I think this is not a fatal error and since there is no extra error message returned by output_string(), I'll submit a PR that ignores EFI_DEVICE_ERROR here.

imtsuki added a commit to imtsuki/uefi-rs that referenced this issue Feb 28, 2020
HadrienG2 pushed a commit that referenced this issue Feb 29, 2020
* Fixes #121: ignore EFI_DEVICE_ERROR in output_string

Signed-off-by: imtsuki <me@qjx.app>

* ignore Result in logger rather than Output protocol

Signed-off-by: imtsuki <me@qjx.app>

* Add a FIXME comment that we are ignoring logger's `Result`

Signed-off-by: imtsuki <me@qjx.app>
IsaacWoods pushed a commit to IsaacWoods/uefi-rs that referenced this issue Apr 7, 2020
…osdev#122)

* Fixes rust-osdev#121: ignore EFI_DEVICE_ERROR in output_string

Signed-off-by: imtsuki <me@qjx.app>

* ignore Result in logger rather than Output protocol

Signed-off-by: imtsuki <me@qjx.app>

* Add a FIXME comment that we are ignoring logger's `Result`

Signed-off-by: imtsuki <me@qjx.app>
nicholasbishop added a commit to nicholasbishop/uefi-rs that referenced this issue Apr 20, 2024
This was originally added because of occasional panics when logging quickly on
VirtualBox. (Unclear whether this bug is still present, and also as far as I
know we haven't observed this behavior on any other UEFI implementations.) The
decision was made to panic by default on logger errors, but offer an escape
mechanism. However, making this a compile-time choice is not ideal, since most
UEFI programs are intended to run on arbitrary UEFI implementations.

We could make it a runtime option instead, but since loggers are usually just
informational (i.e. not critical functionality for the application), silently
ignoring errors seems like a better choice for most uses.

In the rare case where an application does consider logging critical, they can
turn off the `logger` helper and implement their own logger.

For prior discussion, see:
* rust-osdev#121
* rust-osdev#123
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 a pull request may close this issue.

1 participant