-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Safe Memory Access #2484
Comments
Thanks for the report! It should definitely be safe to add these, and no locking necessary at this time even! The main thing is handling long-lived borrows and reentrancy into wasm, but these clearly wouldn't be reentrant, so they should be safe to implement. Would you be up for making a PR for these? |
Taking both a Additionally - there's some amount of overlap between this functionality and what the |
While this is currently safe now, as long as no one has a live
I think the check-for-shared-memory-and-return-error is probably the best approach, and it is future compatible. |
Ah that's a good point yeah we'd just need an @fitzgen I think this could even be safe for shared memories? It's basically just a |
If we gave it the |
Feature
Currently the only way to access instance memory is with
data_unchecked[_mut]
ordata_ptr
.It would be very convenient to have methods that can atomically read or write a range of bytes, with internal locking and safety guarantees provided by the implementation.
Something like:
I'd assume this doesn't exist to prevent the need for internal locking or other implementation constraints and may even be unfeasible, but it would be a very helpful feature.
Benefit
Prevent users from needing
unsafe
and make wasmtime easier to use.Implementation
I'm not familiar with the codebase or the complications this would involve, but I'd be happy to contribute if I get some pointers.
The text was updated successfully, but these errors were encountered: