summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/pledge.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-01-02 12:51:20 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-02 18:08:02 +0100
commita62bdb07615dbb4cb675133a84e87444164b99a7 (patch)
treef5460f970122cc4dbff44e9ad634371f443efa72 /Kernel/Syscalls/pledge.cpp
parentc427f8bbeb7f67a6ce16c6197bb4295824fbeebe (diff)
downloadserenity-a62bdb07615dbb4cb675133a84e87444164b99a7.zip
Kernel: Delay Process data unprotection in sys$pledge()
Don't unprotect the protected data area until we've validated the pledge syscall inputs.
Diffstat (limited to 'Kernel/Syscalls/pledge.cpp')
-rw-r--r--Kernel/Syscalls/pledge.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Syscalls/pledge.cpp b/Kernel/Syscalls/pledge.cpp
index 91c7306ad4..47457205e3 100644
--- a/Kernel/Syscalls/pledge.cpp
+++ b/Kernel/Syscalls/pledge.cpp
@@ -42,8 +42,6 @@ ErrorOr<FlatPtr> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params*>
return true;
};
- ProtectedDataMutationScope scope { *this };
-
u32 new_promises = 0;
if (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
// leave the caller in an unexpected state.
+ ProtectedDataMutationScope scope { *this };
+
if (promises) {
m_protected_values.has_promises = true;
m_protected_values.promises = new_promises;