Randomise the start of the jit copy function
Created attachment 284157 [details] Patch
Comment on attachment 284157 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=284157&action=review > Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp:280 > + functionStartOffset &= 31; This looks wrong – I think you're picking an unaligned point within the first 32 bytes I think you want: functionStartOffset &= ~0x1F; or even: functionStartOffset -= functionStartOffset & 0x1F;
Comment on attachment 284157 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=284157&action=review >> Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp:280 >> + functionStartOffset &= 31; > > This looks wrong – I think you're picking an unaligned point within the first 32 bytes > > I think you want: > functionStartOffset &= ~0x1F; > or even: > functionStartOffset -= functionStartOffset & 0x1F; Yes, this was looking wrong for me too. You definitely want: functionStartOffset &= ~0x1F;
Comment on attachment 284157 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=284157&action=review > Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp:277 > + size_t functionStartOffset = WTF::cryptographicallyRandomNumber() % stubExtent; Please do not add a WTF:: prefix. > Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp:284 > + LinkBuffer linkBuffer(jit, static_cast<char *>(stubBase) + functionStartOffset, stubSize - functionStartOffset); Misplaced star.
<rdar://problems/32004913>