Kernel: Move process "dumpable" flag into protected data

This commit is contained in:
Andreas Kling 2021-03-10 22:42:07 +01:00
parent 3d27269f13
commit 37ad880660
Notes: sideshowbarker 2024-07-18 21:32:45 +09:00
2 changed files with 10 additions and 4 deletions

View File

@ -725,4 +725,11 @@ bool Process::add_thread(Thread& thread)
return is_first;
}
void Process::set_dumpable(bool dumpable)
{
if (dumpable == protected_data().dumpable)
return;
MutableProtectedData(*this)->dumpable = dumpable;
}
}

View File

@ -123,6 +123,7 @@ class Process
uid_t suid { 0 };
gid_t sgid { 0 };
Vector<gid_t> extra_gids;
bool dumpable { false };
};
// Helper class to temporarily unprotect a process's protected data so you can write to it.
@ -212,8 +213,8 @@ public:
gid_t sgid() const { return protected_data().sgid; }
ProcessID ppid() const { return protected_data().ppid; }
bool is_dumpable() const { return m_dumpable; }
void set_dumpable(bool dumpable) { m_dumpable = dumpable; }
bool is_dumpable() const { return protected_data().dumpable; }
void set_dumpable(bool);
mode_t umask() const { return m_umask; }
@ -590,8 +591,6 @@ private:
mode_t m_umask { 022 };
bool m_dumpable { true };
WeakPtr<Region> m_master_tls_region;
size_t m_master_tls_size { 0 };
size_t m_master_tls_alignment { 0 };