mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
Kernel: Avoid creating unkillable processes
Found by fuzz-syscalls. Can be reproduced by running this in the Shell: $ syscall exit_thread This leaves the process in the 'Dying' state but never actually removes it. Therefore, avoid this scenario by pretending to exit the entire process.
This commit is contained in:
parent
5963f2084e
commit
1e630fb78a
1 changed files with 6 additions and 0 deletions
|
@ -95,6 +95,12 @@ void Process::sys$exit_thread(Userspace<void*> exit_value)
|
|||
{
|
||||
REQUIRE_PROMISE(thread);
|
||||
cli();
|
||||
|
||||
if (this->thread_count() == 1) {
|
||||
// If this is the last thread, instead kill the process.
|
||||
this->sys$exit(0);
|
||||
}
|
||||
|
||||
Thread::current()->exit(reinterpret_cast<void*>(exit_value.ptr()));
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue