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

chore: bump Rust and cargo update #735

Merged
merged 8 commits into from
May 10, 2024
Merged

Conversation

mmastrac
Copy link
Contributor

@mmastrac mmastrac commented May 10, 2024

We bump Rust to 1.78, but for the tests to pass we need to remove the UB that we've been relying on:

  1. Opaque pointers no longer rely on values on the stack (!)
  2. We no longer take a &mut from a u64 that comes from a & (UB)
  3. ToV8Buffer gets a RefCell for proper interior mutability

Lots of sketchiness left in serde_v8 but hopefully this fixes the major fire.

serde_v8 is considered deprecated so we're likely not going to touch this code much more than this band-aid.

Copy link
Member

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSLGTM

@mmastrac mmastrac mentioned this pull request May 10, 2024
// SAFETY: transerialization assumptions imply `T` is still alive.
let x: &mut T = unsafe { opaque_deref_mut(self.opaque) };
let x: &T =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not only unsafe, but UB -- we turned a ref into a pointer into a u64 into a &mut.

Copy link
Member

@nathanwhit nathanwhit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, looks a lot better (and is now not clearly unsound)

@mmastrac mmastrac merged commit 0c7f83e into denoland:main May 10, 2024
18 checks passed
mmastrac added a commit to denoland/deno that referenced this pull request May 10, 2024
dsherret pushed a commit to denoland/deno that referenced this pull request May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants