Changeset 275212 in webkit
- Timestamp:
- Mar 30, 2021, 10:21:18 AM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/JavaScriptCore/ChangeLog ¶
r275190 r275212 1 2021-03-30 Mark Lam <mark.lam@apple.com> 2 3 Ensure that GlobalPropertyInfo is allocated on the stack. 4 https://bugs.webkit.org/show_bug.cgi?id=223911 5 rdar://75865742 6 7 Reviewed by Yusuke Suzuki. 8 9 We rely on GlobalPropertyInfo being allocated on the stack to allow its JSValue 10 value to be scanned by the GC. Unfortunately, an ASAN compilation would choose 11 to allocate the GlobalPropertyInfo on a side buffer instead of directly on the 12 stack. This prevents the GC from doing the needed scan. 13 14 We'll fix this by suppressing ASAN on the functions that allocated GlobalPropertyInfo 15 arrays. Also added an ASSERT in the GlobalPropertyInfo constructor to assert that 16 it is allocated on the stack. 17 18 * Scripts/wkbuiltins/builtins_generate_internals_wrapper_implementation.py: 19 (BuiltinsInternalsWrapperImplementationGenerator.generate_initialize_method): 20 * runtime/JSGlobalObject.cpp: 21 (JSC::JSGlobalObject::initStaticGlobals): 22 (JSC::JSGlobalObject::init): 23 (JSC::JSGlobalObject::exposeDollarVM): 24 * runtime/JSGlobalObject.h: 25 (JSC::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo): 26 1 27 2021-03-29 Xan López <xan@igalia.com> 2 28 -
TabularUnified trunk/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_internals_wrapper_implementation.py ¶
r273138 r275212 144 144 145 145 def generate_initialize_method(self): 146 lines = [" void JSBuiltinInternalFunctions::initialize(JSDOMGlobalObject& globalObject)",146 lines = ["SUPPRESS_ASAN void JSBuiltinInternalFunctions::initialize(JSDOMGlobalObject& globalObject)", 147 147 "{", 148 148 " UNUSED_PARAM(globalObject);"] -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp ¶
r274893 r275212 581 581 } 582 582 583 SUPPRESS_ASAN inline void JSGlobalObject::initStaticGlobals(VM& vm) 584 { 585 GlobalPropertyInfo staticGlobals[] = { 586 GlobalPropertyInfo(vm.propertyNames->NaN, jsNaN(), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 587 GlobalPropertyInfo(vm.propertyNames->Infinity, jsNumber(std::numeric_limits<double>::infinity()), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 588 GlobalPropertyInfo(vm.propertyNames->undefinedKeyword, jsUndefined(), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 589 #if ASSERT_ENABLED 590 GlobalPropertyInfo(vm.propertyNames->builtinNames().assertPrivateName(), JSFunction::create(vm, this, 1, String(), assertCall), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 591 #endif 592 }; 593 addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals)); 594 } 595 583 596 void JSGlobalObject::init(VM& vm) 584 597 { … … 1358 1371 } 1359 1372 1360 GlobalPropertyInfo staticGlobals[] = { 1361 GlobalPropertyInfo(vm.propertyNames->NaN, jsNaN(), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 1362 GlobalPropertyInfo(vm.propertyNames->Infinity, jsNumber(std::numeric_limits<double>::infinity()), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 1363 GlobalPropertyInfo(vm.propertyNames->undefinedKeyword, jsUndefined(), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 1364 #if ASSERT_ENABLED 1365 GlobalPropertyInfo(vm.propertyNames->builtinNames().assertPrivateName(), JSFunction::create(vm, this, 1, String(), assertCall), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 1366 #endif 1367 }; 1368 addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals)); 1373 initStaticGlobals(vm); 1369 1374 1370 1375 if (UNLIKELY(Options::useDollarVM())) … … 2109 2114 } 2110 2115 2111 void JSGlobalObject::exposeDollarVM(VM& vm)2116 SUPPRESS_ASAN void JSGlobalObject::exposeDollarVM(VM& vm) 2112 2117 { 2113 2118 RELEASE_ASSERT(g_jscConfig.restrictedOptionsEnabled && Options::useDollarVM()); -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h ¶
r274609 r275212 1117 1117 , attributes(a) 1118 1118 { 1119 ASSERT(Thread::current().stack().contains(this)); 1119 1120 } 1120 1121 … … 1139 1140 1140 1141 JS_EXPORT_PRIVATE void init(VM&); 1142 void initStaticGlobals(VM&); 1141 1143 void fixupPrototypeChainWithObjectPrototype(VM&); 1142 1144 -
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r275206 r275212 1 2021-03-30 Mark Lam <mark.lam@apple.com> 2 3 Ensure that GlobalPropertyInfo is allocated on the stack. 4 https://bugs.webkit.org/show_bug.cgi?id=223911 5 rdar://75865742 6 7 Reviewed by Yusuke Suzuki. 8 9 * bindings/js/JSDOMGlobalObject.cpp: 10 (WebCore::JSDOMGlobalObject::addBuiltinGlobals): 11 * bindings/js/JSDOMWindowBase.cpp: 12 (WebCore::JSDOMWindowBase::finishCreation): 13 (WebCore::JSDOMWindowBase::initStaticGlobals): 14 * bindings/js/JSDOMWindowBase.h: 15 1 16 2021-03-30 Sam Weinig <weinig@apple.com> 2 17 -
TabularUnified trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp ¶
r275151 r275212 174 174 } 175 175 176 void JSDOMGlobalObject::addBuiltinGlobals(VM& vm)176 SUPPRESS_ASAN void JSDOMGlobalObject::addBuiltinGlobals(VM& vm) 177 177 { 178 178 m_builtinInternalFunctions.initialize(*this); -
TabularUnified trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp ¶
r273203 r275212 2 2 * Copyright (C) 2000 Harri Porten (porten@kde.org) 3 3 * Copyright (C) 2006 Jon Shier (jshier@iastate.edu) 4 * Copyright (C) 2003-202 0Apple Inc. All rights reseved.4 * Copyright (C) 2003-2021 Apple Inc. All rights reseved. 5 5 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 6 6 * Copyright (c) 2015 Canon Inc. All rights reserved. … … 101 101 } 102 102 103 void JSDOMWindowBase::finishCreation(VM& vm, JSWindowProxy* proxy) 104 { 105 Base::finishCreation(vm, proxy); 106 ASSERT(inherits(vm, info())); 107 103 SUPPRESS_ASAN inline void JSDOMWindowBase::initStaticGlobals(JSC::VM& vm) 104 { 108 105 auto& builtinNames = static_cast<JSVMClientData*>(vm.clientData)->builtinNames(); 109 106 … … 114 111 115 112 addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals)); 113 } 114 115 void JSDOMWindowBase::finishCreation(VM& vm, JSWindowProxy* proxy) 116 { 117 Base::finishCreation(vm, proxy); 118 ASSERT(inherits(vm, info())); 119 120 initStaticGlobals(vm); 116 121 117 122 if (m_wrapped && m_wrapped->frame() && m_wrapped->frame()->settings().needsSiteSpecificQuirks()) -
TabularUnified trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h ¶
r273203 r275212 1 1 /* 2 2 * Copyright (C) 2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003-20 17Apple Inc. All rights reseved.3 * Copyright (C) 2003-2021 Apple Inc. All rights reseved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 94 94 JSDOMWindowBase(JSC::VM&, JSC::Structure*, RefPtr<DOMWindow>&&, JSWindowProxy*); 95 95 void finishCreation(JSC::VM&, JSWindowProxy*); 96 void initStaticGlobals(JSC::VM&); 96 97 97 98 RefPtr<JSC::WatchpointSet> m_windowCloseWatchpoints;
Note:
See TracChangeset
for help on using the changeset viewer.