1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 21:47:43 +00:00

Kernel: Move process termination status/signal into protected data

This commit is contained in:
Andreas Kling 2021-03-11 14:24:08 +01:00
parent 4916b5c130
commit 1608ef37d8
3 changed files with 16 additions and 7 deletions

View file

@ -334,7 +334,10 @@ void Process::crash(int signal, u32 eip, bool out_of_memory)
}
dump_backtrace();
}
m_termination_signal = signal;
{
ProtectedDataMutationScope scope { *this };
m_termination_signal = signal;
}
set_dump_core(!out_of_memory);
space().dump_regions();
VERIFY(is_user_process());
@ -578,8 +581,11 @@ void Process::terminate_due_to_signal(u8 signal)
VERIFY(signal < 32);
VERIFY(Process::current() == this);
dbgln("Terminating {} due to signal {}", *this, signal);
m_termination_status = 0;
m_termination_signal = signal;
{
ProtectedDataMutationScope scope { *this };
m_termination_status = 0;
m_termination_signal = signal;
}
die();
}

View file

@ -121,6 +121,8 @@ protected:
VirtualAddress m_signal_trampoline;
Atomic<u32> m_thread_count { 0 };
IntrusiveList<Thread, &Thread::m_process_thread_list_node> m_thread_list;
u8 m_termination_status { 0 };
u8 m_termination_signal { 0 };
};
class ProcessBase : public ProtectedProcessBase {
@ -579,8 +581,6 @@ private:
};
Vector<FileDescriptionAndFlags> m_fds;
u8 m_termination_status { 0 };
u8 m_termination_signal { 0 };
mutable RecursiveSpinLock m_thread_list_lock;
const bool m_is_kernel_process;

View file

@ -31,8 +31,11 @@ namespace Kernel {
void Process::sys$exit(int status)
{
m_termination_status = status;
m_termination_signal = 0;
{
ProtectedDataMutationScope scope { *this };
m_termination_status = status;
m_termination_signal = 0;
}
die();
Thread::current()->die_if_needed();
VERIFY_NOT_REACHED();