From owner-freebsd-emulation@FreeBSD.ORG Sat Feb 23 07:50:03 2008 Return-Path: Delivered-To: freebsd-emulation@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0894116A401 for ; Sat, 23 Feb 2008 07:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E043B13C448 for ; Sat, 23 Feb 2008 07:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m1N7o2vG066698 for ; Sat, 23 Feb 2008 07:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m1N7o2qv066693; Sat, 23 Feb 2008 07:50:02 GMT (envelope-from gnats) Date: Sat, 23 Feb 2008 07:50:02 GMT Message-Id: <200802230750.m1N7o2qv066693@freefall.freebsd.org> To: freebsd-emulation@FreeBSD.org From: Andriy Gapon Cc: Subject: Re: kern/73777: [linux] [patch] linux emulation: root dir special handling useless and harmful X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Andriy Gapon List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Feb 2008 07:50:03 -0000 The following reply was made to PR kern/73777; it has been noted by GNATS. From: Andriy Gapon To: bug-followup@FreeBSD.org Cc: Subject: Re: kern/73777: [linux] [patch] linux emulation: root dir special handling useless and harmful Date: Sat, 23 Feb 2008 09:46:53 +0200 This is a multi-part message in MIME format. --------------080104050205040809080106 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Well, I think that the issue described in this PR still holds. On the other hand, I now think that some people might still prefer current behavior over what I suggest. There could be some POLA concerns too. Another concern is that now the code is common to all emulation, so it's not linux specific anymore. In any case, I am attaching a patch that I currently use. -- Andriy Gapon --------------080104050205040809080106 Content-Type: text/x-patch; name="rootdir-6.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="rootdir-6.patch" --- sys/kern/vfs_lookup.c.orig Fri May 12 16:03:41 2006 +++ sys/kern/vfs_lookup.c Fri May 12 16:09:31 2006 @@ -955,7 +955,7 @@ kern_alternate_path(struct thread *td, const char *prefix, char *path, enum uio_seg pathseg, char **pathbuf, int create) { - struct nameidata nd, ndroot; + struct nameidata nd; char *ptr, *buf, *cp; size_t len, sz; int error; @@ -1014,28 +1014,6 @@ error = namei(&nd); if (error != 0) goto keeporig; - - /* - * We now compare the vnode of the prefix to the one - * vnode asked. If they resolve to be the same, then we - * ignore the match so that the real root gets used. - * This avoids the problem of traversing "../.." to find the - * root directory and never finding it, because "/" resolves - * to the emulation root directory. This is expensive :-( - */ - NDINIT(&ndroot, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, prefix, - td); - - /* We shouldn't ever get an error from this namei(). */ - error = namei(&ndroot); - if (error == 0) { - if (nd.ni_vp == ndroot.ni_vp) - error = ENOENT; - - NDFREE(&ndroot, NDF_ONLY_PNBUF); - vrele(ndroot.ni_vp); - VFS_UNLOCK_GIANT(NDHASGIANT(&ndroot)); - } } NDFREE(&nd, NDF_ONLY_PNBUF); --------------080104050205040809080106--