diff options
author | Liang Qi <liang.qi@qt.io> | 2018-10-01 12:39:45 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-10-01 12:39:45 +0000 |
commit | 1dce83ba31e0e480b8eae43c1fc59c6cd5bb4d5c (patch) | |
tree | 81c96fe47896b4a238a97fcba3bb973b50156a6d /src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp | |
parent | 91bde278ea2e883b4a46cafb1afc1781c71c1590 (diff) | |
parent | 87662fd1b71db11f0759e0be03d8a288ee11b775 (diff) |
Merge "Merge remote-tracking branch 'origin/5.11' into 5.12" into refs/staging/5.12
Diffstat (limited to 'src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp')
-rw-r--r-- | src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp b/src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp index 7addf9e5c2..27f72073c4 100644 --- a/src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp +++ b/src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp @@ -123,10 +123,14 @@ Error setAttributes(MemoryRegion mr, bool writable, bool executable) return SetMemoryRegionAttributes(mr, attributes); } -void OSAllocator::setMemoryAttributes(void* addr, bool writable, bool executable) +void OSAllocator::setMemoryAttributes(void* addr, size_t size, bool writable, bool executable) { - const MRPair* pair = memoryRegionsContainer.getMRPair((Address)addr); - CheckSuccess(setAttributes(pair->vmr, writable, executable)); + Address addressIterator = Address(addr); + for(int i=0; i<(size + ASP_PAGESIZE -1)/ASP_PAGESIZE; i++) { + const MRPair* pair = memoryRegionsContainer.getMRPair(addressIterator); + CheckSuccess(setAttributes(pair->vmr, writable, executable)); + addressIterator += ASP_PAGESIZE; + } } void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable) @@ -140,9 +144,9 @@ void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, Address addressIterator = virtualStart; for(int i=0; i<(bytes + ASP_PAGESIZE -1)/ASP_PAGESIZE; i++) { MRPair pair; + pair.start = addressIterator; CheckSuccess(SplitMemoryRegion(VMR, ASP_PAGESIZE, &pair.vmr)); CheckSuccess(setAttributes(pair.vmr, writable, executable)); - pair.start = addressIterator; memoryRegionsContainer.insertMRPair(&pair); addressIterator += ASP_PAGESIZE; |