Commit 32af9c04 authored by Maya Lekova's avatar Maya Lekova Committed by V8 LUCI CQ

[fastcall] Fix null deref in concurrent access to the simulator

This CL fixes a null dereference when an attempt is made to access
the current arm64 simulator from a background thread.

Bug: chromium:1267491
Change-Id: I9232fe134fccbff162eb5076aff20884872e4cc7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3264219
Auto-Submit: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77757}
parent c9d23462
......@@ -184,10 +184,8 @@ ExternalReference ExternalReference::Create(
Isolate* isolate, ApiFunction* fun, Type type, Address* c_functions,
const CFunctionInfo* const* c_signatures, unsigned num_functions) {
#ifdef USE_SIMULATOR_WITH_GENERIC_C_CALLS
isolate->CurrentPerIsolateThreadData()
->simulator()
->RegisterFunctionsAndSignatures(c_functions, c_signatures,
num_functions);
Simulator::current(isolate)->RegisterFunctionsAndSignatures(
c_functions, c_signatures, num_functions);
#endif // USE_SIMULATOR_WITH_GENERIC_C_CALLS
return ExternalReference(Redirect(fun->address(), type));
}
......
......@@ -424,9 +424,7 @@ MachineType machine_type = MachineType::Int64();
#define IF_SIMULATOR_ADD_SIGNATURE \
EncodedCSignature sig = m.call_descriptor()->ToEncodedCSignature(); \
m.main_isolate() \
->CurrentPerIsolateThreadData() \
->simulator() \
Simulator::current(m.main_isolate()) \
->AddSignatureForTargetForTesting(func_address, sig);
#else // def USE_SIMULATOR_WITH_GENERIC_C_CALLS
#define IF_SIMULATOR_ADD_SIGNATURE
......
......@@ -6706,9 +6706,7 @@ TEST(RunCallCFunction9) {
#ifdef USE_SIMULATOR_WITH_GENERIC_C_CALLS
#define IF_SIMULATOR_ADD_SIGNATURE \
EncodedCSignature sig = m.call_descriptor()->ToEncodedCSignature(); \
m.main_isolate() \
->CurrentPerIsolateThreadData() \
->simulator() \
Simulator::current(m.main_isolate()) \
->AddSignatureForTargetForTesting(func_address, sig);
#else
#define IF_SIMULATOR_ADD_SIGNATURE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment