Subject: kern/35830: procfs "exe" symlinks do not work with nullfs
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <apb@cequrux.com>
List: netbsd-bugs
Date: 02/24/2007 19:00:00
>Number:         35830
>Category:       kern
>Synopsis:       procfs "exe" symlinks do not work with nullfs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 24 19:00:00 +0000 2007
>Originator:     Alan Barrett
>Release:        NetBSD 4.99.12
>Organization:
Not much
>Environment:
System: NetBSD 4.99.12
Architecture: i386
Machine: i386
>Description:
The "exe" symlinks in the procfs file system do not work properly
for nullfs file systems.  Instead of pointing to the executed
program, procfs dymlinks like /proc/curproc/exe point to "/".

The "cwd" symlinks, on the other hand, work correctly with nullfs.

>How-To-Repeat:

$ sudo mount -t null /bin /mnt
$ cd /mnt
$ /bin/ls -l /proc/curproc/cwd /proc/curproc/exe # works
lr-xr-xr-x  1 root  wheel  4 Feb 24 20:49 /proc/curproc/cwd -> /mnt
lr-xr-xr-x  1 root  wheel  7 Feb 24 20:49 /proc/curproc/exe -> /bin/ls
$ /mnt/ls -l /proc/curproc/cwd /proc/curproc/exe # cwd works, exe fails
lr-xr-xr-x  1 root  wheel  4 Feb 24 20:49 /proc/curproc/cwd -> /mnt
lr-xr-xr-x  1 root  wheel  1 Feb 24 20:49 /proc/curproc/exe -> /
$ ./ls -l /proc/curproc/cwd /proc/curproc/exe # cwd works, exe fails
lr-xr-xr-x  1 root  wheel  4 Feb 24 20:49 /proc/curproc/cwd -> /mnt
lr-xr-xr-x  1 root  wheel  1 Feb 24 20:49 /proc/curproc/exe -> /
$ cd /
$ sudo umount /mnt

>Fix:
Unknown