Allow to use kill(2) in capability mode, but process can send a signal only
to himself. For example abort(3) at first tries to do kill(getpid(), SIGABRT) which was failing in capability mode, so the code was failing back to exit(1). Reviewed by: rwatson Obtained from: WHEEL Systems MFC after: 2 weeks
This commit is contained in:
parent
b62d05fcf9
commit
8890f5d020
@ -336,6 +336,11 @@ issetugid
|
||||
##
|
||||
kevent
|
||||
|
||||
##
|
||||
## Allow kill(2), as we allow the process to send signals only to himself.
|
||||
##
|
||||
kill
|
||||
|
||||
##
|
||||
## Allow message queue operations on file descriptors, subject to capability
|
||||
## rights.
|
||||
|
@ -1679,6 +1679,14 @@ sys_kill(struct thread *td, struct kill_args *uap)
|
||||
struct proc *p;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* A process in capability mode can send signals only to himself.
|
||||
* The main rationale behind this is that abort(3) is implemented as
|
||||
* kill(getpid(), SIGABRT).
|
||||
*/
|
||||
if (IN_CAPABILITY_MODE(td) && uap->pid != td->td_proc->p_pid)
|
||||
return (ECAPMODE);
|
||||
|
||||
AUDIT_ARG_SIGNUM(uap->signum);
|
||||
AUDIT_ARG_PID(uap->pid);
|
||||
if ((u_int)uap->signum > _SIG_MAXSIG)
|
||||
|
Loading…
Reference in New Issue
Block a user