Changeset 260223 in webkit
- Timestamp:
- Apr 16, 2020 3:35:23 PM (4 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r260222 r260223 1 2020-04-16 Mark Lam <mark.lam@apple.com> 2 3 [Re-landing] Use more PAC diversity for JIT probe code. 4 https://bugs.webkit.org/show_bug.cgi?id=210252 5 <rdar://problem/54490367> 6 7 Reviewed by Keith Miller. 8 9 Introducing new PtrTags: 10 JITProbePtrTag - for the client probe function. 11 JITProbeTrampolinePtrTag - for calling the ctiMasmProbeTrampoline. 12 JITProbeExecutorPtrTag - for calling the probe executor. 13 Currently, this is only the Probe::executeProbe(). 14 JITProbeStackInitializationFunctionPtrTag - for calling the optional stack 15 initialization function that the client probe function may set. 16 17 We'll now use these in the JIT probe mechanism instead of adopting the default 18 CFunctionPtrTag. 19 20 Fixed an assert in MacroAssemblerARM64.cpp which does not apply to non ARM64E 21 builds. 22 23 * assembler/MacroAssembler.cpp: 24 (JSC::MacroAssembler::probe): 25 * assembler/MacroAssemblerARM64.cpp: 26 (JSC::MacroAssembler::probe): 27 * assembler/MacroAssemblerPrinter.h: 28 (JSC::MacroAssembler::print): 29 * assembler/ProbeContext.h: 30 * runtime/JSCPtrTag.h: 31 * tools/JSDollarVM.cpp: 32 (JSC::callWithStackSizeProbeFunction): 33 * wasm/WasmAirIRGenerator.cpp: 34 (JSC::Wasm::AirIRGenerator::emitLoopTierUpCheck): 35 * wasm/WasmB3IRGenerator.cpp: 36 (JSC::Wasm::B3IRGenerator::emitLoopTierUpCheck): 37 1 38 2020-04-16 Mark Lam <mark.lam@apple.com> 2 39 -
trunk/Source/JavaScriptCore/assembler/MacroAssembler.cpp
r260222 r260223 29 29 #if ENABLE(ASSEMBLER) 30 30 31 #include "JSCPtrTag.h" 31 32 #include "Options.h" 32 33 #include "ProbeContext.h" … … 56 57 void MacroAssembler::probe(Function<void(Probe::Context&)> func) 57 58 { 58 probe( stdFunctionCallback, new Function<void(Probe::Context&)>(WTFMove(func)));59 probe(tagCFunction<JITProbePtrTag>(stdFunctionCallback), new Function<void(Probe::Context&)>(WTFMove(func))); 59 60 } 61 60 62 #endif // ENABLE(MASM_PROBE) 61 63 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.cpp
r260222 r260223 29 29 #include "MacroAssembler.h" 30 30 31 #include "JSCPtrTag.h" 31 32 #include "ProbeContext.h" 32 33 #include <wtf/InlineASM.h> … … 298 299 static_assert(!(sizeof(LRRestorationRecord) & 0xf), "LRRestorationRecord must be 16-byte aligned"); 299 300 301 #if CPU(ARM64E) 302 #define JIT_PROBE_EXECUTOR_PTR_TAG 0x28de 303 #define JIT_PROBE_STACK_INITIALIZATION_FUNCTION_PTR_TAG 0x315c 304 static_assert(JIT_PROBE_EXECUTOR_PTR_TAG == JITProbeExecutorPtrTag); 305 static_assert(JIT_PROBE_STACK_INITIALIZATION_FUNCTION_PTR_TAG == JITProbeStackInitializationFunctionPtrTag); 306 #endif 307 300 308 // We use x29 and x30 instead of fp and lr because GCC's inline assembler does not recognize fp and lr. 301 309 // See https://bugs.webkit.org/show_bug.cgi?id=175512 for details. … … 383 391 "mov x0, sp" "\n" // Set the Probe::State* arg. 384 392 #if CPU(ARM64E) 385 "blraaz x28" "\n" // Call the probe handler. 393 "movz lr, #" STRINGIZE_VALUE_OF(JIT_PROBE_EXECUTOR_PTR_TAG) "\n" 394 "blrab x28, lr" "\n" // Call the probe handler. 386 395 #else 387 396 "blr x28" "\n" // Call the probe handler. … … 423 432 "mov x0, x27" "\n" // Set the Probe::State* arg. 424 433 #if CPU(ARM64E) 425 "blraaz x2" "\n" // Call the initializeStackFunction (loaded into x2 above). 434 "movz lr, #" STRINGIZE_VALUE_OF(JIT_PROBE_STACK_INITIALIZATION_FUNCTION_PTR_TAG) "\n" 435 "blrab x2, lr" "\n" // Call the initializeStackFunction (loaded into x2 above).all the probe handler. 426 436 #else 427 437 "blr x2" "\n" // Call the initializeStackFunction (loaded into x2 above). … … 532 542 storePair64(x26, x27, sp, TrustedImm32(offsetof(IncomingProbeRecord, x26))); 533 543 storePair64(x28, x30, sp, TrustedImm32(offsetof(IncomingProbeRecord, x28))); // Note: x30 is lr. 534 move(TrustedImmPtr(reinterpret_cast<void*>(ctiMasmProbeTrampoline)), x26); 535 move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeProbe)), x28); 544 move(TrustedImmPtr(tagCFunction<JITProbeTrampolinePtrTag>(ctiMasmProbeTrampoline)), x26); 545 move(TrustedImmPtr(tagCFunction<JITProbeExecutorPtrTag>(Probe::executeProbe)), x28); 546 #if CPU(ARM64E) 547 ASSERT(isTaggedWith(function, JITProbePtrTag)); 548 #endif 536 549 move(TrustedImmPtr(reinterpret_cast<void*>(function)), x24); 537 550 move(TrustedImmPtr(arg), x25); 538 call(x26, CFunctionPtrTag);551 call(x26, JITProbeTrampolinePtrTag); 539 552 540 553 // ctiMasmProbeTrampoline should have restored every register except for lr and the sp. … … 578 591 579 592 #endif // ENABLE(ASSEMBLER) && CPU(ARM64) 580 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.h
r260222 r260223 26 26 #pragma once 27 27 28 #include "JSCPtrTag.h" 28 29 #include "MacroAssembler.h" 29 30 #include "Printer.h" … … 233 234 { 234 235 auto printRecordList = Printer::makePrintRecordList(std::forward<Arguments>(arguments)...); 235 probe( Printer::printCallback, printRecordList);236 probe(tagCFunction<JITProbePtrTag>(Printer::printCallback), printRecordList); 236 237 } 237 238 238 239 inline void MacroAssembler::print(Printer::PrintRecordList* printRecordList) 239 240 { 240 probe( Printer::printCallback, printRecordList);241 probe(tagCFunction<JITProbePtrTag>(Printer::printCallback), printRecordList); 241 242 } 242 243 -
trunk/Source/JavaScriptCore/assembler/ProbeContext.h
r260222 r260223 176 176 typedef void (*StackInitializationFunction)(State*); 177 177 178 #if CPU(ARM64E) 179 #define PROBE_FUNCTION_PTRAUTH __ptrauth(ptrauth_key_process_dependent_code, 0, JITProbePtrTag) 180 #define PROBE_STACK_INITIALIZATION_FUNCTION_PTRAUTH __ptrauth(ptrauth_key_process_dependent_code, 0, JITProbeStackInitializationFunctionPtrTag) 181 #else 182 #define PROBE_FUNCTION_PTRAUTH 183 #define PROBE_STACK_INITIALIZATION_FUNCTION_PTRAUTH 184 #endif 185 178 186 struct State { 179 Probe::Function probeFunction;187 Probe::Function PROBE_FUNCTION_PTRAUTH probeFunction; 180 188 void* arg; 181 StackInitializationFunction initializeStackFunction;189 StackInitializationFunction PROBE_STACK_INITIALIZATION_FUNCTION_PTRAUTH initializeStackFunction; 182 190 void* initializeStackArg; 183 191 CPUState cpu; -
trunk/Source/JavaScriptCore/runtime/JSCPtrTag.h
r260222 r260223 40 40 v(ExceptionHandlerPtrTag) \ 41 41 v(ExecutableMemoryPtrTag) \ 42 v(JITProbePtrTag) \ 43 v(JITProbeTrampolinePtrTag) \ 44 v(JITProbeExecutorPtrTag) \ 45 v(JITProbeStackInitializationFunctionPtrTag) \ 42 46 v(JITThunkPtrTag) \ 43 47 v(JITStubRoutinePtrTag) \ -
trunk/Source/JavaScriptCore/tools/JSDollarVM.cpp
r260222 r260223 1 1 /* 2 * Copyright (C) 2015-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 2137 2137 { 2138 2138 JSGlobalObject* globalObject = bitwise_cast<JSGlobalObject*>(state->arg); 2139 JSFunction* function = bitwise_cast<JSFunction*>(state->probeFunction); 2139 // The bits loaded from state->probeFunction will be tagged like 2140 // a C function. So, we'll need to untag it to extract the bits 2141 // for the JSFunction*. 2142 JSFunction* function = bitwise_cast<JSFunction*>(untagCodePtr<CFunctionPtrTag>(state->probeFunction)); 2140 2143 state->initializeStackFunction = nullptr; 2141 2144 state->initializeStackArg = nullptr; -
trunk/Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp
r260222 r260223 1 1 /* 2 * Copyright (C) 2019 Apple Inc. All rights reserved.2 * Copyright (C) 2019-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 1827 1827 tierUp.link(&jit); 1828 1828 1829 jit.probe( operationWasmTriggerOSREntryNow, osrEntryDataPtr);1829 jit.probe(tagCFunction<JITProbePtrTag>(operationWasmTriggerOSREntryNow), osrEntryDataPtr); 1830 1830 jit.branchTestPtr(CCallHelpers::Zero, GPRInfo::argumentGPR0).linkTo(tierUpResume, &jit); 1831 1831 jit.farJump(GPRInfo::argumentGPR1, WasmEntryPtrTag); -
trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
r260222 r260223 1339 1339 tierUp.link(&jit); 1340 1340 1341 jit.probe( operationWasmTriggerOSREntryNow, osrEntryDataPtr);1341 jit.probe(tagCFunction<JITProbePtrTag>(operationWasmTriggerOSREntryNow), osrEntryDataPtr); 1342 1342 jit.branchTestPtr(CCallHelpers::Zero, GPRInfo::argumentGPR0).linkTo(tierUpResume, &jit); 1343 1343 jit.farJump(GPRInfo::argumentGPR1, WasmEntryPtrTag);
Note: See TracChangeset
for help on using the changeset viewer.