mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 17:00:37 +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
Notes:
sideshowbarker
2024-07-18 22:23:10 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/1e630fb78a6 Pull-request: https://github.com/SerenityOS/serenity/pull/5294
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…
Reference in a new issue