From 38c1f44d703ab30dd09d23d863e4c8a9f6742742 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 14 Jun 2011 13:39:54 +0000 Subject: [PATCH] load_image_internal(): Forgot to reserve room on the stack for the program arguments and environment. Fixes failures to start programs in case the space available through rounding to full page sizes wasn't sufficient. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42184 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/team.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp index a4b37e25d5..9f6e287b63 100644 --- a/src/system/kernel/team.cpp +++ b/src/system/kernel/team.cpp @@ -1706,13 +1706,16 @@ load_image_internal(char**& _flatArgs, size_t flatArgsSize, int32 argCount, // Create a kernel thread, but under the context of the new team // The new thread will take over ownership of teamArgs. - thread = thread_create_thread( - ThreadCreationAttributes(team_create_thread_start, threadName, - B_NORMAL_PRIORITY, teamArgs, teamID, mainThread), - false); - if (thread < 0) { - status = thread; - goto err5; + { + ThreadCreationAttributes threadAttributes(team_create_thread_start, + threadName, B_NORMAL_PRIORITY, teamArgs, teamID, mainThread); + threadAttributes.additional_stack_size = sizeof(user_space_program_args) + + teamArgs->flat_args_size; + thread = thread_create_thread(threadAttributes, false); + if (thread < 0) { + status = thread; + goto err5; + } } // The team has been created successfully, so we keep the reference. Or