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.
This commit is contained in:
parent
b5a02b180c
commit
8ee3a5e09e
Notes:
sideshowbarker
2024-07-18 09:23:05 +09:00
Author: https://github.com/doctor-rd Commit: https://github.com/SerenityOS/serenity/commit/8ee3a5e09ec Pull-request: https://github.com/SerenityOS/serenity/pull/8563
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue