-
Notifications
You must be signed in to change notification settings - Fork 30k
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: implement query callbacks for vm #22390
Conversation
Original commit message: [api] Avoid needlessly calling descriptor interceptors Reland part of https://chromium-review.googlesource.com/c/v8/v8/+/816515. Change-Id: I72ad85ffd162fc0563fc25cdf35189e894f9dc82 Reviewed-on: https://chromium-review.googlesource.com/1138808 Commit-Queue: Timothy Gu <timothygu@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#54492} Refs: v8/v8@9eb96bb
Original commit message: [api][runtime] Support all-in ctors of {Named,Indexed}PropertyHandlerConfiguration - Explicitly allows construction of {Named,Indexed}PropertyHandlerConfiguration with all the members filled. Bug: v8:7612 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: I426ea33846b5dbf2b3482c722c963a6e4b0abded Reviewed-on: https://chromium-review.googlesource.com/1163882 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#55142} Refs: v8/v8@e1a7699
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.
Looks good!
/cc @nodejs/v8 |
This allows using a Proxy object as the sandbox for a VM context. Fixes: nodejs#17480 Fixes: nodejs#17481
Also added a section in the VM docs on how to use Proxy with vm correctly. |
Fix linting.
I was just trying to use a proxy as a |
@@ -5878,6 +5878,26 @@ enum class PropertyHandlerFlags { | |||
}; | |||
|
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.
@TimothyGu As someone not super familiar with the internals of this (me) can you explain a bit about how this is fixing the linked to issues.
descriptor(descriptor), | ||
data(data), | ||
flags(flags) {} | ||
|
||
IndexedPropertyHandlerConfiguration( |
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.
@TimothyGu I noticed in the linked to issues in the opening summary that V8 work was needed. A patch for V8 was merged but then reverted for perf reasons. Was the perf issue eventually resolved and the appropriate V8 changed landed or is this PR working around V8?
Gentle ping @TimothyGu ? I know it’s only been four days, so no hurry … |
@jdalton Take the The issue here is twofold: 1) V8 interceptors do not provide a 1:1 mapping with JavaScript internal methods, and 2) even for interceptors that are indeed provided, for one reason or another V8 doesn't call them as the spec ordinarily mandates. An example for 1) is that V8 doesn't provide a hook for [[HasProperty]] – which is what's used by the Another place 1) is in effect. There are actually two mutually exclusive flavors of V8 interceptors corresponding to the two constructors of Now here's the catch: for the purposes of the Ordinarily, that scheme works fine because we use the V8-specific However, this breaks down when My first attempt at fixing the bug was https://crrev.com/c/816515. It brings parity between QueryCallback and DescriptorCallback by calling the latter as well when evaluating After not doing much with the bug for a few months, I noticed some folks working on Chromium has been trying to migrate their stack to use the new "DescriptorCallback" flavor of interceptors but failing, because of their equivalent of #17480 and #17481. In fact, they even raised my original attempt as an option for fixing their bug, only to be pointed out that the performance is probably going to be abysmal (how I wish I had that information before spending the time to implement it…). Instead, they proposed an alternative scheme: have a third flavor of interceptors that allow both a QueryCallback and a DescriptorCallback, called an "all-in" interceptor. This way, the spec correctness provided by DescriptorCallback is guaranteed, but things like @camillobruni implemented that proposal in https://crrev.com/c/1163882 and I backported it here, and everything works now. Yay! |
Original commit message: [api] Avoid needlessly calling descriptor interceptors Reland part of https://chromium-review.googlesource.com/c/v8/v8/+/816515. Change-Id: I72ad85ffd162fc0563fc25cdf35189e894f9dc82 Reviewed-on: https://chromium-review.googlesource.com/1138808 Commit-Queue: Timothy Gu <timothygu@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#54492} PR-URL: #22390 Fixes: #17480 Fixes: #17481 Refs: v8/v8@9eb96bb Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
Original commit message: [api][runtime] Support all-in ctors of {Named,Indexed}PropertyHandlerConfiguration - Explicitly allows construction of {Named,Indexed}PropertyHandlerConfiguration with all the members filled. Bug: v8:7612 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: I426ea33846b5dbf2b3482c722c963a6e4b0abded Reviewed-on: https://chromium-review.googlesource.com/1163882 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#55142} PR-URL: #22390 Fixes: #17480 Fixes: #17481 Refs: v8/v8@e1a7699 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in fa543c0...85c356c. |
Original commit message: [api] Avoid needlessly calling descriptor interceptors Reland part of https://chromium-review.googlesource.com/c/v8/v8/+/816515. Change-Id: I72ad85ffd162fc0563fc25cdf35189e894f9dc82 Reviewed-on: https://chromium-review.googlesource.com/1138808 Commit-Queue: Timothy Gu <timothygu@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#54492} PR-URL: #22390 Fixes: #17480 Fixes: #17481 Refs: v8/v8@9eb96bb Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
Original commit message: [api][runtime] Support all-in ctors of {Named,Indexed}PropertyHandlerConfiguration - Explicitly allows construction of {Named,Indexed}PropertyHandlerConfiguration with all the members filled. Bug: v8:7612 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: I426ea33846b5dbf2b3482c722c963a6e4b0abded Reviewed-on: https://chromium-review.googlesource.com/1163882 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#55142} PR-URL: #22390 Fixes: #17480 Fixes: #17481 Refs: v8/v8@e1a7699 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
Original commit message: [api] Avoid needlessly calling descriptor interceptors Reland part of https://chromium-review.googlesource.com/c/v8/v8/+/816515. Change-Id: I72ad85ffd162fc0563fc25cdf35189e894f9dc82 Reviewed-on: https://chromium-review.googlesource.com/1138808 Commit-Queue: Timothy Gu <timothygu@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#54492} PR-URL: #22390 Fixes: #17480 Fixes: #17481 Refs: v8/v8@9eb96bb Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
Original commit message: [api][runtime] Support all-in ctors of {Named,Indexed}PropertyHandlerConfiguration - Explicitly allows construction of {Named,Indexed}PropertyHandlerConfiguration with all the members filled. Bug: v8:7612 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: I426ea33846b5dbf2b3482c722c963a6e4b0abded Reviewed-on: https://chromium-review.googlesource.com/1163882 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#55142} PR-URL: #22390 Fixes: #17480 Fixes: #17481 Refs: v8/v8@e1a7699 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
this appears to be causing fatals, see #22723 |
Original commit message: [api][runtime] Support all-in ctors of {Named,Indexed}PropertyHandlerConfiguration - Explicitly allows construction of {Named,Indexed}PropertyHandlerConfiguration with all the members filled. Bug: v8:7612 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: I426ea33846b5dbf2b3482c722c963a6e4b0abded Reviewed-on: https://chromium-review.googlesource.com/1163882 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#55142} PR-URL: nodejs#22390 Fixes: nodejs#17480 Fixes: nodejs#17481 Refs: v8/v8@e1a7699 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
Original commit message: [api][runtime] Support all-in ctors of {Named,Indexed}PropertyHandlerConfiguration - Explicitly allows construction of {Named,Indexed}PropertyHandlerConfiguration with all the members filled. Bug: v8:7612 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: I426ea33846b5dbf2b3482c722c963a6e4b0abded Reviewed-on: https://chromium-review.googlesource.com/1163882 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#55142} PR-URL: nodejs#22390 Fixes: nodejs#17480 Fixes: nodejs#17481 Refs: v8/v8@e1a7699 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
This reverts commit 85c356c from PR nodejs#22390. See the discussion in the (proposed) fix at nodejs#22836. Refs: nodejs#22836 Refs: nodejs#22390 Fixes: nodejs#22723
This reverts commit 85c356c from PR #22390. See the discussion in the (proposed) fix at #22836. Refs: #22836 Refs: #22390 Fixes: #22723 PR-URL: #22911 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This is a re-land of a commit landed as part of nodejs#22390. --- This allows using a Proxy object as the sandbox for a VM context. Refs: nodejs#22390 Fixes: nodejs#17480 Fixes: nodejs#17481 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
Some of the choices here are odd, including that symbols are missing. However, that matches previous behaviour. What had to be changed was that inherited properties are no longer included; the alternative would be to also refactor the descriptor callbacks to provide data for inherited properties. Fixes: nodejs#22723 Refs: nodejs#22390
Fixes: #17480
Fixes: #17481
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes