-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(swingset): don't kernel panic upon device error
Previously, any error thrown by a device invocation would set the kernel to the "panic" state, mark the calling vat as scheduled for termination, then return an error indication to the calling vat, which makes the `syscall.callNow()` throw an exception. From the calling vat's perspective, their `D()` invocation throw a "you killed my kernel, prepare to die" error, the delivery would complete, then the entire kernel would shut down. `controller.run()` rejects its return promise, causing the host application to halt without committing state. This was fail-stop safe against surprises in the device code, but is too difficult to use in practice. Devices could not use assert() to validate caller arguments without giving the calling vat the power to shut down the entire kernel. With this change, errors during device invocation cause the calling vat to get an error, as before, but the error is neither vat-fatal nor kernel-fatal. It is still vat-fatal to pass promises in arguments to devices, where the mistake is caught by the vat's outbound translator, rather than the device's inbound translator. We'll probably relax this restriction later. The device inbound translator used to throw an error if it got a foreign device node, or a promise that somehow got past the guard above. In both cases, the translator error caused a kernel panic. This commit changes the inbound translator to handle both foreign device nodes and promises, which ought to prevent vats from triggering kernel panics via this route. Deviceslots will still reject both, but since that error occurs in the device *invocation*, the calling vat should get a (catchable) error, and the kernel will not panic. GC handling is still really sketchy around devices: do not expect objects passed to a device to ever be dropped. closes #4326
- Loading branch information
Showing
15 changed files
with
435 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.