From owner-freebsd-stable Tue Oct 16 13:32:46 2001 Delivered-To: freebsd-stable@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id 1383A37B401; Tue, 16 Oct 2001 13:32:37 -0700 (PDT) Received: from fledge.watson.org (robert@fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.11.6/8.11.5) with SMTP id f9GKWSB18402; Tue, 16 Oct 2001 16:32:28 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Tue, 16 Oct 2001 16:32:27 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Bruce Evans Cc: current@freebsd.org, stable@freebsd.org, dillon@freebsd.org, alfred@freebsd.org Subject: Re: coredump() broken for nfs filesystems In-Reply-To: <20011015211333.B576-100000@delplex.bde.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG As I've mentioned before, the current credential-munging here is simply broken; however, the brokenness I previously observed is independent of the brokenness you are now reporting. Robert N M Watson FreeBSD Core Team, TrustedBSD Project robert@fledge.watson.org NAI Labs, Safeport Network Services On Mon, 15 Oct 2001, Bruce Evans wrote: > coredump() now usually creates empty core files for nfs filesystems. > This seems to be caused by the changes in rev.1.132 (-current) and > rev.1.72.2.9 (RELENG_4), and braindamage in nfs_dolock(): > > Index: kern_sig.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/kern_sig.c,v > retrieving revision 1.131 > retrieving revision 1.132 > diff -u -2 -r1.131 -r1.132 > --- kern_sig.c 6 Sep 2001 22:20:41 -0000 1.131 > +++ kern_sig.c 8 Sep 2001 20:02:32 -0000 1.132 > > ... > @@ -1896,6 +1898,17 @@ > NDFREE(&nd, NDF_ONLY_PNBUF); > vp = nd.ni_vp; > + > + VOP_UNLOCK(vp, 0, p); > + lf.l_whence = SEEK_SET; > + lf.l_start = 0; > + lf.l_len = 0; > + lf.l_type = F_WRLCK; > + error = VOP_ADVLOCK(vp, (caddr_t)p, F_SETLK, &lf, F_FLOCK); > + if (error) > + goto out2; > + > > This usually goes to out2 with error EOPNOTSUPP if the core file is on > an nfs filesystem. > > From nfs_dolock(): > > % /* > % * XXX Hack to temporarily allow this process (regardless of it's creds) > % * to open the fifo we need to write to. vn_open() really should > % * take a ucred (and once it does, this code should be fixed to use > % * proc0's ucred. > % */ > % saved_uid = p->p_ucred->cr_uid; > % p->p_ucred->cr_uid = 0; /* temporarly run the vn_open as root */ > % > % fmode = FFLAGS(O_WRONLY); > % error = vn_open(&nd, &fmode, 0); > > This vn_open() usually fails, because root is usually mapped so has even > less write permission than most users. I don't see how nfs write locks can > work for syscalls either. > > % p->p_ucred->cr_uid = saved_uid; > % if (error != 0) { > % return (error == ENOENT ? EOPNOTSUPP : error); > % } > > EOPNOTSUPP is a strange error for foot shooting. > > Bruce > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message