Changeset 271279 in webkit
- Timestamp:
- Jan 7, 2021, 5:36:47 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/assembler/MacroAssemblerCodeRef.h (modified) (4 diffs)
-
JavaScriptCore/interpreter/AbstractPC.h (modified) (2 diffs)
-
JavaScriptCore/interpreter/CallFrame.h (modified) (2 diffs)
-
JavaScriptCore/jit/JIT.cpp (modified) (2 diffs)
-
JavaScriptCore/jit/JITOpcodes.cpp (modified) (2 diffs)
-
JavaScriptCore/jit/JITOpcodes32_64.cpp (modified) (2 diffs)
-
JavaScriptCore/jit/JITOperations.cpp (modified) (4 diffs)
-
JavaScriptCore/jit/JITPropertyAccess.cpp (modified) (4 diffs)
-
JavaScriptCore/runtime/JSCPtrTag.h (modified) (2 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/PluginProcess/mac/PluginProcessShim.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r271269 r271279 1 2021-01-07 Mark Lam <mark.lam@apple.com> 2 3 Work around Clang bug in __builtin_return_address(). 4 https://bugs.webkit.org/show_bug.cgi?id=220432 5 rdar://71648468 6 7 Reviewed by Yusuke Suzuki. 8 9 Clang's __builtin_return_address() currently sometimes returns a PAC signed pointer 10 and sometimes not. This patch works around that by always ensuring that the pointer 11 is not signed. 12 13 Also changed the ReturnAddressPtr to store a signed pointer. 14 15 * assembler/MacroAssemblerCodeRef.h: 16 (JSC::ReturnAddressPtr::ReturnAddressPtr): 17 (JSC::ReturnAddressPtr::untaggedValue const): 18 (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): 19 * interpreter/AbstractPC.h: 20 (JSC::AbstractPC::AbstractPC): 21 * interpreter/CallFrame.h: 22 * jit/JIT.cpp: 23 (JSC::ctiPatchCallByReturnAddress): 24 * jit/JITOpcodes.cpp: 25 (JSC::JIT::privateCompileHasIndexedProperty): 26 * jit/JITOpcodes32_64.cpp: 27 (JSC::JIT::privateCompileHasIndexedProperty): 28 * jit/JITOperations.cpp: 29 (JSC::JSC_DEFINE_JIT_OPERATION): 30 (JSC::unprofiledMul): Deleted. 31 (JSC::profiledMul): Deleted. 32 (JSC::unprofiledSub): Deleted. 33 (JSC::profiledSub): Deleted. 34 * jit/JITPropertyAccess.cpp: 35 (JSC::JIT::privateCompilePutByVal): 36 (JSC::JIT::privateCompilePutPrivateNameWithCachedId): 37 (JSC::JIT::privateCompilePutByValWithCachedId): 38 * runtime/JSCPtrTag.h: 39 1 40 2021-01-07 Alexey Shvayka <shvaikalesh@gmail.com> 2 41 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
r268247 r271279 1 1 /* 2 * Copyright (C) 2009-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2009-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 235 235 ReturnAddressPtr() { } 236 236 237 explicit ReturnAddressPtr(const void* value) 238 : m_value(value) 239 { 237 explicit ReturnAddressPtr(const void* returnAddress) 238 { 239 #if CPU(ARM64E) 240 assertIsNotTagged(returnAddress); 241 returnAddress = retagCodePtr<NoPtrTag, ReturnAddressPtrTag>(returnAddress); 242 #endif 243 m_value = returnAddress; 240 244 ASSERT_VALID_CODE_POINTER(m_value); 241 245 } … … 246 250 } 247 251 252 const void* untaggedValue() const 253 { 254 return untagCodePtr<ReturnAddressPtrTag>(m_value); 255 } 256 248 257 void dump(PrintStream& out) const 249 258 { … … 298 307 299 308 explicit MacroAssemblerCodePtr(ReturnAddressPtr ra) 300 : m_value(tagCodePtr<tag>(ra.value())) 301 { 302 assertIsNotTagged(ra.value()); 303 ASSERT(ra.value()); 309 : m_value(retagCodePtr<ReturnAddressPtrTag, tag>(ra.value())) 310 { 311 ASSERT(ra.untaggedValue()); 304 312 ASSERT_VALID_CODE_POINTER(m_value); 305 313 } -
trunk/Source/JavaScriptCore/interpreter/AbstractPC.h
r251425 r271279 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 48 48 , m_mode(JIT) 49 49 { 50 assertIsTaggedWith<ReturnAddressPtrTag>(m_pointer); 50 51 } 51 52 -
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r269252 r271279 2 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 3 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 4 * Copyright (C) 2003-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2003-2021 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 319 319 320 320 #if USE(BUILTIN_FRAME_ADDRESS) 321 // FIXME (see rdar://72897291): Work around a Clang bug where __builtin_return_address() 322 // sometimes gives us a signed pointer, and sometimes does not. 321 323 #define DECLARE_CALL_FRAME(vm) \ 322 324 ({ \ -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r270874 r271279 1 1 /* 2 * Copyright (C) 2008-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2008-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 64 64 { 65 65 MacroAssembler::repatchCall( 66 CodeLocationCall< NoPtrTag>(MacroAssemblerCodePtr<NoPtrTag>(returnAddress)),66 CodeLocationCall<ReturnAddressPtrTag>(MacroAssemblerCodePtr<ReturnAddressPtrTag>(returnAddress)), 67 67 newCalleeFunction.retagged<OperationPtrTag>()); 68 68 } -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r270874 r271279 1 1 /* 2 * Copyright (C) 2009-202 0Apple Inc. All rights reserved.2 * Copyright (C) 2009-2021 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 4 4 * … … 1429 1429 byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB( 1430 1430 m_codeBlock, patchBuffer, JITStubRoutinePtrTag, 1431 "Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress. value());1431 "Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.untaggedValue()); 1432 1432 1433 1433 MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel<JITStubRoutinePtrTag>(byValInfo->stubRoutine->code().code())); 1434 MacroAssembler::repatchCall(CodeLocationCall< NoPtrTag>(MacroAssemblerCodePtr<NoPtrTag>(returnAddress)), FunctionPtr<OperationPtrTag>(operationHasIndexedPropertyGeneric));1434 MacroAssembler::repatchCall(CodeLocationCall<ReturnAddressPtrTag>(MacroAssemblerCodePtr<ReturnAddressPtrTag>(returnAddress)), FunctionPtr<OperationPtrTag>(operationHasIndexedPropertyGeneric)); 1435 1435 } 1436 1436 -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r270874 r271279 1 1 /* 2 * Copyright (C) 2009-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2009-2021 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 4 4 * … … 1188 1188 byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB( 1189 1189 m_codeBlock, patchBuffer, JITStubRoutinePtrTag, 1190 "Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress. value());1190 "Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.untaggedValue()); 1191 1191 1192 1192 MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel<JITStubRoutinePtrTag>(byValInfo->stubRoutine->code().code())); 1193 MacroAssembler::repatchCall(CodeLocationCall< NoPtrTag>(MacroAssemblerCodePtr<NoPtrTag>(returnAddress)), FunctionPtr<OperationPtrTag>(operationHasIndexedPropertyGeneric));1193 MacroAssembler::repatchCall(CodeLocationCall<ReturnAddressPtrTag>(MacroAssemblerCodePtr<ReturnAddressPtrTag>(returnAddress)), FunctionPtr<OperationPtrTag>(operationHasIndexedPropertyGeneric)); 1194 1194 } 1195 1195 -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r271186 r271279 1 1 /* 2 * Copyright (C) 2013-202 0Apple Inc. All rights reserved.2 * Copyright (C) 2013-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 87 87 #define OUR_RETURN_ADDRESS _ReturnAddress() 88 88 #else 89 #define OUR_RETURN_ADDRESS __builtin_return_address(0) 89 // FIXME (see rdar://72897291): Work around a Clang bug where __builtin_return_address() 90 // sometimes gives us a signed pointer, and sometimes does not. 91 #define OUR_RETURN_ADDRESS removeCodePtrTag(__builtin_return_address(0)) 90 92 #endif 91 93 … … 2948 2950 #if COMPILER(GCC_COMPATIBLE) 2949 2951 void* returnPC = __builtin_return_address(0); 2952 // FIXME (see rdar://72897291): Work around a Clang bug where __builtin_return_address() 2953 // sometimes gives us a signed pointer, and sometimes does not. 2954 returnPC = removeCodePtrTag(returnPC); 2950 2955 doExceptionFuzzing(globalObject, scope, "JITOperations", returnPC); 2951 2956 #endif // COMPILER(GCC_COMPATIBLE) … … 2961 2966 #if COMPILER(GCC_COMPATIBLE) 2962 2967 void* returnPC = __builtin_return_address(0); 2968 // FIXME (see rdar://72897291): Work around a Clang bug where __builtin_return_address() 2969 // sometimes gives us a signed pointer, and sometimes does not. 2970 returnPC = removeCodePtrTag(returnPC); 2963 2971 doExceptionFuzzing(callFrame->lexicalGlobalObject(vm), scope, "JITOperations", returnPC); 2964 2972 #endif // COMPILER(GCC_COMPATIBLE) -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r270711 r271279 1 1 /* 2 * Copyright (C) 2008-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2008-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 1514 1514 byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB( 1515 1515 m_codeBlock, patchBuffer, JITStubRoutinePtrTag, 1516 "Baseline put_by_val stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress. value());1516 "Baseline put_by_val stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.untaggedValue()); 1517 1517 1518 1518 } else { 1519 1519 byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB( 1520 1520 m_codeBlock, patchBuffer, JITStubRoutinePtrTag, 1521 "Baseline put_by_val_direct stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress. value());1521 "Baseline put_by_val_direct stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.untaggedValue()); 1522 1522 } 1523 1523 MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel<JITStubRoutinePtrTag>(byValInfo->stubRoutine->code().code())); 1524 MacroAssembler::repatchCall(CodeLocationCall< NoPtrTag>(MacroAssemblerCodePtr<NoPtrTag>(returnAddress)), FunctionPtr<OperationPtrTag>(isDirect ? operationDirectPutByValGeneric : operationPutByValGeneric));1524 MacroAssembler::repatchCall(CodeLocationCall<ReturnAddressPtrTag>(MacroAssemblerCodePtr<ReturnAddressPtrTag>(returnAddress)), FunctionPtr<OperationPtrTag>(isDirect ? operationDirectPutByValGeneric : operationPutByValGeneric)); 1525 1525 } 1526 1526 // This function is only consumed from another translation unit (JITOperations.cpp), … … 1558 1558 byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB( 1559 1559 m_codeBlock, patchBuffer, JITStubRoutinePtrTag, 1560 "Baseline put_private_name with cached property name '%s' stub for %s, return point %p", propertyName.uid()->utf8().data(), toCString(*m_codeBlock).data(), returnAddress. value());1560 "Baseline put_private_name with cached property name '%s' stub for %s, return point %p", propertyName.uid()->utf8().data(), toCString(*m_codeBlock).data(), returnAddress.untaggedValue()); 1561 1561 byValInfo->stubInfo = gen.stubInfo(); 1562 1562 1563 1563 MacroAssembler::repatchJump(byValInfo->notIndexJump, CodeLocationLabel<JITStubRoutinePtrTag>(byValInfo->stubRoutine->code().code())); 1564 MacroAssembler::repatchCall(CodeLocationCall< NoPtrTag>(MacroAssemblerCodePtr<NoPtrTag>(returnAddress)), FunctionPtr<OperationPtrTag>(operationPutPrivateNameGeneric));1564 MacroAssembler::repatchCall(CodeLocationCall<ReturnAddressPtrTag>(MacroAssemblerCodePtr<ReturnAddressPtrTag>(returnAddress)), FunctionPtr<OperationPtrTag>(operationPutPrivateNameGeneric)); 1565 1565 } 1566 1566 … … 1596 1596 byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB( 1597 1597 m_codeBlock, patchBuffer, JITStubRoutinePtrTag, 1598 "Baseline put_by_val%s with cached property name '%s' stub for %s, return point %p", (putKind == PutKind::Direct) ? "_direct" : "", propertyName.uid()->utf8().data(), toCString(*m_codeBlock).data(), returnAddress. value());1598 "Baseline put_by_val%s with cached property name '%s' stub for %s, return point %p", (putKind == PutKind::Direct) ? "_direct" : "", propertyName.uid()->utf8().data(), toCString(*m_codeBlock).data(), returnAddress.untaggedValue()); 1599 1599 byValInfo->stubInfo = gen.stubInfo(); 1600 1600 1601 1601 MacroAssembler::repatchJump(byValInfo->notIndexJump, CodeLocationLabel<JITStubRoutinePtrTag>(byValInfo->stubRoutine->code().code())); 1602 MacroAssembler::repatchCall(CodeLocationCall< NoPtrTag>(MacroAssemblerCodePtr<NoPtrTag>(returnAddress)), FunctionPtr<OperationPtrTag>(putKind == PutKind::Direct ? operationDirectPutByValGeneric : operationPutByValGeneric));1602 MacroAssembler::repatchCall(CodeLocationCall<ReturnAddressPtrTag>(MacroAssemblerCodePtr<ReturnAddressPtrTag>(returnAddress)), FunctionPtr<OperationPtrTag>(putKind == PutKind::Direct ? operationDirectPutByValGeneric : operationPutByValGeneric)); 1603 1603 } 1604 1604 // This function is only consumed from another translation unit (JITOperations.cpp), -
trunk/Source/JavaScriptCore/runtime/JSCPtrTag.h
r270981 r271279 1 1 /* 2 * Copyright (C) 2018-202 0Apple Inc. All rights reserved.2 * Copyright (C) 2018-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 60 60 v(JITProbePCPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \ 61 61 v(JITProbeStackInitializationFunctionPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \ 62 v(ReturnAddressPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \ 62 63 /* Callee:JIT Caller:Native */ \ 63 64 v(NativeToJITGatePtrTag, PtrTagCalleeType::JIT, PtrTagCallerType::Native) \ -
trunk/Source/WebKit/ChangeLog
r271273 r271279 1 2021-01-07 Mark Lam <mark.lam@apple.com> 2 3 Work around Clang bug in __builtin_return_address(). 4 https://bugs.webkit.org/show_bug.cgi?id=220432 5 rdar://71648468 6 7 Reviewed by Yusuke Suzuki. 8 9 * PluginProcess/mac/PluginProcessShim.mm: 10 (WebKit::shimCFStringCompare): 11 - We go direct to ptrauth.h instead of using the WTF PtrTag abstraction because 12 this file appears to be going out of its way to avoid importing config.h. 13 Because of this, importing PtrTag.h results in a lot of build error complications. 14 Rather than jump thru many hoops to make importing PtrTag.h work and because all 15 we really want is only to use ptrauth_strip(), importing ptrauth.h is simpler. 16 1 17 2021-01-07 Peng Liu <peng.liu6@apple.com> 2 18 -
trunk/Source/WebKit/PluginProcess/mac/PluginProcessShim.mm
r242325 r271279 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 41 41 #import <wtf/spi/darwin/SandboxSPI.h> 42 42 43 #if CPU(ARM64E) 44 #import <ptrauth.h> 45 #endif 46 43 47 namespace WebKit { 44 48 … … 240 244 if (pluginProcessShimCallbacks.stringCompare) { 241 245 CFComparisonResult result; 242 if (pluginProcessShimCallbacks.stringCompare(a, b, options, __builtin_return_address(0), result)) 246 // FIXME (see rdar://72897291): Work around a Clang bug where __builtin_return_address() 247 // sometimes gives us a signed pointer, and sometimes does not. 248 void* returnAddress = __builtin_return_address(0); 249 #if CPU(ARM64E) 250 returnAddress = ptrauth_strip(returnAddress, ptrauth_key_process_dependent_code); 251 #endif 252 if (pluginProcessShimCallbacks.stringCompare(a, b, options, returnAddress, result)) 243 253 return result; 244 254 }
Note:
See TracChangeset
for help on using the changeset viewer.