diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-02-14 16:49:53 +0330 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2022-02-15 18:03:02 +0200 |
commit | a1cb2c371a72af9556a629fb4f89acee92626708 (patch) | |
tree | 9eaeb5057f5f4d2036879ac43c53b897406ae0a7 /Kernel/Process.cpp | |
parent | 80e61985632b59acb10a9cf384c7942b2d9bd27d (diff) | |
download | serenity-a1cb2c371a72af9556a629fb4f89acee92626708.zip |
AK+Kernel: OOM-harden most parts of Trie
The only part of Unveil that can't handle OOM gracefully is the
String::formatted() use in the node metadata.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r-- | Kernel/Process.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 13e6076a86..fb30fea499 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -218,17 +218,18 @@ void Process::unprotect_data() ErrorOr<NonnullRefPtr<Process>> Process::try_create(RefPtr<Thread>& first_thread, NonnullOwnPtr<KString> name, UserID uid, GroupID gid, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd, RefPtr<Custody> executable, TTY* tty, Process* fork_parent) { auto space = TRY(Memory::AddressSpace::try_create(fork_parent ? &fork_parent->address_space() : nullptr)); - auto process = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Process(move(name), uid, gid, ppid, is_kernel_process, move(cwd), move(executable), tty))); + auto process = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Process(move(name), uid, gid, ppid, is_kernel_process, move(cwd), move(executable), tty, UnveilNode { "/"sv, UnveilMetadata(TRY(KString::try_create("/"sv))) }))); TRY(process->attach_resources(move(space), first_thread, fork_parent)); return process; } -Process::Process(NonnullOwnPtr<KString> name, UserID uid, GroupID gid, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd, RefPtr<Custody> executable, TTY* tty) +Process::Process(NonnullOwnPtr<KString> name, UserID uid, GroupID gid, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd, RefPtr<Custody> executable, TTY* tty, UnveilNode unveil_tree) : m_name(move(name)) , m_is_kernel_process(is_kernel_process) , m_executable(move(executable)) , m_cwd(move(cwd)) , m_tty(tty) + , m_unveiled_paths(move(unveil_tree)) , m_wait_blocker_set(*this) { // Ensure that we protect the process data when exiting the constructor. |