1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:07:35 +00:00

Kernel: Delay Process data unprotection in sys$pledge()

Don't unprotect the protected data area until we've validated the pledge
syscall inputs.
This commit is contained in:
Andreas Kling 2022-01-02 12:51:20 +01:00
parent c427f8bbeb
commit a62bdb0761

View file

@ -42,8 +42,6 @@ ErrorOr<FlatPtr> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params*>
return true; return true;
}; };
ProtectedDataMutationScope scope { *this };
u32 new_promises = 0; u32 new_promises = 0;
if (promises) { if (promises) {
if (!parse_pledge(promises->view(), new_promises)) if (!parse_pledge(promises->view(), new_promises))
@ -65,6 +63,8 @@ ErrorOr<FlatPtr> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params*>
// erroring out when parsing the exec promises later. Such bugs silently // erroring out when parsing the exec promises later. Such bugs silently
// leave the caller in an unexpected state. // leave the caller in an unexpected state.
ProtectedDataMutationScope scope { *this };
if (promises) { if (promises) {
m_protected_values.has_promises = true; m_protected_values.has_promises = true;
m_protected_values.promises = new_promises; m_protected_values.promises = new_promises;