endojs / endo

Endo is a distributed secure JavaScript sandbox, based on SES
Apache License 2.0
828 stars 72 forks source link

Bad source position for stack trace frames inside our functions #1093

Open erights opened 2 years ago

erights commented 2 years ago

At https://github.com/Agoric/agoric-sdk/runs/5297749653?check_suite_focus=true#step:4:26 we see the stack trace

Error#2: I don't remember allocating o+24
Error: I don't remember allocating (a string)
 at construct ()
 at Error (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/lockdown-subprocess-xsnap.js:7572)
 at makeError (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/lockdown-subprocess-xsnap.js:1738)
 at fail (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/lockdown-subprocess-xsnap.js:1866)
 at baseAssert (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/lockdown-subprocess-xsnap.js:1884)
 at convertSlotToVal (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/supervisor-subprocess-xsnap.js:14012)
 at unserializeSlot (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/supervisor-subprocess-xsnap.js:5326)
 at fullRevive (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/supervisor-subprocess-xsnap.js:5453)
 at fullRevive (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/supervisor-subprocess-xsnap.js:5507)
 at fullRevive (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/supervisor-subprocess-xsnap.js:5496)
 at fullRevive (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/supervisor-subprocess-xsnap.js:5507)
 at unserialize (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/supervisor-subprocess-xsnap.js:55[30](https://github.com/Agoric/agoric-sdk/runs/5297749653?check_suite_focus=true#step:4:30))
 at runWithoutMetering (/home/runner/work/agoric-sdk/agoric-sdk/packages/SwingSet/src/kernel/vatManager/supervisor-subprocess-xsnap.js:15003)
 at (.../ertp/src/paymentLedger.js:177)
 at (.../eventual-send/src/track-turns.js:66)

Even weirder, the source file mentioned exists at https://github.com/Agoric/agoric-sdk/blob/markm-virtualize-ERTP/packages/SwingSet/src/kernel/vatManager/supervisor-subprocess-xsnap.js but has only 368 lines.

dckc commented 2 years ago

Due to living at such a low level in the xsnap bootstrap, supervisor-subprocess-xsnap.js is bundled using bundleSource(..., { format: 'getExport' }), which isn't as nice about line numbers as the default format.

https://github.com/Agoric/agoric-sdk/blob/43ad08f4effc94aed8be34ba0d662761838bcf16/packages/SwingSet/src/initializeSwingset.js#L47-L62

I suggest narrowing the scope of this issue to the 2 bundles used to bootstrap SwingSet vats (lockdownBundle, supervisorBundle)... or perhaps to something around getExport.

I think the shortest path to addressing this is via using native XS Compartments (#400).

erights commented 1 year ago

What's the status of this?

kriskowal commented 10 months ago

What's the status of this?

We still haven’t given this issue due attention. Added a label recommending team review for prioritization.