mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
Kernel: Update process promise states on execve() and fork()
We now move the execpromises state into the regular promises, and clear the execpromises state. Also make sure to duplicate the promise state on fork. This fixes an issue where "su" would launch a shell which immediately crashed due to not having pledged "stdio".
This commit is contained in:
parent
1e25d2b734
commit
c7858622ec
4 changed files with 10 additions and 1 deletions
|
@ -637,6 +637,7 @@ private:
|
|||
|
||||
bool m_has_promises { false };
|
||||
u32 m_promises { 0 };
|
||||
bool m_has_execpromises { false };
|
||||
u32 m_execpromises { 0 };
|
||||
|
||||
VeilState m_veil_state { VeilState::None };
|
||||
|
|
|
@ -544,6 +544,10 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
|||
m_environment = environment;
|
||||
|
||||
m_promises = m_execpromises;
|
||||
m_has_promises = m_has_execpromises;
|
||||
|
||||
m_execpromises = 0;
|
||||
m_has_execpromises = false;
|
||||
|
||||
m_veil_state = VeilState::None;
|
||||
m_unveiled_paths.clear();
|
||||
|
|
|
@ -43,6 +43,8 @@ pid_t Process::sys$fork(RegisterState& regs)
|
|||
child->m_root_directory_relative_to_global_root = m_root_directory_relative_to_global_root;
|
||||
child->m_promises = m_promises;
|
||||
child->m_execpromises = m_execpromises;
|
||||
child->m_has_promises = m_has_promises;
|
||||
child->m_has_execpromises = m_has_execpromises;
|
||||
child->m_veil_state = m_veil_state;
|
||||
child->m_unveiled_paths = m_unveiled_paths.deep_copy();
|
||||
child->m_fds = m_fds;
|
||||
|
|
|
@ -84,7 +84,9 @@ int Process::sys$pledge(Userspace<const Syscall::SC_pledge_params*> user_params)
|
|||
return -EPERM;
|
||||
}
|
||||
|
||||
m_has_promises = true;
|
||||
m_has_promises = m_has_promises || !promises.is_null();
|
||||
m_has_execpromises = m_has_execpromises || !execpromises.is_null();
|
||||
|
||||
m_promises = new_promises;
|
||||
m_execpromises = new_execpromises;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue