Changeset 248192 in webkit
- Timestamp:
- Aug 2, 2019 5:31:31 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r248187 r248192 1 2019-08-02 Mark Lam <mark.lam@apple.com> 2 3 [ARM64E] Harden the diversity of the DOMJIT::Signature::unsafeFunction pointer. 4 https://bugs.webkit.org/show_bug.cgi?id=200292 5 <rdar://problem/53706881> 6 7 Reviewed by Geoffrey Garen. 8 9 Previously, DOMJIT::Signature::functionWithoutTypeCheck was signed as a C function 10 pointer. We can do better by signing it like a vtbl function pointer. 11 12 No new tests needed. The DOMJIT mechanism is covered by existing tests. 13 14 I also manually confirmed that DOMJIT::Signature::functionWithoutTypeCheck is signed 15 exactly as expected by reading its bits out of memory (not letting Clang have a 16 chance to resign it into a C function pointer) and comparing it against manually 17 signed bits with the expected diversifier. 18 19 * assembler/MacroAssemblerCodeRef.h: 20 (JSC::CFunctionPtr::CFunctionPtr): 21 (JSC::CFunctionPtr::get const): 22 (JSC::CFunctionPtr::address const): 23 (JSC::CFunctionPtr::operator bool const): 24 (JSC::CFunctionPtr::operator! const): 25 (JSC::CFunctionPtr::operator== const): 26 (JSC::CFunctionPtr::operator!= const): 27 28 - Introduce a CFunctionPtr abstraction that is used to hold pointers to C functions. 29 It can instantiated in 4 ways: 30 31 1. The default constructor. 32 2. A constructor that takes a nullptr_t. 33 34 These 2 forms will instantiate a CFunctionPtr with a nullptr. 35 36 3. A constructor that takes the name of a function. 37 4. A constructor that takes a function pointer. 38 39 Form 3 already knows that we're initializing with a real function, and 40 that Clang will give it to use signed as a C function pointer. So, it 41 doesn't do any assertions. This form is useful for initializing CFunctionPtrs 42 embedded in const data structures. 43 44 Form 4 is an explicit constructor that takes an arbitrary function 45 pointer, but does not know if that pointer is already signed as a C function 46 pointer. Hence, this form will do a RELEASE_ASSERT that the given function 47 pointer is actually signed as a C function pointer. 48 49 Once instantiated, we are guaranteed that a C function pointer is either null 50 or contains a signed C function pointer. 51 52 * domjit/DOMJITSignature.h: 53 (JSC::DOMJIT::Signature::Signature): 54 - Sign functionWithoutTypeCheck as WTF_VTBL_FUNCPTR_PTRAUTH(DOMJITFunctionPtrTag). 55 56 * dfg/DFGSpeculativeJIT.cpp: 57 (JSC::DFG::SpeculativeJIT::compileCallDOM): 58 * ftl/FTLLowerDFGToB3.cpp: 59 (JSC::FTL::DFG::LowerDFGToB3::compileCallDOM): 60 - Use the new CFunctionPtr to document that the retrieved signature->functionWithoutTypeCheck 61 is signed as a C function pointer. 62 63 * runtime/ClassInfo.h: 64 - Update MethodTable to sign its function pointers using the new WTF_VTBL_FUNCPTR_PTRAUTH_STR 65 to be consistent. No longer need to roll its own PTRAUTH macro. 66 67 * runtime/JSCPtrTag.h: 68 - Add DOMJITFunctionPtrTag. 69 70 * tools/JSDollarVM.cpp: 71 - Update to work with the new DOMJIT::Signature constructor. 72 1 73 2019-08-02 Yusuke Suzuki <ysuzuki@apple.com> 2 74 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
r243886 r248192 59 59 enum OpcodeID : unsigned; 60 60 61 // CFunctionPtr can only be used to hold C/C++ functions. 62 class CFunctionPtr { 63 public: 64 using Ptr = void(*)(); 65 66 CFunctionPtr() { } 67 CFunctionPtr(std::nullptr_t) { } 68 69 template<typename ReturnType, typename... Arguments> 70 constexpr CFunctionPtr(ReturnType(&ptr)(Arguments...)) 71 : m_ptr(reinterpret_cast<Ptr>(&ptr)) 72 { } 73 74 template<typename ReturnType, typename... Arguments> 75 explicit CFunctionPtr(ReturnType(*ptr)(Arguments...)) 76 : m_ptr(reinterpret_cast<Ptr>(ptr)) 77 { 78 assertIsCFunctionPtr(m_ptr); 79 } 80 81 // MSVC doesn't seem to treat functions with different calling conventions as 82 // different types; these methods are already defined for fastcall, below. 83 #if CALLING_CONVENTION_IS_STDCALL && !OS(WINDOWS) 84 template<typename ReturnType, typename... Arguments> 85 constexpr CFunctionPtr(ReturnType(CDECL &ptr)(Arguments...)) 86 : m_ptr(reinterpret_cast<Ptr>(&ptr)) 87 { } 88 89 template<typename ReturnType, typename... Arguments> 90 explicit CFunctionPtr(ReturnType(CDECL *ptr)(Arguments...)) 91 : m_ptr(reinterpret_cast<Ptr>(ptr)) 92 { 93 assertIsCFunctionPtr(m_ptr); 94 } 95 96 #endif // CALLING_CONVENTION_IS_STDCALL && !OS(WINDOWS) 97 98 #if COMPILER_SUPPORTS(FASTCALL_CALLING_CONVENTION) 99 template<typename ReturnType, typename... Arguments> 100 constexpr CFunctionPtr(ReturnType(FASTCALL &ptr)(Arguments...)) 101 : m_ptr(reinterpret_cast<Ptr>(&ptr)) 102 { } 103 104 template<typename ReturnType, typename... Arguments> 105 explicit CFunctionPtr(ReturnType(FASTCALL *ptr)(Arguments...)) 106 : m_ptr(reinterpret_cast<Ptr>(ptr)) 107 { 108 assertIsCFunctionPtr(m_ptr); 109 } 110 #endif // COMPILER_SUPPORTS(FASTCALL_CALLING_CONVENTION) 111 112 constexpr Ptr get() const { return m_ptr; } 113 void* address() const { return reinterpret_cast<void*>(m_ptr); } 114 115 explicit operator bool() const { return !!m_ptr; } 116 bool operator!() const { return !m_ptr; } 117 118 bool operator==(const CFunctionPtr& other) const { return m_ptr == other.m_ptr; } 119 bool operator!=(const CFunctionPtr& other) const { return m_ptr != other.m_ptr; } 120 121 private: 122 Ptr m_ptr { nullptr }; 123 }; 124 125 61 126 // FunctionPtr: 62 127 // -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r248105 r248192 9415 9415 9416 9416 flushRegisters(); 9417 DOMJIT::FunctionWithoutTypeCheck function = signature->functionWithoutTypeCheck; 9418 a ssertIsTaggedWith(function, CFunctionPtrTag);9417 9418 auto function = CFunctionPtr(signature->functionWithoutTypeCheck); 9419 9419 unsigned argumentCountIncludingThis = signature->argumentCount + 1; 9420 9420 switch (argumentCountIncludingThis) { 9421 9421 case 1: 9422 callOperation(reinterpret_cast<J_JITOperation_EP>(function ), extractResult(resultRegs), regs[0]);9422 callOperation(reinterpret_cast<J_JITOperation_EP>(function.get()), extractResult(resultRegs), regs[0]); 9423 9423 break; 9424 9424 case 2: 9425 callOperation(reinterpret_cast<J_JITOperation_EPP>(function ), extractResult(resultRegs), regs[0], regs[1]);9425 callOperation(reinterpret_cast<J_JITOperation_EPP>(function.get()), extractResult(resultRegs), regs[0], regs[1]); 9426 9426 break; 9427 9427 case 3: 9428 callOperation(reinterpret_cast<J_JITOperation_EPPP>(function ), extractResult(resultRegs), regs[0], regs[1], regs[2]);9428 callOperation(reinterpret_cast<J_JITOperation_EPPP>(function.get()), extractResult(resultRegs), regs[0], regs[1], regs[2]); 9429 9429 break; 9430 9430 default: -
trunk/Source/JavaScriptCore/domjit/DOMJITSignature.h
r248105 r248192 38 38 #define JSC_DOMJIT_SIGNATURE_MAX_ARGUMENTS_INCLUDING_THIS (1 + JSC_DOMJIT_SIGNATURE_MAX_ARGUMENTS) 39 39 40 using Function WithoutTypeCheck = void (*)();40 using FunctionPtr = void (*WTF_VTBL_FUNCPTR_PTRAUTH(DOMJITFunctionPtrTag))(); 41 41 42 42 class Signature { 43 43 public: 44 44 template<typename... Arguments> 45 constexpr Signature( FunctionWithoutTypeCheckfunctionWithoutTypeCheck, const ClassInfo* classInfo, Effect effect, SpeculatedType result, Arguments... arguments)46 : functionWithoutTypeCheck(functionWithoutTypeCheck )45 constexpr Signature(CFunctionPtr functionWithoutTypeCheck, const ClassInfo* classInfo, Effect effect, SpeculatedType result, Arguments... arguments) 46 : functionWithoutTypeCheck(functionWithoutTypeCheck.get()) 47 47 , classInfo(classInfo) 48 48 , result(result) … … 53 53 } 54 54 55 FunctionWithoutTypeCheckfunctionWithoutTypeCheck;55 const FunctionPtr functionWithoutTypeCheck; 56 56 const ClassInfo* const classInfo; 57 57 const SpeculatedType result; -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r248178 r248192 12581 12581 unsigned argumentCountIncludingThis = signature->argumentCount + 1; 12582 12582 LValue result; 12583 DOMJIT::FunctionWithoutTypeCheck function = signature->functionWithoutTypeCheck; 12584 assertIsTaggedWith(function, CFunctionPtrTag); 12583 auto function = CFunctionPtr(signature->functionWithoutTypeCheck); 12585 12584 switch (argumentCountIncludingThis) { 12586 12585 case 1: 12587 result = vmCall(Int64, m_out.operation(reinterpret_cast<J_JITOperation_EP>(function )), m_callFrame, operands[0]);12586 result = vmCall(Int64, m_out.operation(reinterpret_cast<J_JITOperation_EP>(function.get())), m_callFrame, operands[0]); 12588 12587 break; 12589 12588 case 2: 12590 result = vmCall(Int64, m_out.operation(reinterpret_cast<J_JITOperation_EPP>(function )), m_callFrame, operands[0], operands[1]);12589 result = vmCall(Int64, m_out.operation(reinterpret_cast<J_JITOperation_EPP>(function.get())), m_callFrame, operands[0], operands[1]); 12591 12590 break; 12592 12591 case 3: 12593 result = vmCall(Int64, m_out.operation(reinterpret_cast<J_JITOperation_EPPP>(function )), m_callFrame, operands[0], operands[1], operands[2]);12592 result = vmCall(Int64, m_out.operation(reinterpret_cast<J_JITOperation_EPPP>(function.get())), m_callFrame, operands[0], operands[1], operands[2]); 12594 12593 break; 12595 12594 default: -
trunk/Source/JavaScriptCore/runtime/ClassInfo.h
r243254 r248192 26 26 #include "ConstructData.h" 27 27 #include "JSCast.h" 28 29 #if CPU(ARM64E) 30 #include <ptrauth.h> 31 #endif 28 #include <wtf/PtrTag.h> 32 29 33 30 namespace WTF { … … 42 39 struct HashTable; 43 40 44 #if CPU(ARM64E) 45 #define WTF_METHOD_TABLE_ENTRY(method) \ 46 __ptrauth(ptrauth_key_process_independent_code, true, ptrauth_string_discriminator("MethodTable." #method)) method 47 #else 48 #define WTF_METHOD_TABLE_ENTRY(method) method 49 #endif 41 #define METHOD_TABLE_ENTRY(method) \ 42 WTF_VTBL_FUNCPTR_PTRAUTH_STR("MethodTable." #method) method 50 43 51 44 struct MethodTable { 52 45 using DestroyFunctionPtr = void (*)(JSCell*); 53 DestroyFunctionPtr WTF_METHOD_TABLE_ENTRY(destroy);46 DestroyFunctionPtr METHOD_TABLE_ENTRY(destroy); 54 47 55 48 using VisitChildrenFunctionPtr = void (*)(JSCell*, SlotVisitor&); 56 VisitChildrenFunctionPtr WTF_METHOD_TABLE_ENTRY(visitChildren);49 VisitChildrenFunctionPtr METHOD_TABLE_ENTRY(visitChildren); 57 50 58 51 using GetCallDataFunctionPtr = CallType (*)(JSCell*, CallData&); 59 GetCallDataFunctionPtr WTF_METHOD_TABLE_ENTRY(getCallData);52 GetCallDataFunctionPtr METHOD_TABLE_ENTRY(getCallData); 60 53 61 54 using GetConstructDataFunctionPtr = ConstructType (*)(JSCell*, ConstructData&); 62 GetConstructDataFunctionPtr WTF_METHOD_TABLE_ENTRY(getConstructData);55 GetConstructDataFunctionPtr METHOD_TABLE_ENTRY(getConstructData); 63 56 64 57 using PutFunctionPtr = bool (*)(JSCell*, ExecState*, PropertyName propertyName, JSValue, PutPropertySlot&); 65 PutFunctionPtr WTF_METHOD_TABLE_ENTRY(put);58 PutFunctionPtr METHOD_TABLE_ENTRY(put); 66 59 67 60 using PutByIndexFunctionPtr = bool (*)(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 68 PutByIndexFunctionPtr WTF_METHOD_TABLE_ENTRY(putByIndex);61 PutByIndexFunctionPtr METHOD_TABLE_ENTRY(putByIndex); 69 62 70 63 using DeletePropertyFunctionPtr = bool (*)(JSCell*, ExecState*, PropertyName); 71 DeletePropertyFunctionPtr WTF_METHOD_TABLE_ENTRY(deleteProperty);64 DeletePropertyFunctionPtr METHOD_TABLE_ENTRY(deleteProperty); 72 65 73 66 using DeletePropertyByIndexFunctionPtr = bool (*)(JSCell*, ExecState*, unsigned); 74 DeletePropertyByIndexFunctionPtr WTF_METHOD_TABLE_ENTRY(deletePropertyByIndex);67 DeletePropertyByIndexFunctionPtr METHOD_TABLE_ENTRY(deletePropertyByIndex); 75 68 76 69 using GetOwnPropertySlotFunctionPtr = bool (*)(JSObject*, ExecState*, PropertyName, PropertySlot&); 77 GetOwnPropertySlotFunctionPtr WTF_METHOD_TABLE_ENTRY(getOwnPropertySlot);70 GetOwnPropertySlotFunctionPtr METHOD_TABLE_ENTRY(getOwnPropertySlot); 78 71 79 72 using GetOwnPropertySlotByIndexFunctionPtr = bool (*)(JSObject*, ExecState*, unsigned, PropertySlot&); 80 GetOwnPropertySlotByIndexFunctionPtr WTF_METHOD_TABLE_ENTRY(getOwnPropertySlotByIndex);73 GetOwnPropertySlotByIndexFunctionPtr METHOD_TABLE_ENTRY(getOwnPropertySlotByIndex); 81 74 82 75 using ToThisFunctionPtr = JSValue (*)(JSCell*, ExecState*, ECMAMode); 83 ToThisFunctionPtr WTF_METHOD_TABLE_ENTRY(toThis);76 ToThisFunctionPtr METHOD_TABLE_ENTRY(toThis); 84 77 85 78 using DefaultValueFunctionPtr = JSValue (*)(const JSObject*, ExecState*, PreferredPrimitiveType); 86 DefaultValueFunctionPtr WTF_METHOD_TABLE_ENTRY(defaultValue);79 DefaultValueFunctionPtr METHOD_TABLE_ENTRY(defaultValue); 87 80 88 81 using GetOwnPropertyNamesFunctionPtr = void (*)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); 89 GetOwnPropertyNamesFunctionPtr WTF_METHOD_TABLE_ENTRY(getOwnPropertyNames);82 GetOwnPropertyNamesFunctionPtr METHOD_TABLE_ENTRY(getOwnPropertyNames); 90 83 91 84 using GetOwnNonIndexPropertyNamesFunctionPtr = void (*)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); 92 GetOwnNonIndexPropertyNamesFunctionPtr WTF_METHOD_TABLE_ENTRY(getOwnNonIndexPropertyNames);85 GetOwnNonIndexPropertyNamesFunctionPtr METHOD_TABLE_ENTRY(getOwnNonIndexPropertyNames); 93 86 94 87 using GetPropertyNamesFunctionPtr = void (*)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); 95 GetPropertyNamesFunctionPtr WTF_METHOD_TABLE_ENTRY(getPropertyNames);88 GetPropertyNamesFunctionPtr METHOD_TABLE_ENTRY(getPropertyNames); 96 89 97 90 using GetEnumerableLengthFunctionPtr = uint32_t (*)(ExecState*, JSObject*); 98 GetEnumerableLengthFunctionPtr WTF_METHOD_TABLE_ENTRY(getEnumerableLength);99 100 GetPropertyNamesFunctionPtr WTF_METHOD_TABLE_ENTRY(getStructurePropertyNames);101 GetPropertyNamesFunctionPtr WTF_METHOD_TABLE_ENTRY(getGenericPropertyNames);91 GetEnumerableLengthFunctionPtr METHOD_TABLE_ENTRY(getEnumerableLength); 92 93 GetPropertyNamesFunctionPtr METHOD_TABLE_ENTRY(getStructurePropertyNames); 94 GetPropertyNamesFunctionPtr METHOD_TABLE_ENTRY(getGenericPropertyNames); 102 95 103 96 using ClassNameFunctionPtr = String (*)(const JSObject*, VM&); 104 ClassNameFunctionPtr WTF_METHOD_TABLE_ENTRY(className);97 ClassNameFunctionPtr METHOD_TABLE_ENTRY(className); 105 98 106 99 using ToStringNameFunctionPtr = String (*)(const JSObject*, ExecState*); 107 ToStringNameFunctionPtr WTF_METHOD_TABLE_ENTRY(toStringName);100 ToStringNameFunctionPtr METHOD_TABLE_ENTRY(toStringName); 108 101 109 102 using CustomHasInstanceFunctionPtr = bool (*)(JSObject*, ExecState*, JSValue); 110 CustomHasInstanceFunctionPtr WTF_METHOD_TABLE_ENTRY(customHasInstance);103 CustomHasInstanceFunctionPtr METHOD_TABLE_ENTRY(customHasInstance); 111 104 112 105 using DefineOwnPropertyFunctionPtr = bool (*)(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool); 113 DefineOwnPropertyFunctionPtr WTF_METHOD_TABLE_ENTRY(defineOwnProperty);106 DefineOwnPropertyFunctionPtr METHOD_TABLE_ENTRY(defineOwnProperty); 114 107 115 108 using PreventExtensionsFunctionPtr = bool (*)(JSObject*, ExecState*); 116 PreventExtensionsFunctionPtr WTF_METHOD_TABLE_ENTRY(preventExtensions);109 PreventExtensionsFunctionPtr METHOD_TABLE_ENTRY(preventExtensions); 117 110 118 111 using IsExtensibleFunctionPtr = bool (*)(JSObject*, ExecState*); 119 IsExtensibleFunctionPtr WTF_METHOD_TABLE_ENTRY(isExtensible);112 IsExtensibleFunctionPtr METHOD_TABLE_ENTRY(isExtensible); 120 113 121 114 using SetPrototypeFunctionPtr = bool (*)(JSObject*, ExecState*, JSValue, bool shouldThrowIfCantSet); 122 SetPrototypeFunctionPtr WTF_METHOD_TABLE_ENTRY(setPrototype);115 SetPrototypeFunctionPtr METHOD_TABLE_ENTRY(setPrototype); 123 116 124 117 using GetPrototypeFunctionPtr = JSValue (*)(JSObject*, ExecState*); 125 GetPrototypeFunctionPtr WTF_METHOD_TABLE_ENTRY(getPrototype);118 GetPrototypeFunctionPtr METHOD_TABLE_ENTRY(getPrototype); 126 119 127 120 using DumpToStreamFunctionPtr = void (*)(const JSCell*, PrintStream&); 128 DumpToStreamFunctionPtr WTF_METHOD_TABLE_ENTRY(dumpToStream);121 DumpToStreamFunctionPtr METHOD_TABLE_ENTRY(dumpToStream); 129 122 130 123 using HeapSnapshotFunctionPtr = void (*)(JSCell*, HeapSnapshotBuilder&); 131 HeapSnapshotFunctionPtr WTF_METHOD_TABLE_ENTRY(heapSnapshot);124 HeapSnapshotFunctionPtr METHOD_TABLE_ENTRY(heapSnapshot); 132 125 133 126 using EstimatedSizeFunctionPtr = size_t (*)(JSCell*, VM&); 134 EstimatedSizeFunctionPtr WTF_METHOD_TABLE_ENTRY(estimatedSize);127 EstimatedSizeFunctionPtr METHOD_TABLE_ENTRY(estimatedSize); 135 128 136 129 using VisitOutputConstraintsPtr = void (*)(JSCell*, SlotVisitor&); 137 VisitOutputConstraintsPtr WTF_METHOD_TABLE_ENTRY(visitOutputConstraints);130 VisitOutputConstraintsPtr METHOD_TABLE_ENTRY(visitOutputConstraints); 138 131 }; 139 132 -
trunk/Source/JavaScriptCore/runtime/JSCPtrTag.h
r247799 r248192 37 37 v(BytecodePtrTag) \ 38 38 v(CopyFunctionPtrTag) \ 39 v(DOMJITFunctionPtrTag) \ 39 40 v(DisassemblyPtrTag) \ 40 41 v(ExceptionHandlerPtrTag) \ -
trunk/Source/JavaScriptCore/tools/JSDollarVM.cpp
r248187 r248192 828 828 }; 829 829 830 static const DOMJIT::Signature DOMJITFunctionObjectSignature( (DOMJIT::FunctionWithoutTypeCheck)DOMJITFunctionObject::functionWithoutTypeCheck, DOMJITFunctionObject::info(), DOMJIT::Effect::forRead(DOMJIT::HeapRange::top()), SpecInt32Only);830 static const DOMJIT::Signature DOMJITFunctionObjectSignature(DOMJITFunctionObject::functionWithoutTypeCheck, DOMJITFunctionObject::info(), DOMJIT::Effect::forRead(DOMJIT::HeapRange::top()), SpecInt32Only); 831 831 832 832 void DOMJITFunctionObject::finishCreation(VM& vm, JSGlobalObject* globalObject) … … 882 882 }; 883 883 884 static const DOMJIT::Signature DOMJITCheckSubClassObjectSignature( (DOMJIT::FunctionWithoutTypeCheck)DOMJITCheckSubClassObject::functionWithoutTypeCheck, DOMJITCheckSubClassObject::info(), DOMJIT::Effect::forRead(DOMJIT::HeapRange::top()), SpecInt32Only);884 static const DOMJIT::Signature DOMJITCheckSubClassObjectSignature(DOMJITCheckSubClassObject::functionWithoutTypeCheck, DOMJITCheckSubClassObject::info(), DOMJIT::Effect::forRead(DOMJIT::HeapRange::top()), SpecInt32Only); 885 885 886 886 void DOMJITCheckSubClassObject::finishCreation(VM& vm, JSGlobalObject* globalObject) -
trunk/Source/WTF/ChangeLog
r248183 r248192 1 2019-08-02 Mark Lam <mark.lam@apple.com> 2 3 [ARM64E] Harden the diversity of the DOMJIT::Signature::unsafeFunction pointer. 4 https://bugs.webkit.org/show_bug.cgi?id=200292 5 <rdar://problem/53706881> 6 7 Reviewed by Geoffrey Garen. 8 9 * wtf/PtrTag.h: 10 - Introducing WTF_VTBL_FUNCPTR_PTRAUTH and WTF_VTBL_FUNCPTR_PTRAUTH_STR macros for 11 defining vtbl function pointer style pointer signing modifier. 12 1 13 2019-08-02 Eric Carlson <eric.carlson@apple.com> 2 14 -
trunk/Source/WTF/wtf/PtrTag.h
r246368 r248192 423 423 inline bool usesPointerTagging() { return true; } 424 424 425 // vtbl function pointers need to sign with ptrauth_key_process_independent_code 426 // because they reside in library code shared by multiple processes. 427 // The second argument to __ptrauth() being 1 means to use the address of the pointer 428 // for diversification as well. __ptrauth() expects a literal int for this argument. 429 #define WTF_VTBL_FUNCPTR_PTRAUTH(discriminator) WTF_VTBL_FUNCPTR_PTRAUTH_STR(#discriminator) 430 #define WTF_VTBL_FUNCPTR_PTRAUTH_STR(discriminatorStr) \ 431 __ptrauth(ptrauth_key_process_independent_code, 1, ptrauth_string_discriminator(discriminatorStr)) 432 425 433 #else // not CPU(ARM64E) 426 434 … … 546 554 547 555 inline bool usesPointerTagging() { return false; } 556 557 #define WTF_VTBL_FUNCPTR_PTRAUTH(discriminator) 558 #define WTF_VTBL_FUNCPTR_PTRAUTH_STR(discriminatorStr) 548 559 549 560 #endif // CPU(ARM64E) -
trunk/Source/WebCore/ChangeLog
r248190 r248192 1 2019-08-02 Mark Lam <mark.lam@apple.com> 2 3 [ARM64E] Harden the diversity of the DOMJIT::Signature::unsafeFunction pointer. 4 https://bugs.webkit.org/show_bug.cgi?id=200292 5 <rdar://problem/53706881> 6 7 Reviewed by Geoffrey Garen. 8 9 * bindings/scripts/CodeGeneratorJS.pm: 10 (GenerateImplementation): 11 - Update to work with the new DOMJIT::Signature constructor. 12 13 * bindings/scripts/test/JS/JSTestDOMJIT.cpp: 14 - Re-base test results. 15 1 16 2019-08-02 Keith Rollin <krollin@apple.com> 2 17 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r248155 r248192 4010 4010 my $classInfo = "JS" . $interface->type->name . "::info()"; 4011 4011 my $resultType = GetResultTypeFilter($interface, $operation->type); 4012 my $domJITSignatureHeader = "static const JSC::DOMJIT::Signature ${domJITSignatureName}( (JSC::DOMJIT::FunctionWithoutTypeCheck)${nameOfFunctionWithoutTypeCheck},";4012 my $domJITSignatureHeader = "static const JSC::DOMJIT::Signature ${domJITSignatureName}(${nameOfFunctionWithoutTypeCheck},"; 4013 4013 my $domJITSignatureFooter = "$classInfo, JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), ${resultType}"; 4014 4014 foreach my $argument (@{$operation->arguments}) { -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDOMJIT.cpp
r248105 r248192 106 106 JSC::EncodedJSValue jsTestDOMJITNodeNullableAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 107 107 108 static const JSC::DOMJIT::Signature DOMJITSignatureForTestDOMJITGetAttribute( (JSC::DOMJIT::FunctionWithoutTypeCheck)jsTestDOMJITPrototypeFunctionGetAttributeWithoutTypeCheck, JSTestDOMJIT::info(), JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), DOMJIT::IDLResultTypeFilter<IDLNullable<IDLDOMString>>::value, DOMJIT::IDLArgumentTypeFilter<IDLDOMString>::value);109 110 static const JSC::DOMJIT::Signature DOMJITSignatureForTestDOMJITItem( (JSC::DOMJIT::FunctionWithoutTypeCheck)jsTestDOMJITPrototypeFunctionItemWithoutTypeCheck, JSTestDOMJIT::info(), JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), DOMJIT::IDLResultTypeFilter<IDLDOMString>::value, DOMJIT::IDLArgumentTypeFilter<IDLUnsignedShort>::value, DOMJIT::IDLArgumentTypeFilter<IDLUnsignedShort>::value);111 112 static const JSC::DOMJIT::Signature DOMJITSignatureForTestDOMJITHasAttribute( (JSC::DOMJIT::FunctionWithoutTypeCheck)jsTestDOMJITPrototypeFunctionHasAttributeWithoutTypeCheck, JSTestDOMJIT::info(), JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), DOMJIT::IDLResultTypeFilter<IDLBoolean>::value);113 114 static const JSC::DOMJIT::Signature DOMJITSignatureForTestDOMJITGetElementById( (JSC::DOMJIT::FunctionWithoutTypeCheck)jsTestDOMJITPrototypeFunctionGetElementByIdWithoutTypeCheck, JSTestDOMJIT::info(), JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), DOMJIT::IDLResultTypeFilter<IDLInterface<Element>>::value, DOMJIT::IDLArgumentTypeFilter<IDLRequiresExistingAtomStringAdaptor<IDLDOMString>>::value);115 116 static const JSC::DOMJIT::Signature DOMJITSignatureForTestDOMJITGetElementsByName( (JSC::DOMJIT::FunctionWithoutTypeCheck)jsTestDOMJITPrototypeFunctionGetElementsByNameWithoutTypeCheck, JSTestDOMJIT::info(), JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), DOMJIT::IDLResultTypeFilter<IDLInterface<NodeList>>::value, DOMJIT::IDLArgumentTypeFilter<IDLAtomStringAdaptor<IDLDOMString>>::value);108 static const JSC::DOMJIT::Signature DOMJITSignatureForTestDOMJITGetAttribute(jsTestDOMJITPrototypeFunctionGetAttributeWithoutTypeCheck, JSTestDOMJIT::info(), JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), DOMJIT::IDLResultTypeFilter<IDLNullable<IDLDOMString>>::value, DOMJIT::IDLArgumentTypeFilter<IDLDOMString>::value); 109 110 static const JSC::DOMJIT::Signature DOMJITSignatureForTestDOMJITItem(jsTestDOMJITPrototypeFunctionItemWithoutTypeCheck, JSTestDOMJIT::info(), JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), DOMJIT::IDLResultTypeFilter<IDLDOMString>::value, DOMJIT::IDLArgumentTypeFilter<IDLUnsignedShort>::value, DOMJIT::IDLArgumentTypeFilter<IDLUnsignedShort>::value); 111 112 static const JSC::DOMJIT::Signature DOMJITSignatureForTestDOMJITHasAttribute(jsTestDOMJITPrototypeFunctionHasAttributeWithoutTypeCheck, JSTestDOMJIT::info(), JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), DOMJIT::IDLResultTypeFilter<IDLBoolean>::value); 113 114 static const JSC::DOMJIT::Signature DOMJITSignatureForTestDOMJITGetElementById(jsTestDOMJITPrototypeFunctionGetElementByIdWithoutTypeCheck, JSTestDOMJIT::info(), JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), DOMJIT::IDLResultTypeFilter<IDLInterface<Element>>::value, DOMJIT::IDLArgumentTypeFilter<IDLRequiresExistingAtomStringAdaptor<IDLDOMString>>::value); 115 116 static const JSC::DOMJIT::Signature DOMJITSignatureForTestDOMJITGetElementsByName(jsTestDOMJITPrototypeFunctionGetElementsByNameWithoutTypeCheck, JSTestDOMJIT::info(), JSC::DOMJIT::Effect::forRead(DOMJIT::AbstractHeapRepository::DOM), DOMJIT::IDLResultTypeFilter<IDLInterface<NodeList>>::value, DOMJIT::IDLArgumentTypeFilter<IDLAtomStringAdaptor<IDLDOMString>>::value); 117 117 118 118 static const JSC::DOMJIT::GetterSetter DOMJITAttributeForTestDOMJITAnyAttr {
Note: See TracChangeset
for help on using the changeset viewer.