diff options
author | markus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 01:55:03 +0000 |
---|---|---|
committer | markus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 01:55:03 +0000 |
commit | 13ac7b415d9c03f7861b634695af5c4887574013 (patch) | |
tree | bee235a31c31fe3a36493186dd130118040d5312 /sandbox | |
parent | 745cf67ad12fc84d7c96ecf5c4e571717bbde176 (diff) | |
download | chromium_src-13ac7b415d9c03f7861b634695af5c4887574013.zip chromium_src-13ac7b415d9c03f7861b634695af5c4887574013.tar.gz chromium_src-13ac7b415d9c03f7861b634695af5c4887574013.tar.bz2 |
Correctly align memory allocations in the case where we need to allocate memory
as far away from the stack as possible, but still as close to the VDSO as we
can.
BUG=none
TEST=run the tests in a tight loop and notice that they no longer randomly fail
Review URL: http://codereview.chromium.org/1807002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45775 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-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. |