Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Mar 2010 14:30:03 GMT
From:      dfilter@FreeBSD.ORG (dfilter service)
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/141956: commit references a PR
Message-ID:  <201003011430.o21EU30V095183@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/141956; it has been noted by GNATS.

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/141956: commit references a PR
Date: Mon,  1 Mar 2010 14:27:30 +0000 (UTC)

 Author: bruno
 Date: Mon Mar  1 14:27:16 2010
 New Revision: 204519
 URL: http://svn.freebsd.org/changeset/base/204519
 
 Log:
   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
 
 Modified:
   head/sys/kern/kern_thr.c
 
 Modified: head/sys/kern/kern_thr.c
 ==============================================================================
 --- head/sys/kern/kern_thr.c	Mon Mar  1 13:56:15 2010	(r204518)
 +++ head/sys/kern/kern_thr.c	Mon Mar  1 14:27:16 2010	(r204519)
 @@ -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_k
  					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_k
  		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_
  
  	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_
  						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_
  			else if (!_SIG_VALID(uap->sig))
  				error = EINVAL;
  			else
 -				tdsignal(p, ttd, uap->sig, NULL);
 +				tdsignal(p, ttd, uap->sig, &ksi);
  		}
  	}
  	PROC_UNLOCK(p);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003011430.o21EU30V095183>