Skip to content
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

[v20.x] deps: cherry-pick V8 fixes for CVE-2023-3420 and others #50077

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.20',
'v8_embedder_string': '-node.25',

##### V8 defaults for Node.js #####

Expand Down
2 changes: 2 additions & 0 deletions deps/v8/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Kyounga Ra <[email protected]>
Loo Rong Jie <[email protected]>
Lu Yahan <[email protected]>
Luis Reis <[email protected]>
Luke Albao <[email protected]>
Luke Zarko <[email protected]>
Ma Aiguo <[email protected]>
Maciej Małecki <[email protected]>
Expand Down Expand Up @@ -239,6 +240,7 @@ Sakthipriyan Vairamani (thefourtheye) <[email protected]>
Sander Mathijs van Veen <[email protected]>
Sandro Santilli <[email protected]>
Sanjoy Das <[email protected]>
Sam James <[email protected]>
Seo Sanghyeon <[email protected]>
Shawn Anastasio <[email protected]>
Shawn Presser <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/compiler/js-operator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ const Operator* JSOperatorBuilder::CloneObject(FeedbackSource const& feedback,
const Operator* JSOperatorBuilder::StackCheck(StackCheckKind kind) {
return zone()->New<Operator1<StackCheckKind>>( // --
IrOpcode::kJSStackCheck, // opcode
Operator::kNoWrite, // properties
Operator::kNoProperties, // properties
"JSStackCheck", // name
0, 1, 1, 0, 1, 2, // counts
kind); // parameter
Expand Down
5 changes: 2 additions & 3 deletions deps/v8/src/diagnostics/perf-jit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "src/codegen/assembler.h"
#include "src/codegen/source-position-table.h"
#include "src/diagnostics/eh-frame.h"
#include "src/objects/code-kind.h"
#include "src/objects/objects-inl.h"
#include "src/objects/shared-function-info.h"
#include "src/snapshot/embedded/embedded-data.h"
Expand Down Expand Up @@ -222,9 +223,7 @@ void LinuxPerfJitLogger::LogRecordedBuffer(
DisallowGarbageCollection no_gc;
if (v8_flags.perf_basic_prof_only_functions) {
CodeKind code_kind = abstract_code.kind(isolate_);
if (code_kind != CodeKind::INTERPRETED_FUNCTION &&
code_kind != CodeKind::TURBOFAN && code_kind != CodeKind::MAGLEV &&
code_kind != CodeKind::BASELINE) {
if (!CodeKindIsJSFunction(code_kind)) {
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/execution/isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5228,8 +5228,8 @@ MaybeHandle<FixedArray> Isolate::GetImportAssertionsFromArgument(
for (int i = 0; i < assertion_keys->length(); i++) {
Handle<String> assertion_key(String::cast(assertion_keys->get(i)), this);
Handle<Object> assertion_value;
if (!JSReceiver::GetProperty(this, import_assertions_object_receiver,
assertion_key)
if (!Object::GetPropertyOrElement(this, import_assertions_object_receiver,
assertion_key)
.ToHandle(&assertion_value)) {
// This can happen if the property has a getter function that throws
// an error.
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/heap/cppgc/stats-collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>

#include <algorithm>
#include <atomic>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/logging/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ void LinuxPerfBasicLogger::LogRecordedBuffer(AbstractCode code,
DisallowGarbageCollection no_gc;
PtrComprCageBase cage_base(isolate_);
if (v8_flags.perf_basic_prof_only_functions &&
CodeKindIsBuiltinOrJSFunction(code.kind(cage_base))) {
!CodeKindIsBuiltinOrJSFunction(code.kind(cage_base))) {
return;
}

Expand Down
6 changes: 6 additions & 0 deletions deps/v8/src/objects/js-function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,10 @@ void SetInstancePrototype(Isolate* isolate, Handle<JSFunction> function,
// At that point, a new initial map is created and the prototype is put
// into the initial map where it belongs.
function->set_prototype_or_initial_map(*value, kReleaseStore);
if (value->IsJSObjectThatCanBeTrackedAsPrototype()) {
// Optimize as prototype to detach it from its transition tree.
JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(value));
}
} else {
Handle<Map> new_map =
Map::Copy(isolate, initial_map, "SetInstancePrototype");
Expand Down Expand Up @@ -801,8 +805,10 @@ void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) {
Handle<HeapObject> prototype;
if (function->has_instance_prototype()) {
prototype = handle(function->instance_prototype(), isolate);
map->set_prototype(*prototype);
} else {
prototype = isolate->factory()->NewFunctionPrototype(function);
Map::SetPrototype(isolate, map, prototype);
}
DCHECK(map->has_fast_object_elements());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ var life;
import('modules-skip-1.json', { assert: { type: 'json', notARealAssertion: 'value' } }).then(
namespace => life = namespace.default.life);

var life2;
import('modules-skip-1.json', { assert: { 0: 'value', type: 'json' } }).then(
namespace => life2 = namespace.default.life);

%PerformMicrotaskCheckpoint();

assertEquals(42, life);
assertEquals(42, life2);