-
Notifications
You must be signed in to change notification settings - Fork 269
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
remove panic from C invalid-argument callbacks #288
Conversation
5a57f8f
to
f30fbe7
Compare
There'e already previous discussion on this subject on: #228 |
I don't understand this. Doesn't this say that https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md#abi-boundaries-and-unforced-unwinding that calling edit: I mean of course only in the recent versions that implement this but that's where we see the segfault. Maybe because the RFC is not yet fully implemented? rust-lang/rust#74990 |
It looks like it doesn't segfault, it SIGILL, which is apparently is used by LLVM to abort: So the nightly is doing exactly what the RFC says |
Ah okay! Maybe we should simply call https://doc.rust-lang.org/std/process/fn.abort.html . I wasn't aware of this function. The process "crashes" cleanly and without UB. Isn't that exactly what we want? edit: ah this was metnioned in #228, and it requires std of course... rust-lang/rfcs#2512 (comment) |
Ok, better idea: Can't we write the callback in C and call |
We cannot use std::process::abort because it's not available with nostd. This |
There's also an argument that we could just leave the existing |
Ok so I think two by far best solutions for us are:
|
I think we should just leave the |
I think this can be closed now that #290 is merged? (it is technically still UB on stable rust, but |
Yeah, I think this can be closed for now. I heard that the change in behavior may be reverted soon :( . But then we can still reconsider this. |
The upstream C functions will return false after calling these callbacks, at which point we will (usually) panic in the Rust code.
We are not allowed to panic from the callbacks themselves, since the result would be a panic crossing FFI boundaries, which is UB (and results in segfaults in Rust nightly as of 2021-03-11).