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
commit 580d89f093
Notes: sideshowbarker 2024-07-17 17:49:23 +09:00
7 changed files with 87 additions and 67 deletions

View file

@ -523,9 +523,12 @@ ErrorOr<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> main_program_d
m_arguments = move(arguments);
m_environment = move(environment);
m_veil_state = VeilState::None;
m_unveiled_paths.clear();
m_unveiled_paths.set_metadata({ TRY(KString::try_create("/"sv)), UnveilAccess::None, false });
TRY(m_unveil_data.with([&](auto& unveil_data) -> ErrorOr<void> {
unveil_data.state = VeilState::None;
unveil_data.paths.clear();
unveil_data.paths.set_metadata({ TRY(KString::try_create("/"sv)), UnveilAccess::None, false });
return {};
}));
for (auto& property : m_coredump_properties)
property = {};