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

It is UB to unwind over the FFI barrier #578

Open
cheako opened this issue Feb 15, 2022 · 2 comments
Open

It is UB to unwind over the FFI barrier #578

cheako opened this issue Feb 15, 2022 · 2 comments

Comments

@cheako
Copy link

cheako commented Feb 15, 2022

https://github.com/MaikKlein/ash/blob/b7aff3b432d853528a47bf99fa3e7f0d841c4112/ash/src/vk/features.rs#L87

These should be eprintln! followed by process::exit.

@MaikKlein
Copy link
Member

This is only called from within Rust so never crosses the FFI barrier and is caught by the rust runtime. But I am not sure if this is already UB because it is inside an extern block 🤔 .

@Ralith
Copy link
Collaborator

Ralith commented Feb 16, 2022

It's not clear to me whether this counts. https://doc.rust-lang.org/nomicon/ffi.html just says "across an FFI boundary." https://doc.rust-lang.org/reference/items/external-blocks.html does not mention panics/unwinding at all AFAICT. https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html#changes-to-the-behavior-of-existing-abi-strings says:

Prior to this RFC, any unwinding operation that crossed an extern "C" boundary, either from a panic! "escaping" from a Rust function defined with extern "C" or by entering Rust from another language via an entrypoint declared with extern "C", caused undefined behavior.

but it's not clear to me if that's normative.

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

No branches or pull requests

3 participants