Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Oct 2004 13:18:51 +0200 (CEST)
From:      Konrad Heuer <kheuer2@gwdg.de>
To:        Andriy Gapon <avg@icyb.net.ua>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: linux emulation: "/ " resolves to real root dir; why ?
Message-ID:  <20041022131342.W95775@gwdu60.gwdg.de>
In-Reply-To: <4178DBA0.8050605@icyb.net.ua>
References:  <4178DBA0.8050605@icyb.net.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

On Fri, 22 Oct 2004, Andriy Gapon wrote:

> Under Linux emulation "/"  resolves to real root directory, not
> /compat/linux directory and I am very curious why this is so.
>
> I see that in linux_emul_convpath() there is a special check for this
> case with the following comment:
>
> /*
>  * We now compare the vnode of the linux_root 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 :-(
>  */
>
>
> Because of such behavior "mkdir -p" (in linux base 7) is broken in cases
> where more than one path components needs to be created - mkdir first
> chdir()s to / and then iteratively mkdir()s and chdir()s to subdirectories.
>
> My rationale for throwing out that check is that no linux program should
> ever need to access real root directory, and in case of a user using an
> interactive linux shell he should be smart enough to break out of
> /compat/linux (very easy).
>
> I have already posted this question to freebsd-emulation list, but got
> no responses so far.

Linux binaries often need to access files outside the emulation directory
tree, just think of data files in the user's homes when running
applications like acroread, linux-mozilla, staroffice etc. So you
absolutely need to break out.

Regards

Konrad Heuer
GWDG, Am Fassberg, 37077 Goettingen, Germany, kheuer2@gwdg.de




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041022131342.W95775>