Skip to content

Commit d9c96af

Browse files
zakharvoitmibrunin
authored andcommitted
[Backport] CVE-2023-6702: Type Confusion in V8
Cherry-pick of patch originally reviewed on https://chromium-review.googlesource.com/c/v8/v8/+/5110982: 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/+/526350 Reviewed-by: Michal Klocek <[email protected]>
1 parent 400d873 commit d9c96af

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

chromium/v8/src/execution/isolate.cc

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,13 @@ void CaptureAsyncStackTrace(Isolate* isolate, Handle<JSPromise> promise,
10221022
isolate);
10231023
builder->AppendPromiseCombinatorFrame(function, combinator);
10241024

1025-
// Now peak into the Promise.all() resolve element context to
1025+
if (context->IsNativeContext()) {
1026+
// NativeContext is used as a marker that the closure was already
1027+
// called. We can't access the reject element context any more.
1028+
return;
1029+
}
1030+
1031+
// Now peek into the Promise.all() resolve element context to
10261032
// find the promise capability that's being resolved when all
10271033
// the concurrent promises resolve.
10281034
int const index =
@@ -1041,7 +1047,13 @@ void CaptureAsyncStackTrace(Isolate* isolate, Handle<JSPromise> promise,
10411047
context->native_context().promise_all_settled(), isolate);
10421048
builder->AppendPromiseCombinatorFrame(function, combinator);
10431049

1044-
// Now peak into the Promise.allSettled() resolve element context to
1050+
if (context->IsNativeContext()) {
1051+
// NativeContext is used as a marker that the closure was already
1052+
// called. We can't access the reject element context any more.
1053+
return;
1054+
}
1055+
1056+
// Now peek into the Promise.allSettled() resolve element context to
10451057
// find the promise capability that's being resolved when all
10461058
// the concurrent promises resolve.
10471059
int const index =
@@ -1059,7 +1071,13 @@ void CaptureAsyncStackTrace(Isolate* isolate, Handle<JSPromise> promise,
10591071
isolate);
10601072
builder->AppendPromiseCombinatorFrame(function, combinator);
10611073

1062-
// Now peak into the Promise.any() reject element context to
1074+
if (context->IsNativeContext()) {
1075+
// NativeContext is used as a marker that the closure was already
1076+
// called. We can't access the reject element context any more.
1077+
return;
1078+
}
1079+
1080+
// Now peek into the Promise.any() reject element context to
10631081
// find the promise capability that's being resolved when any of
10641082
// the concurrent promises resolve.
10651083
int const index = PromiseBuiltins::kPromiseAnyRejectElementCapabilitySlot;

0 commit comments

Comments
 (0)