mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:07:34 +00:00
Kernel: Make the Jails' internal design a lot more sane
This is done with 2 major steps: 1. Remove JailManagement singleton and use a structure that resembles what we have with the Process object. This is required later for the second step in this commit, but on its own, is a major change that removes this clunky singleton that had no real usage by itself. 2. Use IntrusiveLists to keep references to Process objects in the same Jail so it will be much more straightforward to iterate on this kind of objects when needed. Previously we locked the entire Process list and we did a simple pointer comparison to check if the checked Process we iterate on is in the same Jail or not, which required taking multiple Spinlocks in a very clumsy and heavyweight way.
This commit is contained in:
parent
9b297c634f
commit
633006926f
14 changed files with 214 additions and 214 deletions
|
@ -516,6 +516,7 @@ ErrorOr<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> main_program_d
|
|||
auto old_credentials = this->credentials();
|
||||
auto new_credentials = old_credentials;
|
||||
auto old_process_attached_jail = m_attached_jail.with([&](auto& jail) -> RefPtr<Jail> { return jail; });
|
||||
auto old_scoped_list = m_jail_process_list.with([&](auto& list) -> RefPtr<ProcessList> { return list; });
|
||||
|
||||
bool executable_is_setid = false;
|
||||
|
||||
|
@ -578,6 +579,11 @@ ErrorOr<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> main_program_d
|
|||
m_attached_jail.with([&](auto& jail) {
|
||||
jail = old_process_attached_jail;
|
||||
});
|
||||
|
||||
m_jail_process_list.with([&](auto& list) {
|
||||
list = old_scoped_list;
|
||||
});
|
||||
|
||||
m_environment = move(environment);
|
||||
|
||||
TRY(m_unveil_data.with([&](auto& unveil_data) -> ErrorOr<void> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue