summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thr.c
diff options
context:
space:
mode:
authorbruno <bruno@FreeBSD.org>2010-03-01 14:27:16 +0000
committerbruno <bruno@FreeBSD.org>2010-03-01 14:27:16 +0000
commit3bef33deb1cdabea1b8761a141f28259edcd46bc (patch)
tree9a71e84dbc59dd159d6c73a620aa9bf5066f3c87 /sys/kern/kern_thr.c
parent8408b24980c2f66082549118c59ecb361c2af985 (diff)
downloadFreeBSD-src-3bef33deb1cdabea1b8761a141f28259edcd46bc.zip
FreeBSD-src-3bef33deb1cdabea1b8761a141f28259edcd46bc.tar.gz
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
Diffstat (limited to 'sys/kern/kern_thr.c')
-rw-r--r--sys/kern/kern_thr.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 3159a91..116e79b 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -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);
OpenPOWER on IntegriCloud