[PATCH] D26312: Correct mprotect page boundries to round up end page. Fixes PR30905.
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 4 15:45:28 PDT 2016
chandlerc added a comment.
Slight tweak here...
================
Comment at: lib/Support/Unix/Memory.inc:158-161
+ // Round down the start address to a page boundary
+ start = start & ~(PageSize - 1);
+ // Round up the end address to a page boundary
+ end = (end + PageSize - 1) & ~(PageSize - 1);
----------------
Instead of this, I would use alignAddr. It seems much easier to get correct:
void *Start = alignAddr(M.Address - PageSize + 1, PageSize);
void *End = alignAddr(M.Address + M.Size, PageSize);
https://reviews.llvm.org/D26312
More information about the llvm-commits
mailing list