Skip to content

Commit 1b11c2d

Browse files
marjakhmibrunin
authored andcommitted
[Backport] CVE-2023-6702: Type Confusion in V8
Manual cherry-pick of patch originally reviewed on https://chromium-review.googlesource.com/c/v8/v8/+/5110982: Merged: [promises, async stack traces] Fix the case when the closure has run 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]> Reviewed-by: Shu-yu Guo <[email protected]> Reviewed-by: Igor Sheludko <[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} Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/526277 Reviewed-by: Michal Klocek <[email protected]>
1 parent b016178 commit 1b11c2d

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

chromium/v8/src/execution/isolate.cc

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

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

1042-
// Now peak into the Promise.allSettled() resolve element context to
1048+
if (IsNativeContext(*context)) {
1049+
// NativeContext is used as a marker that the closure was already
1050+
// called. We can't access the reject element context any more.
1051+
return;
1052+
}
1053+
1054+
// Now peek into the Promise.allSettled() resolve element context to
10431055
// find the promise capability that's being resolved when all
10441056
// the concurrent promises resolve.
10451057
int const index =
@@ -1057,7 +1069,12 @@ void CaptureAsyncStackTrace(Isolate* isolate, Handle<JSPromise> promise,
10571069
isolate);
10581070
builder->AppendPromiseCombinatorFrame(function, combinator);
10591071

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

0 commit comments

Comments
 (0)