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

improve FFI call effect #51

Open
1 of 4 tasks
cdstanford opened this issue Oct 25, 2023 · 1 comment
Open
1 of 4 tasks

improve FFI call effect #51

cdstanford opened this issue Oct 25, 2023 · 1 comment
Labels
roadmap-v1 Roadmap for v1.0

Comments

@cdstanford
Copy link
Collaborator

cdstanford commented Oct 25, 2023

Currently, we add the FFICall effect when an FFI function is called, not when it is declared. This seems wrong because when an FFI function is public, e.g.

pub extern "C" fn do_some_shady_stuff(...) { ... }

The function is not marked as having any effects, but calling it is clearly dangerous.

This shows up on the system-configuration-sys crate (v 0.5.0) as found by @deian leading to, confusingly, no effects in this crate, and I also copied the relevant source code file to the test-crates/ffi-ex example crate so we can track its results on make test

v0 tasks:

  • add an FFIDecl effect when an FFI function is declared

v1 tasks:

  • make sure FFI functions are showing up in the call graph / audit tree (running an audit)
  • remove the FFICall effect when FFI functions are called, as this would now be redundant
  • check the results on make test and make sure the changes look reasonable
@cdstanford cdstanford added the roadmap-v1 Roadmap for v1.0 label Oct 25, 2023
@cdstanford
Copy link
Collaborator Author

We are thinking that for now we just add an FFIDecl effect as a temporary measure in addition to the FFICall effect. That way, system-configuration-sys doesn't incorrectly get marked as safe, but we still catch if there are cross-crate FFI function calls and audit them

@cdstanford cdstanford added the roadmap-v0 On the current roadmap label Oct 25, 2023
@cdstanford cdstanford removed the roadmap-v0 On the current roadmap label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
roadmap-v1 Roadmap for v1.0
Projects
None yet
Development

No branches or pull requests

2 participants