Repository navigation
fix(build): verify Math constants in runtime snapshot - #726
Conversation
57077e6 to
17eb6f3
Compare
|
@nyannyacha this is the recurrence guard for #723 (the wrong The CI run from August expired while waiting for approval, so I rebased onto current |
|
Thanks for working on this! But the issue with some of the math constants in the amd64 snapshot differing from expectations doesn't appear to be a GHA (actually, Blacksmith) build cache problem. Could you investigate further? It may be related to V8, but I don't have the bandwidth to dig into that right now. |
|
Update: root cause found, details in #723 (comment). The prebuilt x86_64 So the red CI is the check working. I'd keep the hard failure as is: once the fork's x86_64 binary is rebuilt on native x86_64 Linux this PR goes green without changes, and it will catch the same class of problem if a bad binary is ever published again. If you'd rather have CI green in the meantime, I can gate it to release builds and emit |
|
I rebuilt the x86_64 library and confirmed the relevant Math constants are now populated correctly. |
|
You're right, sorry for the crash: The CI run for the new commit is waiting for approval. It should pass now that the fixed archive is published. |
nyannyacha
left a comment
There was a problem hiding this comment.
LGTM
Thanks for your effort! 😸
Summary
Follow-up to #723 — this prevents recurrence; it does not fix the already-published amd64 images. V8 computes
Math.E,Math.LN10,Math.LN2,Math.LOG10E, andMath.LOG2Eonce, inside mksnapshot when the V8 library is built.crates/base/build.rsinherits them through V8's embedded default snapshot and freezes them into the startup snapshot every worker boots from, so a bad V8 build ships wrong constants to every user and nothing in the pipeline could catch it (root cause: #723 (comment)).This PR hooks
CreateSnapshotOptions::with_runtime_cb, reads the eightMathconstants through the V8 API right before the snapshot is serialized, and panics on any bit-level mismatch, failing the build before the snapshot is written to disk:Notes on the approach:
Limitations
librusty_v8.Validation
cargo build -p basepasses; corrupting one expected value fails the build (exit 101) with the message above.librusty_v8archives contain all eight constants.