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

Verify exported function signatures #97

Open
arendjr opened this issue Apr 4, 2022 · 0 comments
Open

Verify exported function signatures #97

arendjr opened this issue Apr 4, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@arendjr
Copy link
Contributor

arendjr commented Apr 4, 2022

When loading a WASM plugin, it is the runtime's responsibility to verify the plugin implements the expected functions. The code for the runtimes we generate intentionally do not assume plugins implement any of the fp_export! functions, because there's no way for us to enforce this anyway. Marking the functions as optional also has a practical advantage from a versioning perspective: When a new function is added to the protocol, the runtime may still wish to accept plugins that only implement an older version of the protocol. By marking the functions as optional, this decision is left to the implementor of the runtime.

However, there's a big caveat in all this: Even if a plugin exports a symbol for an expected function, there's no way to tell if the function signature actually matches. If the plugin implements a backwards-incompatible version of the function signature, the only way to find out is when the function crashes on invocation.

To improve this experience, we may wish to embed metadata in the plugins that list which functions, including their signatures, are actually implemented. The runtimes could then verify this metadata is as expected when the plugin gets loaded.

Then we could also take it a step further by marking functions as required in the protocol definition and letting the runtime outright reject plugins that fail to implement those.

@arendjr arendjr added the enhancement New feature or request label Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant