-
Notifications
You must be signed in to change notification settings - Fork 212
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
comms doesn't set up reverse mapping for promises correctly #1404
Comments
This was referenced Aug 17, 2020
warner
added a commit
that referenced
this issue
Aug 28, 2020
This overhauls the comms vat to use a new reference-tracking model. It should fix a number of gaps where the previous code would throw an error: * pass an already-resolved Promise through any message, this would make the comms vat re-use a retired VPID, which is a vat-fatal error * resolve a remotely-sourced promise to a local object (rather than a remote one), then pipeline a message to it (so the message should be reflected back into the kernel) * resolve a local promise to a remote object, then the remote pipelines a message to it (so the message should be reflected back out to the remote) * passing one remote's references to a different remote The last case is the "three-party handoff". The full solution (with shortening, grant-matching, and automatic connection establishment) is quite a ways off, but this change ought to implement "three-party forwarding". In this form, when A sends B a reference to C, what B gets is effectively an object on A that automatically forwards all messages off to C. This "object" is hidden inside the comms vat and is not reified as a real object. Three-party forwarding is not tested yet. refs #1535 refs #1404
warner
added a commit
that referenced
this issue
Aug 28, 2020
This overhauls the comms vat to use a new reference-tracking model. It should fix a number of gaps where the previous code would throw an error: * pass an already-resolved Promise through any message, this would make the comms vat re-use a retired VPID, which is a vat-fatal error * resolve a remotely-sourced promise to a local object (rather than a remote one), then pipeline a message to it (so the message should be reflected back into the kernel) * resolve a local promise to a remote object, then the remote pipelines a message to it (so the message should be reflected back out to the remote) * passing one remote's references to a different remote The last case is the "three-party handoff". The full solution (with shortening, grant-matching, and automatic connection establishment) is quite a ways off, but this change ought to implement "three-party forwarding". In this form, when A sends B a reference to C, what B gets is effectively an object on A that automatically forwards all messages off to C. This "object" is hidden inside the comms vat and is not reified as a real object. Three-party forwarding is not tested yet. refs #1535 refs #1404
warner
added a commit
that referenced
this issue
Aug 28, 2020
This overhauls the comms vat to use a new reference-tracking model. It should fix a number of gaps where the previous code would throw an error: * pass an already-resolved Promise through any message, this would make the comms vat re-use a retired VPID, which is a vat-fatal error * resolve a remotely-sourced promise to a local object (rather than a remote one), then pipeline a message to it (so the message should be reflected back into the kernel) * resolve a local promise to a remote object, then the remote pipelines a message to it (so the message should be reflected back out to the remote) * passing one remote's references to a different remote The last case is the "three-party handoff". The full solution (with shortening, grant-matching, and automatic connection establishment) is quite a ways off, but this change ought to implement "three-party forwarding". In this form, when A sends B a reference to C, what B gets is effectively an object on A that automatically forwards all messages off to C. This "object" is hidden inside the comms vat and is not reified as a real object. Three-party forwarding is not tested yet. refs #1535 refs #1404
I ended up fixing this (and a slew of other problems) by rewriting the comms vat entirely, in PR #1635 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
While investigating #1400, I noticed a problem in
mapInbound
. For objects, we correctly populate the per-remote table with to/from entries that flip the remote identifier's ownership polarity:agoric-sdk/packages/SwingSet/src/vats/comms/clist.js
Lines 174 to 187 in 1685098
to honor the specification:
agoric-sdk/packages/SwingSet/src/vats/comms/remote.js
Lines 27 to 40 in 1685098
however when we allocate a new promise, we fail to flip the
toRemote
side:agoric-sdk/packages/SwingSet/src/vats/comms/clist.js
Lines 188 to 196 in 1685098
When the inbound promise appeared as a
result
, we fix it up inmapInboundResult
:agoric-sdk/packages/SwingSet/src/vats/comms/clist.js
Lines 214 to 228 in 1685098
but we'll fail to do that for promises that appear anywhere else, like in arguments of an inbound message, or in a record used to resolve some other promise to data.
The consequence is that when we try to send these objects back to the sender, we'll give them an identifier with the wrong polarity. At best, they'll refuse the message because they don't recognize the promise ID. At worst, it will map to some unrelated promise, which would be an exciting security bug.
TODO items for me:
message-patterns
, the "comms" flavor) of a new argument promise being sent back to the sendermapInbound
to flip the direction of the remote identifier we use intoRemote
mapInboundResult
to not modify toRemote/fromRemote at allThe text was updated successfully, but these errors were encountered: