-
Notifications
You must be signed in to change notification settings - Fork 98
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
Fix: Start Wasm table for the RTS at offset >= 1 #4685
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why didn't the bytecode-verifier in the replica catch this? Do we have Motoko-compiled canisters out there with this bug baked-in?
It is actually only a requirement by Rust, not Wasm. It only affects debug Rust compilation AFAIK. I believe people probably do not release debug Motoko code. So, probably it is okay. |
Co-authored-by: Gabor Greif <gabor@dfinity.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me!
Thank you for the review, Claudio and Gabor! |
Rust requires a table offset of at least 1 as the element index 0 is considered invalid and causes a debug null check to panic when called. On the other hand,
elem[0]
can be used by the Motoko backend code, as correct Rust-generated Wasm code does not callelem[0]
.This bug is independent of
wasm32
andwasm64
.This issue has been observed in https://github.com/dfinity/motoko/actions/runs/10703077671/job/29672766216?pr=4683 and happened only on Linux and only under
nix-build
(notnix-shell
).