Fix potential VM map fragmentation regression.
Revert 245ae6036c
(Support --with-lg-page
values larger than actual page size.), because it could cause VM map
fragmentation if the kernel grows mmap()ed memory downward.
This resolves #391.
This commit is contained in:
@@ -813,7 +813,7 @@ sa2u(size_t size, size_t alignment)
|
||||
* Calculate the multi-page mapping that large_palloc() would need in
|
||||
* order to guarantee the alignment.
|
||||
*/
|
||||
if (usize + large_pad + PAGE_CEILING(alignment) < usize) {
|
||||
if (usize + large_pad + PAGE_CEILING(alignment) - PAGE < usize) {
|
||||
/* size_t overflow. */
|
||||
return (0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user