added 1 changeset to branch 'refs/remotes/xyzzy-github/x86_64' old head: 03add8e7c216a9ba83a2c565cb82962d6cdc53c4 new head: afde37ff9b417de6e7e4b348a4df556c4d25de6f ---------------------------------------------------------------------------- afde37f: Prevent allocating address 0 when inserting an area with B_ANY_ADDRESS. The USER_BASE_ANY definition exists to specify where to start searching for B_ANY_ADDRESS allocations, but this was not being used correctly. On x86_64, this was causing the runtime loader's heap to be allocated at address 0 so NULL pointer accesses were not getting caught. [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ] ---------------------------------------------------------------------------- Commit: afde37ff9b417de6e7e4b348a4df556c4d25de6f Author: Alex Smith <alex@xxxxxxxxxxxxxxxx> Date: Sun Jul 29 13:31:11 2012 UTC ---------------------------------------------------------------------------- 1 file changed, 4 insertions(+), 4 deletions(-) src/system/kernel/vm/VMUserAddressSpace.cpp | 8 ++++---- ---------------------------------------------------------------------------- diff --git a/src/system/kernel/vm/VMUserAddressSpace.cpp b/src/system/kernel/vm/VMUserAddressSpace.cpp index 1420e44..32730a4 100644 --- a/src/system/kernel/vm/VMUserAddressSpace.cpp +++ b/src/system/kernel/vm/VMUserAddressSpace.cpp @@ -461,8 +461,8 @@ VMUserAddressSpace::_InsertAreaSlot(addr_t start, addr_t size, addr_t end, bool foundSpot = false; TRACE(("VMUserAddressSpace::_InsertAreaSlot: address space %p, start " - "0x%lx, size %ld, end 0x%lx, addressSpec %ld, area %p\n", this, start, - size, end, addressSpec, area)); + "0x%lx, size %ld, end 0x%lx, addressSpec %" B_PRIu32 ", area %p\n", + this, start, size, end, addressSpec, area)); // do some sanity checking if (start < fBase || size == 0 || end > fEndAddress @@ -514,8 +514,8 @@ second_chance: // find a hole big enough for a new area if (last == NULL) { // see if we can build it at the beginning of the virtual map - addr_t alignedBase = ROUNDUP(fBase, alignment); - if (is_valid_spot(fBase, alignedBase, size, + addr_t alignedBase = ROUNDUP(start, alignment); + if (is_valid_spot(start, alignedBase, size, next == NULL ? end : next->Base())) { foundSpot = true; area->SetBase(alignedBase);