1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

Kernel: De-atomicize fields for promises in Process

These 4 fields were made `Atomic` in
c3f668a758, at which time these were still
accessed unserialized and TOCTOU bugs could happen. Later, in
8ed06ad814, we serialized access to these
fields in a number of helper methods, removing the need for `Atomic`.
This commit is contained in:
Jelle Raaijmakers 2023-06-08 09:22:48 +02:00 committed by Andreas Kling
parent 7f855ad6b3
commit 81a6976e90
3 changed files with 11 additions and 11 deletions

View file

@ -120,10 +120,10 @@ class Process final
RefPtr<TTY> tty;
bool dumpable { false };
bool executable_is_setid { false };
Atomic<bool> has_promises { false };
Atomic<u32> promises { 0 };
Atomic<bool> has_execpromises { false };
Atomic<u32> execpromises { 0 };
bool has_promises { false };
u32 promises { 0 };
bool has_execpromises { false };
u32 execpromises { 0 };
mode_t umask { 022 };
VirtualAddress signal_trampoline;
Atomic<u32> thread_count { 0 };
@ -520,7 +520,7 @@ public:
bool has_promises() const
{
return with_protected_data([](auto& protected_data) { return protected_data.has_promises.load(); });
return with_protected_data([](auto& protected_data) { return protected_data.has_promises; });
}
bool has_promised(Pledge pledge) const
{