Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Deterministic serialisation for cross binary communication #4567
Deterministic serialisation for cross binary communication #4567
Changes from 3 commits
ab71d75
162a673
1a80c4e
e4a197d
c357dcd
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I think we need an additional section of "serialization can lead to bad things", "this can be an attack model on pony programs and should only be used with trusted input", and what not.
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.
hmmm.. the
serialise
package currently has the following (some/all of which can be copied to the release notes and also be updated for the changes in this PR):a few notes to ensure everyone understands the full scope/limitations of this PR:
i missed this in the changes so far and this method needs to be updated to return the signature of the target pony runtime rather than the program..
with this PR, we can only
maintain a well-formed heap and all object invariants
if the binary doing thedeserialisation
knows/uses all the types that were used forserialisation
or else the program will assert/fail withponyint_assert_fail("deserialise offset invalid", __FILE__, __LINE__, __func__)
duringdeserialisation
(deserialise offset invalid
probably needs rewording to be more explicit about the issue/error)..maintain a well-formed heap and all object invariants
cannot be guaranteed for all combinations of programs because theserialise_id
is only based on thetype name
and not the type'sname and fields/memory layout
(orfull ast
).. unfortunately, this will cause data corruption (and possibly memory clobbering) and not an assert/fail like the previous bullet because theserialise_id
will be the same between the two binaries even though it shouldn't be (because a type's field layout changed) due to the limitation on howserialise_id
is determined currently..given the above, especially the second bullet under
2
, maybe this PR should be reframed to beinternal changes in support of cross binary serialisation
until theserialise_id
can be based on either thefull ast
or thename and fields/memory layout
for each type to remove that caveat/concern (if so, it would make sense to defer updatingSerialise.signature
until that time also)?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.
So basically, this doesn't get a changelog entry for now and we don't tell people about the change. that is my interpretation of "internal". is that yours?
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.
yes, unless we're ok with the large footgun that is
the second bullet under "2"
..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.
yup. i think internal is a good idea. i'll remove the label. you can remove the release notes if you want, otherwise the bot will toss them on merge.
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.
gonna leave it.. gotta keep the bots employed or they might revolt...
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.
@dipinhora we discussed this during sync. can you update the serialization package documentation to note the changes that were documented in the release notes here?
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.
and remove the release notes.
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.
sure.. but technically:
isn't true because the Serialise.signature function still generates a signature that is unique to each program and the
serialise
package recommends using it as a safeguard to ensure that serialisation will be safe to use..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.
serialise package docs updated and release notes removed..
note: the serialise package docs are technically no longer correct as per my last comment (#4567 (comment)) because the Serialise.signature function still generates a signature that is unique to each program and the serialise package recommends using it as a safeguard to ensure that serialisation will be safe to use and this will prevent cross binary serialisation from working if that recommendation is followed because the signatures will not match..