-
Notifications
You must be signed in to change notification settings - Fork 154
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 enclave panic reporting so that it always shows the error #3274
Conversation
Most of the time when an enclave panics, particularly during local development, the process dies with a hard abort before slog gets a chance to flush it's buffer. This commit makes it emit the panic message on STDERR first, which means it will be in an OS buffer before the process ends. We continue to write it as well as to slog, which writes to STDOUT. I see no reason not to do this, it's a massive quality of life improvement for anyone actually working on enclave-impl's.
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.
LGTM, in sgx-std
we're just writing the bytes to stderr
, because:
- There's no expectation the logging system would get involved in a regular panic, so stderr needs to get captured somehow anyways
- It doesn't seem like there's any appetite to do anything more sophisticated in production.
I think eran has made it this way for most of our services though: I am not sure if we capture anything other than the slog output right now in production |
I think everything in production is calling this today: mobilecoin/common/src/panic_handler.rs Line 12 in 3259a5d
|
This is starting to feel like we should be trying to panic in the logging OCALL (i.e. in untrusted). It's not necessary for this PR, but we can bake this in the SGX2/DCAP stuff.
AFAIK, it's the other way around: we're only capturing |
Yeah that's a good call -- propagate the panic from the enclave to the outside. In principle, we could try to keep the server up and bring back a new copy of the enclave? but I think in reality there's no good reason to attempt that. |
In unwind mode it might be fucked up i guess, if rust is trying to get a backtrace through the ocall? |
The nomicon seems to indicate that it should work OK:
AFAIK the first rule should apply since we're the one calling |
Most of the time when an enclave panics, particularly during local development, the process dies with a hard abort before slog gets a chance to flush it's buffer.
This commit makes it emit the panic message on STDERR first, using eprintln, which means it will be in an OS buffer before the process ends. We continue to write it as well as to slog, which writes to STDOUT.
I see no reason not to do this, it's a massive quality of life improvement for anyone actually working on enclave-impl's.
Without this patch, 100% of the time i do not get panic messages from the enclave, and just a core dumped (aborted) message.