1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

Kernel: Perform exec-into-new-image directly in sys$execve()

This ensures that everything allocated on the stack in Process::exec()
gets cleaned up. We had a few leaks related to the parsing of shebang
(#!) executables that get fixed by this.
This commit is contained in:
Andreas Kling 2022-01-13 23:12:51 +01:00
parent c7dbe27781
commit 0e72b04e7d
3 changed files with 39 additions and 44 deletions

View file

@ -151,7 +151,9 @@ ErrorOr<NonnullRefPtr<Process>> Process::try_create_user_process(RefPtr<Thread>&
setup_description(1);
setup_description(2);
if (auto result = process->exec(move(path_string), move(arguments), move(environment)); result.is_error()) {
Thread* new_main_thread = nullptr;
u32 prev_flags = 0;
if (auto result = process->exec(move(path_string), move(arguments), move(environment), new_main_thread, prev_flags); result.is_error()) {
dbgln("Failed to exec {}: {}", path, result.error());
first_thread = nullptr;
return result.release_error();