1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:47:35 +00:00

Kernel: Put Process unveil state in a SpinlockProtected container

This makes path resolution safe to perform without holding the big lock.
This commit is contained in:
Andreas Kling 2022-03-07 21:23:08 +01:00
parent 24f02bd421
commit 580d89f093
7 changed files with 87 additions and 67 deletions

View file

@ -466,13 +466,21 @@ public:
VeilState veil_state() const
{
return m_veil_state;
}
const UnveilNode& unveiled_paths() const
{
return m_unveiled_paths;
return m_unveil_data.with([&](auto const& unveil_data) { return unveil_data.state; });
}
struct UnveilData {
explicit UnveilData(UnveilNode&& p)
: paths(move(p))
{
}
VeilState state { VeilState::None };
UnveilNode paths;
};
auto& unveil_data() { return m_unveil_data; }
auto const& unveil_data() const { return m_unveil_data; }
bool wait_for_tracer_at_next_execve() const
{
return m_wait_for_tracer_at_next_execve;
@ -805,8 +813,7 @@ private:
RefPtr<Timer> m_alarm_timer;
VeilState m_veil_state { VeilState::None };
UnveilNode m_unveiled_paths;
SpinlockProtected<UnveilData> m_unveil_data;
OwnPtr<PerformanceEventBuffer> m_perf_event_buffer;