-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix panic=abort tests on fuchsia #127595
base: master
Are you sure you want to change the base?
Fix panic=abort tests on fuchsia #127595
Conversation
r? @tmandry |
I should state explicitly that a goal of this PR is to enable Fuchsia testing for |
This comment has been minimized.
This comment has been minimized.
130612b
to
ba47433
Compare
This comment has been minimized.
This comment has been minimized.
4508223
to
9353463
Compare
This comment has been minimized.
This comment has been minimized.
9353463
to
a6aed9b
Compare
a6aed9b
to
11f6c04
Compare
11f6c04
to
1e8eba9
Compare
After a lot of thought, I've changed the approach of this PR significantly. In short, Zircon does not implement signals as the definition of the C Standard Library expects for the implementation of libc::abort(). As a result, I think it's impossible to expose an API on top of a return code from Zircon to determine if a task was aborted or not. The best we can do is smooth the path for retrieving a ZX_TASK_RETCODE. I will be pushing a new version of this PR shortly. |
The longer story with citations.... There are cases in this repository that attempt to detect whether a process aborted or not. The first is in (For Windows, it's apparently sufficient to check for For Fuchsia, The second case is Taking a step back though, it's not actually the primary goal of |
1e8eba9
to
f98bc4b
Compare
The latest change modifies the approach to implement |
This comment has been minimized.
This comment has been minimized.
f98bc4b
to
6d717c9
Compare
#[unstable(feature = "fuchsia_exit_status", issue = "none")] | ||
pub type zx_status_t = i32; | ||
#[unstable(feature = "fuchsia_exit_status", issue = "none")] | ||
pub const ZX_TASK_RETCODE_SYSCALL_KILL: zx_status_t = -1024; | ||
#[unstable(feature = "fuchsia_exit_status", issue = "none")] | ||
pub const ZX_TASK_RETCODE_OOM_KILL: zx_status_t = -1025; | ||
#[unstable(feature = "fuchsia_exit_status", issue = "none")] | ||
pub const ZX_TASK_RETCODE_POLICY_KILL: zx_status_t = -1026; | ||
#[unstable(feature = "fuchsia_exit_status", issue = "none")] | ||
pub const ZX_TASK_RETCODE_VDSO_KILL: zx_status_t = -1027; | ||
/// On Zircon (the Fuchsia kernel), an abort from userspace calls the | ||
/// LLVM implementation of __builtin_trap(), e.g., ud2 on x86, which | ||
/// raises a kernel exception. If a userspace process does not | ||
/// otherwise arrange exception handling, the kernel kills the process | ||
/// with this return code. | ||
#[unstable(feature = "fuchsia_exit_status", issue = "none")] | ||
pub const ZX_TASK_RETCODE_EXCEPTION_KILL: zx_status_t = -1028; | ||
#[unstable(feature = "fuchsia_exit_status", issue = "none")] | ||
pub const ZX_TASK_RETCODE_CRITICAL_PROCESS_KILL: zx_status_t = -1029; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not thrilled about adding these constants here since std::sys::pal::unix::process::zircon
exists. However, since std::sys::pal::unix::process::zircon
is private, I didn't want to cross the bridge of exposing parts of that module in this change.
c7980b6
to
8a6859d
Compare
The method task_retcode() method improves the ergonomics of determining if a Fuchsia process was killed by the kernel and for what reason.
8a6859d
to
900e3c6
Compare
☔ The latest upstream changes (presumably #125443) made this pull request unmergeable. Please resolve the merge conflicts. |
This PR goes one step further than #127594 by adding an unstable feature to make determining whether a Fuchsia process aborted more robust. There is certainly more work that needs to go in to landing the unstable feature, but I'm drafting this PR as a means to convey intent for the feature to survey others' thoughts.
r? @tmandry