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

Instance host_state not required to be Sync, yet can be accessed from multiple threads at the same time. #1630

Closed
bjorn3 opened this issue Sep 17, 2020 · 3 comments · Fixed by #2892
Assignees
Labels
priority-medium Medium priority issue 🔈soundness Bugs causing an unsound API
Milestone

Comments

@bjorn3
Copy link

bjorn3 commented Sep 17, 2020

host_state: Box<dyn Any>,

  1. Create new InstanceHandle
  2. Clone InstanceHandle
  3. Send clone to another thread
  4. Call handle.host_state() on both handles
  5. You now have a reference to a non-sync type in two threads. This is UB and may for example be exploited by using RefCell as host_state to get a race-condition.
@syrusakbary
Copy link
Member

Thanks for opening the issue @bjorn3!

Here's the related bug reported in wasmtime: bytecodealliance/wasmtime#793 for future readers.

Possible solution

Since we are not longer using host_state perhaps we can get rid of it directly

@MarkMcCaskey MarkMcCaskey added 1.0 Wasmer at 1.0 🔈soundness Bugs causing an unsound API labels Sep 21, 2020
@Hywan Hywan removed the 1.0 Wasmer at 1.0 label Jul 16, 2021
@syrusakbary syrusakbary added the priority-medium Medium priority issue label Oct 20, 2021
@syrusakbary syrusakbary assigned Amanieu and unassigned syrusakbary Oct 20, 2021
@syrusakbary syrusakbary added this to the v3.0 milestone Apr 27, 2022
@syrusakbary
Copy link
Member

Thanks for creating the issue. We are working on refactoring our API for Wasmer 3.0

@syrusakbary
Copy link
Member

This issue will be fixed in wasmer3 (already fixed in the wasmer3 branch)

@bors bors bot closed this as completed in #2892 Jul 19, 2022
@bors bors bot closed this as completed in 06474c1 Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-medium Medium priority issue 🔈soundness Bugs causing an unsound API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants