From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 12:41:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1B804106564A; Thu, 14 Jun 2012 12:41:22 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 06CB38FC14; Thu, 14 Jun 2012 12:41:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ECfLWx094754; Thu, 14 Jun 2012 12:41:21 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ECfL3g094752; Thu, 14 Jun 2012 12:41:21 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141241.q5ECfL3g094752@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 12:41:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237065 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 12:41:22 -0000 Author: pjd Date: Thu Jun 14 12:41:21 2012 New Revision: 237065 URL: http://svn.freebsd.org/changeset/base/237065 Log: When we are closing capabilities during exec, we want to call mq_fdclose() on the underlying object and not on the capability itself. Similar bug was fixed in r236853. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 12:38:51 2012 (r237064) +++ head/sys/kern/kern_descrip.c Thu Jun 14 12:41:21 2012 (r237065) @@ -2025,7 +2025,7 @@ void fdcloseexec(struct thread *td) { struct filedesc *fdp; - struct file *fp; + struct file *fp, *fp_object; int i; /* Certain daemons might not have file descriptors. */ @@ -2050,8 +2050,14 @@ fdcloseexec(struct thread *td) fdp->fd_ofileflags[i] = 0; fdunused(fdp, i); knote_fdclose(td, i); - if (fp->f_type == DTYPE_MQUEUE) - mq_fdclose(td, i, fp); + /* + * When we're closing an fd with a capability, we need + * to notify mqueue if the underlying object is of type + * mqueue. + */ + (void)cap_funwrap(fp, 0, &fp_object); + if (fp_object->f_type == DTYPE_MQUEUE) + mq_fdclose(td, i, fp_object); FILEDESC_XUNLOCK(fdp); (void) closef(fp, td); FILEDESC_XLOCK(fdp);