Deliver siginfo when signal is generated by thr_kill(2) (SI_USER with properly

filled si_uid and si_pid).

Reported by:	Joel Bertrand <joel.bertrand systella fr>
PR:		141956
Reviewed by:	kib
MFC after:	2 weeks
This commit is contained in:
Bruno Ducrot 2010-03-01 14:27:16 +00:00
parent 977cb83962
commit 5f73a7eb08

View File

@ -303,12 +303,18 @@ int
thr_kill(struct thread *td, struct thr_kill_args *uap)
/* long id, int sig */
{
ksiginfo_t ksi;
struct thread *ttd;
struct proc *p;
int error;
p = td->td_proc;
error = 0;
ksiginfo_init(&ksi);
ksi.ksi_signo = uap->sig;
ksi.ksi_code = SI_USER;
ksi.ksi_pid = p->p_pid;
ksi.ksi_uid = td->td_ucred->cr_ruid;
PROC_LOCK(p);
if (uap->id == -1) {
if (uap->sig != 0 && !_SIG_VALID(uap->sig)) {
@ -320,7 +326,7 @@ thr_kill(struct thread *td, struct thr_kill_args *uap)
error = 0;
if (uap->sig == 0)
break;
tdsignal(p, ttd, uap->sig, NULL);
tdsignal(p, ttd, uap->sig, &ksi);
}
}
}
@ -336,7 +342,7 @@ thr_kill(struct thread *td, struct thr_kill_args *uap)
else if (!_SIG_VALID(uap->sig))
error = EINVAL;
else
tdsignal(p, ttd, uap->sig, NULL);
tdsignal(p, ttd, uap->sig, &ksi);
}
PROC_UNLOCK(p);
return (error);
@ -346,6 +352,7 @@ int
thr_kill2(struct thread *td, struct thr_kill2_args *uap)
/* pid_t pid, long id, int sig */
{
ksiginfo_t ksi;
struct thread *ttd;
struct proc *p;
int error;
@ -362,6 +369,11 @@ thr_kill2(struct thread *td, struct thr_kill2_args *uap)
error = p_cansignal(td, p, uap->sig);
if (error == 0) {
ksiginfo_init(&ksi);
ksi.ksi_signo = uap->sig;
ksi.ksi_code = SI_USER;
ksi.ksi_pid = td->td_proc->p_pid;
ksi.ksi_uid = td->td_ucred->cr_ruid;
if (uap->id == -1) {
if (uap->sig != 0 && !_SIG_VALID(uap->sig)) {
error = EINVAL;
@ -372,7 +384,8 @@ thr_kill2(struct thread *td, struct thr_kill2_args *uap)
error = 0;
if (uap->sig == 0)
break;
tdsignal(p, ttd, uap->sig, NULL);
tdsignal(p, ttd, uap->sig,
&ksi);
}
}
}
@ -388,7 +401,7 @@ thr_kill2(struct thread *td, struct thr_kill2_args *uap)
else if (!_SIG_VALID(uap->sig))
error = EINVAL;
else
tdsignal(p, ttd, uap->sig, NULL);
tdsignal(p, ttd, uap->sig, &ksi);
}
}
PROC_UNLOCK(p);