Changeset 265097 in webkit
- Timestamp:
- Jul 30, 2020 2:44:45 PM (4 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r265074 r265097 1 2020-07-30 Saam Barati <sbarati@apple.com> 2 3 Strip pointers instead of authing for byteOffset to not allow for a possible way to guess data pac 4 https://bugs.webkit.org/show_bug.cgi?id=214952 5 6 Reviewed by Keith Miller. 7 8 In the old way of doing things, we would auth the vector pointer before subtracting 9 the base from it. Since we never validated the auth, this allowed for a 10 potential data-PAC bypass by just repeatedly calling byteOffset in a loop 11 and observing the integer result of the operation. 12 13 Since byteOffset does no loads/stores, it suffices to just strip the PAC 14 bits before doing the subtraction. This eliminates any such attacks like 15 the above because the PAC bits are ignored. 16 17 * dfg/DFGSpeculativeJIT.cpp: 18 (JSC::DFG::SpeculativeJIT::compileGetTypedArrayByteOffset): 19 * ftl/FTLLowerDFGToB3.cpp: 20 (JSC::FTL::DFG::LowerDFGToB3::compileGetTypedArrayByteOffset): 21 1 22 2020-07-29 Yusuke Suzuki <ysuzuki@apple.com> 2 23 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r264575 r265097 7327 7327 7328 7328 m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSArrayBufferView::offsetOfVector()), vectorGPR); 7329 7330 JITCompiler::Jump nullVector = m_jit.branchPtr(JITCompiler::Equal, vectorGPR, TrustedImmPtr(JSArrayBufferView::nullVectorPtr())); 7329 #if CPU(ARM64E) 7330 m_jit.removeArrayPtrTag(vectorGPR); 7331 #endif 7331 7332 7332 7333 m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSObject::butterflyOffset()), dataGPR); 7333 7334 m_jit.cageWithoutUntagging(Gigacage::JSValue, dataGPR); 7334 7335 cageTypedArrayStorage(baseGPR, vectorGPR);7336 7337 7335 m_jit.loadPtr(MacroAssembler::Address(dataGPR, Butterfly::offsetOfArrayBuffer()), arrayBufferGPR); 7338 // FIXME: This needs caging.7339 // https://bugs.webkit.org/show_bug.cgi?id=1755157340 7336 m_jit.loadPtr(MacroAssembler::Address(arrayBufferGPR, ArrayBuffer::offsetOfData()), dataGPR); 7341 7337 #if CPU(ARM64E) … … 7347 7343 JITCompiler::Jump done = m_jit.jump(); 7348 7344 7349 #if CPU(ARM64E)7350 nullVector.link(&m_jit);7351 #endif7352 7345 emptyByteOffset.link(&m_jit); 7353 7346 m_jit.move(TrustedImmPtr(nullptr), vectorGPR); 7354 7347 7355 7348 done.link(&m_jit); 7356 #if !CPU(ARM64E)7357 ASSERT(!JSArrayBufferView::nullVectorPtr());7358 nullVector.link(&m_jit);7359 #endif7360 7349 7361 7350 strictInt32Result(vectorGPR, node); -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r265000 r265097 4362 4362 4363 4363 LBasicBlock wastefulCase = m_out.newBlock(); 4364 LBasicBlock notNull = m_out.newBlock();4365 4364 LBasicBlock continuation = m_out.newBlock(); 4366 4365 4367 ValueFromBlock n ullVectorOut = m_out.anchor(m_out.constIntPtr(0));4366 ValueFromBlock nonWastefulResult = m_out.anchor(m_out.constIntPtr(0)); 4368 4367 4369 4368 LValue mode = m_out.load32(basePtr, m_heaps.JSArrayBufferView_mode); … … 4372 4371 unsure(continuation), unsure(wastefulCase)); 4373 4372 4374 LBasicBlock lastNext = m_out.appendTo(wastefulCase, notNull); 4375 4376 LValue vector = m_out.loadPtr(basePtr, m_heaps.JSArrayBufferView_vector); 4377 m_out.branch(m_out.equal(vector, m_out.constIntPtr(JSArrayBufferView::nullVectorPtr())), 4378 unsure(continuation), unsure(notNull)); 4379 4380 m_out.appendTo(notNull, continuation); 4373 LBasicBlock lastNext = m_out.appendTo(wastefulCase, continuation); 4374 4375 LValue vectorPtr = m_out.loadPtr(basePtr, m_heaps.JSArrayBufferView_vector); 4376 vectorPtr = removeArrayPtrTag(vectorPtr); 4381 4377 4382 4378 LValue butterflyPtr = caged(Gigacage::JSValue, m_out.loadPtr(basePtr, m_heaps.JSObject_butterfly), basePtr); 4383 4379 LValue arrayBufferPtr = m_out.loadPtr(butterflyPtr, m_heaps.Butterfly_arrayBuffer); 4384 4380 4385 LValue vectorPtr = caged(Gigacage::Primitive, vector, basePtr);4386 4387 // FIXME: This needs caging.4388 // https://bugs.webkit.org/show_bug.cgi?id=1755154389 4381 LValue dataPtr = m_out.loadPtr(arrayBufferPtr, m_heaps.ArrayBuffer_data); 4390 4382 dataPtr = removeArrayPtrTag(dataPtr); … … 4395 4387 m_out.appendTo(continuation, lastNext); 4396 4388 4397 setInt32(m_out.castToInt32(m_out.phi(pointerType(), n ullVectorOut, wastefulOut)));4389 setInt32(m_out.castToInt32(m_out.phi(pointerType(), nonWastefulResult, wastefulOut))); 4398 4390 } 4399 4391
Note: See TracChangeset
for help on using the changeset viewer.