Skip to content

Commit 31c7c94

Browse files
zakharvoitmibrunin
authored andcommitted
[Backport] CVE-2023-6702: Type Confusion in V8
Manual backport of patch originally reviewed on https://chromium-review.googlesource.com/c/v8/v8/+/5110982: [M114-LTS][promises, async stack traces] Fix the case when the closure has run M114 changes: - replace IsNativeContext(*context) by context->IsNativeContext() We were using the closure pointing to NativeContext as a marker that the closure has run, but async stack trace code was confused about it. (cherry picked from commit bde3d360097607f36cd1d17cbe8412b84eae0a7f) Bug: chromium:1501326 Change-Id: I30d438f3b2e3fdd7562ea9a79dde4561ce9b0083 Cr-Original-Commit-Position: refs/heads/main@{#90949} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5110982 Commit-Queue: Marja Hölttä <[email protected]> Auto-Submit: Marja Hölttä <[email protected]> Cr-Commit-Position: refs/branch-heads/12.0@{#18} Cr-Branched-From: ed7b4caf1fb8184ad9e24346c84424055d4d430a-refs/heads/12.0.267@{#1} Cr-Branched-From: 210e75b19db4352c9b78dce0bae11c2dc3077df4-refs/heads/main@{#90651} (cherry picked from commit cbd09b2ca928f1fd929ef52e173aa81213e38cb8) Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/526232 Reviewed-by: Michal Klocek <[email protected]>
1 parent 7eb931b commit 31c7c94

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

chromium/v8/src/execution/isolate.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,13 @@ void CaptureAsyncStackTrace(Isolate* isolate, Handle<JSPromise> promise,
944944
builder->AppendPromiseCombinatorFrame(function, combinator,
945945
FrameArray::kIsPromiseAll, context);
946946

947-
// Now peak into the Promise.all() resolve element context to
947+
if (context->IsNativeContext()) {
948+
// NativeContext is used as a marker that the closure was already
949+
// called. We can't access the reject element context any more.
950+
return;
951+
}
952+
953+
// Now peek into the Promise.all() resolve element context to
948954
// find the promise capability that's being resolved when all
949955
// the concurrent promises resolve.
950956
int const index =
@@ -963,7 +969,13 @@ void CaptureAsyncStackTrace(Isolate* isolate, Handle<JSPromise> promise,
963969
builder->AppendPromiseCombinatorFrame(function, combinator,
964970
FrameArray::kIsPromiseAny, context);
965971

966-
// Now peak into the Promise.any() reject element context to
972+
if (context->IsNativeContext()) {
973+
// NativeContext is used as a marker that the closure was already
974+
// called. We can't access the reject element context any more.
975+
return;
976+
}
977+
978+
// Now peek into the Promise.any() reject element context to
967979
// find the promise capability that's being resolved when any of
968980
// the concurrent promises resolve.
969981
int const index = PromiseBuiltins::kPromiseAnyRejectElementCapabilitySlot;

0 commit comments

Comments
 (0)