[PATCH] D26312: Correct mprotect page boundries to round up end page. Fixes PR30905.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 4 21:32:00 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL286032: Correct mprotect page boundries to round up end page. Fixes PR30905. (authored by asbirlea).
Changed prior to commit:
https://reviews.llvm.org/D26312?vs=76958&id=76962#toc
Repository:
rL LLVM
https://reviews.llvm.org/D26312
Files:
llvm/trunk/lib/Support/Unix/Memory.inc
Index: llvm/trunk/lib/Support/Unix/Memory.inc
===================================================================
--- llvm/trunk/lib/Support/Unix/Memory.inc
+++ llvm/trunk/lib/Support/Unix/Memory.inc
@@ -153,7 +153,10 @@
int Protect = getPosixProtectionFlags(Flags);
- int Result = ::mprotect((void*)((uintptr_t)M.Address & ~(PageSize-1)), PageSize*((M.Size+PageSize-1)/PageSize), Protect);
+ uintptr_t Start = alignAddr((uint8_t *)M.Address - PageSize + 1, PageSize);
+ uintptr_t End = alignAddr((uint8_t *)M.Address + M.Size, PageSize);
+ int Result = ::mprotect((void *)Start, End - Start, Protect);
+
if (Result != 0)
return std::error_code(errno, std::generic_category());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26312.76962.patch
Type: text/x-patch
Size: 699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161105/fbe679ea/attachment.bin>
More information about the llvm-commits
mailing list