Subject: Re: kern/36227: new emul namei problem with symlinks
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 04/27/2007 07:25:02
The following reply was made to PR kern/36227; it has been noted by GNATS.
From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/36227: new emul namei problem with symlinks
Date: Fri, 27 Apr 2007 08:26:14 +0100
On Fri, Apr 27, 2007 at 01:45:00AM +0000, Mark Davies wrote:
> >Number: 36227
> >Category: kern
> >Synopsis: new emul namei problem with symlinks
>
>
> >Description:
> The new namei handling of emul paths fails to handle symlinks pointing
> out of the /emul tree correctly.
> This was first noticed while testing the fix for PR 36196 but really
> has nothing to do with that PR so I'm opening a new one to track it.
>
> >How-To-Repeat:
> # echo "hello" > /tmp/test
> # ln -s /tmp/test /emul/linux/etc/foo
> # /emul/linux/bin/cat /etc/foo
> /emul/linux/bin/cat: /etc/foo: No such file or directory
Unfortunately there are two different place such a symlink might
need to reference. If, as I did, you mount an existing netbsd i386
install onto /emul/netbsd32 of an amd64 system, then you want absolute
symbolic links found inside the emulation root to stay inside the root.
Otherwise you fall foul when /usr/libexec/ld.elf_so is a symlink to
/libexec/ld.elf_so (and similarly with links from /usr/lib/foo to /lib/foo).
So I made it such that absolute symlinks stay inside the emulation root
(when found with an absolute pathname) unless the name is "/../foo".
(So you may also want to make /emul/linux/etc/mtab a link to /../proc/mounts)
David
--
David Laight: david@l8s.co.uk