diff options
Diffstat (limited to 'sandbox/linux/seccomp/maps.cc')
-rw-r--r-- | sandbox/linux/seccomp/maps.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sandbox/linux/seccomp/maps.cc b/sandbox/linux/seccomp/maps.cc index d18405a..d253c63 100644 --- a/sandbox/linux/seccomp/maps.cc +++ b/sandbox/linux/seccomp/maps.cc @@ -221,7 +221,10 @@ char* Maps::allocNearAddr(char* addr_target, size_t size, int prot) const { static_cast<unsigned long>(addr) - kMaxDistance < gap_start) { position = gap_start; } else { - position = addr - kMaxDistance; + position = (addr - kMaxDistance) & ~4095; + if (position < gap_start) { + position = gap_start; + } } } else { // Otherwise, take the end of the region. |