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

Rust BPF programs do not interface with the runtime via FFI-safe types #14693

Open
jackcmay opened this issue Jan 20, 2021 · 0 comments
Open
Labels
runtime Issues related to runtime, BPF, and LLVM
Milestone

Comments

@jackcmay
Copy link
Contributor

Problem

When calling invoke the program passes AccountInfo structures to the runtime. AccountInfo is not-FFI safe and is not ABI stable.

Some context: #14523

Proposed Solution

All types going in and out of the program should be FFI-safe and ABI stable. In short, they should use Repr(C) representation.

  • Input parameters are currently serialized into a data buffer and therefore safe but there is an effort to rework this interface to reduce copies (Program serialization is inefficient due to copies of accounts into and out of the program #14691). Depending on what that rework looks like any types passed to the entrypoint should be safe
  • The only output parameter is a u64 which safe
  • Parameters passed to Invoke are pointers to internal structures which are then translated and recreated by the runtime. Since AccountInfo is Repr(C) this translation is not stable. All types passed into and out of invoke must be safe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
runtime Issues related to runtime, BPF, and LLVM
Projects
None yet
Development

No branches or pull requests

3 participants