From cdc6ad72bbcb54caaa838c88be4d0e576d4d3b03 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 24 Jul 2008 23:03:59 +0000 Subject: [PATCH] Don't clone the user thread area on fork(), just create a new one for the new team. Otherwise it would lose it's properties (full lock, B_KERNEL_AREA). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26622 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/team.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp index e19afe3657..2e0d6ba0b1 100644 --- a/src/system/kernel/team.cpp +++ b/src/system/kernel/team.cpp @@ -1481,23 +1481,24 @@ fork_team(void) cookie = 0; while (get_next_area_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { - void *address; - area_id area = vm_copy_area(team->address_space->id, info.name, - &address, B_CLONE_ADDRESS, info.protection, info.area); - if (area < B_OK) { - status = area; - break; - } + if (info.area == parentTeam->user_data_area) { + // don't clone the user area; just create a new one + status = create_team_user_data(team); + if (status != B_OK) + break; - if (info.area == parentThread->user_stack_area) { - forkArgs->user_stack_area = area; - } else if (info.area == parentTeam->user_data_area) { - team->user_data = (addr_t)address; - team->used_user_data = 0; - team->user_data_size = info.size; - team->user_data_area = area; - team->free_user_threads = NULL; forkArgs->user_thread = team_allocate_user_thread(team); + } else { + void *address; + area_id area = vm_copy_area(team->address_space->id, info.name, + &address, B_CLONE_ADDRESS, info.protection, info.area); + if (area < B_OK) { + status = area; + break; + } + + if (info.area == parentThread->user_stack_area) + forkArgs->user_stack_area = area; } }