Bug 8132 - open("..",O_RDONLY|O_NONBLOCK) fails
Summary: open("..",O_RDONLY|O_NONBLOCK) fails
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1998-10-03 04:10 UTC by serge
Modified: 1998-10-16 21:11 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description serge 1998-10-03 04:10:00 UTC
looks like open() is checking permissions of the mount point rather then
permissions of the mounted filesystem.

Fix: 

rewrite kernel code

workaround:
as root:

$ umount /sd1;chmod 755 /sd1

one can use open() + fchdir() instead of getcwd(), but this is not a fix
anyway

the bug is present in all bsd 2.1.x and 2.2.x (including the latest STABLE)
How-To-Repeat: as root:
$ mkdir /sd1
$ chmod 700 /sd1
$ ls -lad /sd1
drwx------  2 root  wheel  512 Oct  2 19:39 /sd1
$ mount /dev/sd1a /sd1
OR
$ mount some_host:/exported_fs /sd1
$ ls -ld /sd1
drwxr-xr-x  46 1064  1685  1024 Jan 12  1998 /sd1

as a normal user:
$ cd /sd1
$ ls -la ..
ls: ..: Permission denied
$ cd ..
$ ls -la
total 2733
drwxr-xr-x  18 root  wheel       512  2 ÏËÔ 19:39 .
drwxr-xr-x  18 root  wheel       512  2 ÏËÔ 19:39 ..
-rw-r--r--   2 root  wheel       356 21 ÏËÔ  1997 .cshrc
[...]

as a result getwd() and getcwd() in /sd1 fails as they do
opendir() (which calls open()).
Comment 1 Steve Price freebsd_committer freebsd_triage 1998-10-03 23:56:04 UTC
Responsible Changed
From-To: gnats-admin->freebsd-bugs

Misfiled PR. 
Comment 2 dt freebsd_committer freebsd_triage 1998-10-16 21:09:46 UTC
State Changed
From-To: open->closed

Duplicate of kern/8180.