Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Oct 1998 19:17:36 -0700 (PDT)
From:      serge@yahoo-inc.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Cc:        serge@yahoo-inc.com
Subject:   kern/8180: open("..",O_RDONLY|O_NONBLOCK) fails
Message-ID:  <199810070217.TAA12930@serge.yahoo.com>

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

>Number:         8180
>Category:       kern
>Synopsis:       open("..",O_RDONLY|O_NONBLOCK) fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct  6 19:20:00 PDT 1998
>Last-Modified:
>Originator:     Sergiy Zhuk
>Organization:
>Release:        FreeBSD 2.2.7-STABLE i386
>Environment:
the bug is present in all bsd 2.1.x and 2.2.x (including the latest STABLE)

>Description:
looks like open() is checking permissions of the mount point rather then
permissions of the mounted filesystem.

>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()).

>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
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



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