mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-18 04:54:36 +03:00
[Bug] Use ReadWrite scope to fill memory in JitAllocator::shrink() (MAP_JIT)
This commit is contained in:
@@ -915,8 +915,13 @@ Error JitAllocator::shrink(void* rxPtr, size_t newSize) noexcept {
|
|||||||
block->markShrunkArea(areaStart + areaShrunkSize, areaEnd);
|
block->markShrunkArea(areaStart + areaShrunkSize, areaEnd);
|
||||||
|
|
||||||
// Fill released memory if the secure mode is enabled.
|
// Fill released memory if the secure mode is enabled.
|
||||||
if (Support::test(impl->options, JitAllocatorOptions::kFillUnusedMemory))
|
if (Support::test(impl->options, JitAllocatorOptions::kFillUnusedMemory)) {
|
||||||
JitAllocatorImpl_fillPattern(block->rwPtr() + (areaStart + areaShrunkSize) * pool->granularity, fillPattern(), areaDiff * pool->granularity);
|
uint8_t* spanPtr = block->rwPtr() + (areaStart + areaShrunkSize) * pool->granularity;
|
||||||
|
size_t spanSize = areaDiff * pool->granularity;
|
||||||
|
|
||||||
|
VirtMem::ProtectJitReadWriteScope scope(spanPtr, spanSize);
|
||||||
|
JitAllocatorImpl_fillPattern(spanPtr, fillPattern(), spanSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return kErrorOk;
|
return kErrorOk;
|
||||||
|
|||||||
Reference in New Issue
Block a user