kernel/vm: Set CLONEABLE_AREA before cloning areas for transfer.
This commit is contained in:
@@ -5992,6 +5992,11 @@ transfer_area(area_id id, void** _address, uint32 addressSpec, team_id target,
|
||||
if (info.team != thread_get_current_thread()->team->id)
|
||||
return B_PERMISSION_DENIED;
|
||||
|
||||
// We need to mark the area cloneable so the following operations work.
|
||||
status = set_area_protection(id, info.protection | B_CLONEABLE_AREA);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
area_id clonedArea = vm_clone_area(target, info.name, _address,
|
||||
addressSpec, info.protection, REGION_NO_PRIVATE_MAP, id, kernel);
|
||||
if (clonedArea < 0)
|
||||
@@ -6003,6 +6008,9 @@ transfer_area(area_id id, void** _address, uint32 addressSpec, team_id target,
|
||||
return status;
|
||||
}
|
||||
|
||||
// Now we can reset the protection to whatever it was before.
|
||||
set_area_protection(clonedArea, info.protection);
|
||||
|
||||
// TODO: The clonedArea is B_SHARED_AREA, which is not really desired.
|
||||
|
||||
return clonedArea;
|
||||
|
||||
Reference in New Issue
Block a user