kernel/vm: Don't commit memory for non-private clones in vm_clone_area.

The source area should already have dealt with commitments (or not.)
Fixes cloning of physical map areas and the like (#19143.)
This commit is contained in:
Augustin Cavalier
2024-10-03 12:07:35 -04:00
parent ce2b9f5ec2
commit 9f07fe52a4
+5 -1
View File
@@ -2480,13 +2480,17 @@ vm_clone_area(team_id team, const char* name, void** address,
} else if (sourceArea->cache_type == CACHE_TYPE_NULL) {
status = B_NOT_ALLOWED;
} else {
uint32 flags = 0;
if (mapping != REGION_PRIVATE_MAP)
flags |= CREATE_AREA_DONT_COMMIT_MEMORY;
virtual_address_restrictions addressRestrictions = {};
addressRestrictions.address = *address;
addressRestrictions.address_specification = addressSpec;
status = map_backing_store(targetAddressSpace, cache,
sourceArea->cache_offset, name, sourceArea->Size(),
sourceArea->wiring, protection, sourceArea->protection_max,
mapping, 0, &addressRestrictions,
mapping, flags, &addressRestrictions,
kernel, &newArea, address);
}
if (status == B_OK && mapping != REGION_PRIVATE_MAP) {