mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
Kernel: Allow sending SIGCONT
to processes in the same group
Allow sending `SIGCONT` to processes that share the same `pgid`. This is allowed in Linux aswell. Also fixes a FIXME :^)
This commit is contained in:
parent
9ca979846c
commit
fb2be937ac
|
@ -11,11 +11,15 @@ namespace Kernel {
|
|||
|
||||
ErrorOr<void> Process::do_kill(Process& process, int signal)
|
||||
{
|
||||
// FIXME: Allow sending SIGCONT to everyone in the process group.
|
||||
// FIXME: Should setuid processes have some special treatment here?
|
||||
auto credentials = this->credentials();
|
||||
auto kill_process_credentials = process.credentials();
|
||||
if (!credentials->is_superuser() && credentials->euid() != kill_process_credentials->uid() && credentials->uid() != kill_process_credentials->uid())
|
||||
|
||||
bool can_send_signal = credentials->is_superuser()
|
||||
|| credentials->euid() == kill_process_credentials->uid()
|
||||
|| credentials->uid() == kill_process_credentials->uid()
|
||||
|| (signal == SIGCONT && credentials->pgid() == kill_process_credentials->pgid());
|
||||
if (!can_send_signal)
|
||||
return EPERM;
|
||||
if (process.is_kernel_process()) {
|
||||
dbgln("Attempted to send signal {} to kernel process {} ({})", signal, process.name(), process.pid());
|
||||
|
|
Loading…
Reference in a new issue