Kernel: Remove unneeded Thread::set_default_signal_dispositions

The `default_signal_action(u8 signal)` function already has the
full mapping. The only caveat being that now we need to make
sure the thread constructor and clear_signals() method do the work
of resetting the m_signal_action_data array, instead or relying on
the previous logic in set_default_signal_dispositions.
This commit is contained in:
Brian Gianforcaro 2021-02-21 02:03:49 -08:00 committed by Andreas Kling
parent df73a86875
commit a977cdd9ac
Notes: sideshowbarker 2024-07-18 22:03:32 +09:00
3 changed files with 5 additions and 13 deletions

View File

@ -544,7 +544,6 @@ KResult Process::do_exec(NonnullRefPtr<FileDescription> main_program_description
m_coredump_metadata.clear();
auto current_thread = Thread::current();
current_thread->set_default_signal_dispositions();
current_thread->clear_signals();
clear_futex_queues_on_exec();

View File

@ -84,7 +84,7 @@ Thread::Thread(NonnullRefPtr<Process> process, NonnullOwnPtr<Region> kernel_stac
}
if constexpr (THREAD_DEBUG)
dbgln("Created new thread {}({}:{})", m_process->name(), m_process->pid().value(), m_tid.value());
set_default_signal_dispositions();
m_fpu_state = (FPUState*)kmalloc_aligned<16>(sizeof(FPUState));
reset_fpu_state();
m_tss.iomapbase = sizeof(TSS32);
@ -547,6 +547,9 @@ void Thread::clear_signals()
m_signal_mask = 0;
m_pending_signals = 0;
m_have_any_unmasked_pending_signals.store(false, AK::memory_order_release);
Span<SignalActionData> action_data(m_signal_action_data);
action_data.fill({});
}
// Certain exceptions, such as SIGSEGV and SIGILL, put a
@ -842,14 +845,6 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
return DispatchSignalResult::Continue;
}
void Thread::set_default_signal_dispositions()
{
// FIXME: Set up all the right default actions. See signal(7).
memset(&m_signal_action_data, 0, sizeof(m_signal_action_data));
m_signal_action_data[SIGCHLD].handler_or_sigaction = VirtualAddress(SIG_IGN);
m_signal_action_data[SIGWINCH].handler_or_sigaction = VirtualAddress(SIG_IGN);
}
RegisterState& Thread::get_register_dump_from_stack()
{
auto* trap = current_trap();

View File

@ -1007,8 +1007,6 @@ public:
FPUState& fpu_state() { return *m_fpu_state; }
void set_default_signal_dispositions();
KResult make_thread_specific_region(Badge<Process>);
unsigned syscall_count() const { return m_syscall_count; }
@ -1241,7 +1239,7 @@ private:
u32 m_kernel_stack_top { 0 };
OwnPtr<Region> m_kernel_stack_region;
VirtualAddress m_thread_specific_data;
SignalActionData m_signal_action_data[32];
SignalActionData m_signal_action_data[32] { };
Blocker* m_blocker { nullptr };
#if LOCK_DEBUG