summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorRalf Donau <ruelle@volleyballschlaeger.de>2021-07-08 20:29:46 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-10 21:59:29 +0200
commit8ee3a5e09ecfba40a3b53af0b3a7bd08424479e5 (patch)
tree0bdc2bf36bda553f9522ad113971f70063175dfd /Kernel/Syscalls
parentb5a02b180c5ec7e0dabc4d7d9b79e0c462ef35da (diff)
downloadserenity-8ee3a5e09ecfba40a3b53af0b3a7bd08424479e5.zip
Kernel: Logic fix in the pledge syscall
Pledge should check m_has_promises. Calling pledge("", nullptr) does not fail on an already pledged process anymore.
Diffstat (limited to 'Kernel/Syscalls')
-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 b03a011598..ae9e7d2d71 100644
--- a/Kernel/Syscalls/pledge.cpp
+++ b/Kernel/Syscalls/pledge.cpp
@@ -53,7 +53,7 @@ KResultOr<FlatPtr> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params
u32 new_promises = 0;
if (!parse_pledge(promises, new_promises))
return EINVAL;
- if (m_promises && (!new_promises || new_promises & ~m_promises))
+ if (m_has_promises && (new_promises & ~m_promises))
return EPERM;
m_has_promises = true;
@@ -64,7 +64,7 @@ KResultOr<FlatPtr> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params
u32 new_execpromises = 0;
if (!parse_pledge(execpromises, new_execpromises))
return EINVAL;
- if (m_execpromises && (!new_execpromises || new_execpromises & ~m_execpromises))
+ if (m_has_execpromises && (new_execpromises & ~m_execpromises))
return EPERM;
m_has_execpromises = true;
m_execpromises = new_execpromises;