1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

Kernel: Fix crash when delivering signal to barely created thread

We need to wait until a thread is fully set up and ready for running
before attempting to deliver a signal. Otherwise we may not have a
user stack yet.

Also, remove the Skip0SchedulerPasses and Skip1SchedulerPass thread
states that we don't really need anymore with software context switching.

Fixes the kernel crash reported in #3419
This commit is contained in:
Tom 2020-09-07 08:31:00 -06:00 committed by Andreas Kling
parent f1a65d1d70
commit c3d231616c
5 changed files with 32 additions and 21 deletions

View file

@ -114,8 +114,6 @@ public:
Invalid = 0,
Runnable,
Running,
Skip1SchedulerPass,
Skip0SchedulerPasses,
Dying,
Dead,
Stopped,
@ -417,7 +415,7 @@ public:
ShouldUnblockThread dispatch_one_pending_signal();
ShouldUnblockThread dispatch_signal(u8 signal);
bool has_unmasked_pending_signals() const { return m_pending_signals & ~m_signal_mask; }
bool has_unmasked_pending_signals() const { return m_have_any_unmasked_pending_signals.load(AK::memory_order_consume); }
void terminate_due_to_signal(u8 signal);
bool should_ignore_signal(u8 signal) const;
bool has_signal_handler(u8 signal) const;
@ -587,6 +585,7 @@ private:
bool m_dump_backtrace_on_finalization { false };
bool m_should_die { false };
bool m_initialized { false };
Atomic<bool> m_have_any_unmasked_pending_signals { false };
OwnPtr<ThreadTracer> m_tracer;