mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
Kernel: Move process umask into protected data :^)
This commit is contained in:
parent
90c0f9664e
commit
08e0e2eb41
Notes:
sideshowbarker
2024-07-18 21:31:36 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/08e0e2eb417
@ -117,6 +117,7 @@ protected:
|
||||
u32 m_promises { 0 };
|
||||
bool m_has_execpromises { false };
|
||||
u32 m_execpromises { 0 };
|
||||
mode_t m_umask { 022 };
|
||||
};
|
||||
|
||||
class ProcessBase : public ProtectedProcessBase {
|
||||
@ -595,8 +596,6 @@ private:
|
||||
|
||||
RefPtr<TTY> m_tty;
|
||||
|
||||
mode_t m_umask { 022 };
|
||||
|
||||
WeakPtr<Region> m_master_tls_region;
|
||||
size_t m_master_tls_size { 0 };
|
||||
size_t m_master_tls_alignment { 0 };
|
||||
|
@ -44,19 +44,18 @@ KResultOr<pid_t> Process::sys$fork(RegisterState& regs)
|
||||
child->m_veil_state = m_veil_state;
|
||||
child->m_unveiled_paths = m_unveiled_paths.deep_copy();
|
||||
child->m_fds = m_fds;
|
||||
child->m_umask = m_umask;
|
||||
child->m_signal_trampoline = m_signal_trampoline;
|
||||
child->m_pg = m_pg;
|
||||
|
||||
{
|
||||
child->unprotect_data();
|
||||
ProtectedDataMutationScope scope { *child };
|
||||
child->m_promises = m_promises;
|
||||
child->m_execpromises = m_execpromises;
|
||||
child->m_has_promises = m_has_promises;
|
||||
child->m_has_execpromises = m_has_execpromises;
|
||||
child->m_sid = m_sid;
|
||||
child->m_extra_gids = m_extra_gids;
|
||||
child->protect_data();
|
||||
child->m_umask = m_umask;
|
||||
}
|
||||
|
||||
dbgln_if(FORK_DEBUG, "fork: child={}", child);
|
||||
|
@ -32,6 +32,7 @@ KResultOr<mode_t> Process::sys$umask(mode_t mask)
|
||||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
auto old_mask = m_umask;
|
||||
ProtectedDataMutationScope scope { *this };
|
||||
m_umask = mask & 0777;
|
||||
return old_mask;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user