-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
src: zero-initialize data that are copied into the snapshot #53563
base: main
Are you sure you want to change the base?
Conversation
…ding" This reverts commit 4e58cde.
To prevent padding from making the snapshot unreproducible, zero-initialize the data that are copied into the snapshot so that the padding copied are all zeros. This is better than enlarging the enums to align the fields since it doesn't make the snapshot bigger than necessary, and it removes the need of using static assertions to ensure alignment.
Review requested:
|
cc original reviewers of #50983 @lemire @jasnell @legendecas |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
e99dc36
to
af91d7d
Compare
For some reason, the value-initialize trick is not working in dynamically linked builds. So I removed the update and got the branch back to the original shape. |
It should work as it is specified in the standard. The compiler basically calls But the explicit I think that the code as it stands now is fine. |
The tests are still broken, so it may be something that landed in the main branch after cd8e61f that broke it (or could be the build infra?) |
FWIW It started showing up in the reliability reports since yesterday: nodejs/reliability#905 |
4c730ae may have exacerbated the issue, but not caused it. See #53583 (comment) |
This reverts one commit from #50983 because I found a better & simpler approach to prevent the padding from affecting snapshot reproducibility (in the second commit).
Revert "src: make sure that memcpy-ed structs in snapshot have no padding"
This reverts commit 4e58cde.
src: zero-initialize data that are copied into the snapshot
To prevent padding from making the snapshot unreproducible,
zero-initialize the data that are copied into the snapshot
so that the padding copied are all zeros. This is better
than enlarging the enums to align the fields since it doesn't
make the snapshot bigger than necessary, and it removes the
need of using static assertions to ensure alignment.
Refs: #50983