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

Handle possible signals from POSIX APIs (mmap, read, ...) #58

Open
4 tasks
edubart opened this issue May 29, 2023 · 0 comments
Open
4 tasks

Handle possible signals from POSIX APIs (mmap, read, ...) #58

edubart opened this issue May 29, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@edubart
Copy link
Contributor

edubart commented May 29, 2023

Context

There are some POSIX functions we call that may raise signals in unusual situations.

For example mmap() may raise SIGBUS when a mapped file is overwritten while it's mapped, this may happen when the user overwrites a rootfs while a running emulator is using it.

The write() and read() functions used in console TTY may also raise signals such as SIGPIPE when its file descriptor is closed by the host.

When any of these signals happens the application exits unexpectedly or even crashes, while in the ideal situation an internal error could have been raised, making it possible to handle it programatically.

Possible solutions

We should review all POSIX and Linux functions we call in the emulator and review if we properly handle all possible signals for them and make the machine exit gracefully or with an error instead of a crash or unexpected exit. In the case of Lua APIs we could raise a Lua error.

Definition of Done

  • Handle possible signals for mmap()
  • Handle possible signals for read()
  • Handle possible signals for write()
  • Raise Lua errors instead of exiting
@edubart edubart added the enhancement New feature or request label May 29, 2023
@edubart edubart self-assigned this May 29, 2023
@edubart edubart changed the title Handle signals of POSIX APIs (mmap, read, ...) Handle possible signals from POSIX APIs (mmap, read, ...) May 29, 2023
@edubart edubart removed their assignment Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant