kern/68905: core dumps are assigned wrong ownership

Antoine Brodin antoine at FreeBSD.org
Sat Feb 16 14:20:02 UTC 2008


The following reply was made to PR kern/68905; it has been noted by GNATS.

From: Antoine Brodin <antoine at FreeBSD.org>
To: bug-followup at FreeBSD.org, trew at hick.org
Cc:  
Subject: Re: kern/68905: core dumps are assigned wrong ownership
Date: Sat, 16 Feb 2008 14:44:19 +0100

 This is a multi-part message in MIME format.
 
 --Multipart=_Sat__16_Feb_2008_14_44_19_+0100_qDxOlQLAvZKL=+NR
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 
 Here is a patch, not much tested and obtained from OpenBSD.
 
 --Multipart=_Sat__16_Feb_2008_14_44_19_+0100_qDxOlQLAvZKL=+NR
 Content-Type: text/x-diff;
  name="kern-sig.diff"
 Content-Disposition: attachment;
  filename="kern-sig.diff"
 Content-Transfer-Encoding: 7bit
 
 Index: kern_sig.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/kern/kern_sig.c,v
 retrieving revision 1.355
 diff -u -p -r1.355 kern_sig.c
 --- kern_sig.c	13 Jan 2008 14:44:09 -0000	1.355
 +++ kern_sig.c	14 Jan 2008 13:32:06 -0000
 @@ -3110,9 +3110,14 @@ restart:
  	NDFREE(&nd, NDF_ONLY_PNBUF);
  	vp = nd.ni_vp;
  
 -	/* Don't dump to non-regular files or files with links. */
 +	/*
 +	 * Don't dump to non-regular files, files with links or files
 +	 * owned by someone else.
 +	 */
  	if (vp->v_type != VREG ||
 -	    VOP_GETATTR(vp, &vattr, cred, td) || vattr.va_nlink != 1) {
 +	    VOP_GETATTR(vp, &vattr, cred, td) || vattr.va_nlink != 1 ||
 +	    vattr.va_mode & (S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) ||
 +	    vattr.va_uid != cred->cr_uid) {
  		VOP_UNLOCK(vp, 0);
  		error = EFAULT;
  		goto close;
 
 
 --Multipart=_Sat__16_Feb_2008_14_44_19_+0100_qDxOlQLAvZKL=+NR--


More information about the freebsd-bugs mailing list