From owner-svn-src-head@FreeBSD.ORG Tue Feb 24 13:07:32 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 91D437D4; Tue, 24 Feb 2015 13:07:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D501667; Tue, 24 Feb 2015 13:07:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1OD7Wda002297; Tue, 24 Feb 2015 13:07:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1OD7WhZ002296; Tue, 24 Feb 2015 13:07:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201502241307.t1OD7WhZ002296@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Feb 2015 13:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279237 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Feb 2015 13:07:32 -0000 Author: kib Date: Tue Feb 24 13:07:31 2015 New Revision: 279237 URL: https://svnweb.freebsd.org/changeset/base/279237 Log: Keep a reference on the coredump vnode for vn_fullpath() call. Do it by moving vn_close() after the point where notification is sent. Reported by: sbruno Tested by: pho, sbruno Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Feb 24 12:57:03 2015 (r279236) +++ head/sys/kern/kern_sig.c Tue Feb 24 13:07:31 2015 (r279237) @@ -3310,7 +3310,7 @@ coredump(struct thread *td) vattr.va_nlink != 1 || (vp->v_vflag & VV_SYSTEM) != 0) { VOP_UNLOCK(vp, 0); error = EFAULT; - goto close; + goto out; } VOP_UNLOCK(vp, 0); @@ -3347,17 +3347,12 @@ coredump(struct thread *td) VOP_ADVLOCK(vp, (caddr_t)p, F_UNLCK, &lf, F_FLOCK); } vn_rangelock_unlock(vp, rl_cookie); -close: - error1 = vn_close(vp, FWRITE, cred, td); - if (error == 0) - error = error1; - else - goto out; + /* * Notify the userland helper that a process triggered a core dump. * This allows the helper to run an automated debugging session. */ - if (coredump_devctl == 0) + if (error != 0 || coredump_devctl == 0) goto out; len = MAXPATHLEN * 2 + sizeof(comm_name) - 1 + sizeof(' ') + sizeof(core_name) - 1; @@ -3377,6 +3372,9 @@ close: strlcat(data, fullpath, len); devctl_notify("kernel", "signal", "coredump", data); out: + error1 = vn_close(vp, FWRITE, cred, td); + if (error == 0) + error = error1; #ifdef AUDIT audit_proc_coredump(td, name, error); #endif