From serge@serge.yahoo.com  Tue Oct  6 19:18:00 1998
Received: from mail-relay2.yahoo.com (mr1.yahoo.com [206.251.17.77])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA03397
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 6 Oct 1998 19:17:56 -0700 (PDT)
          (envelope-from serge@serge.yahoo.com)
Received: from borogove.yahoo.com (borogove.yahoo.com [205.216.162.65])
	by mail-relay2.yahoo.com (8.9.1a/8.8.8) with ESMTP id TAA03750;
	Tue, 6 Oct 1998 19:17:44 -0700 (PDT)
Received: from serge.yahoo.com (serge.yahoo.com [205.216.162.201])
	by borogove.yahoo.com (8.8.7/8.8.8) with ESMTP id TAA17062;
	Tue, 6 Oct 1998 19:17:37 -0700 (PDT)
Received: (from serge@localhost)
	by serge.yahoo.com (8.8.8/8.8.7) id TAA12930;
	Tue, 6 Oct 1998 19:17:36 -0700 (PDT)
	(envelope-from serge)
Message-Id: <199810070217.TAA12930@serge.yahoo.com>
Date: Tue, 6 Oct 1998 19:17:36 -0700 (PDT)
From: serge@yahoo-inc.com
Reply-To: serge@yahoo-inc.com
To: FreeBSD-gnats-submit@freebsd.org
Cc: serge@yahoo-inc.com
Subject: open("..",O_RDONLY|O_NONBLOCK) fails
X-Send-Pr-Version: 3.2

>Number:         8180
>Category:       kern
>Synopsis:       open("..",O_RDONLY|O_NONBLOCK) fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct  6 19:20:00 PDT 1998
>Closed-Date:    Thu Jul 19 13:33:31 PDT 2001
>Last-Modified:  Thu Jul 19 13:35:01 PDT 2001
>Originator:     Sergiy Zhuk
>Release:        FreeBSD 2.2.7-STABLE i386
>Organization:
>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
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: mike 
State-Changed-When: Thu Jul 19 13:20:59 PDT 2001 
State-Changed-Why:  

Does this problem still occur in newer versions of FreeBSD, 
such as 4.3-RELEASE? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=8180 
State-Changed-From-To: feedback->closed 
State-Changed-By: mike 
State-Changed-When: Thu Jul 19 13:33:31 PDT 2001 
State-Changed-Why:  

Originator confirmed, in a private e-mail to me, that this problem 
was fixed in FreeBSD 3.x. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=8180 
>Unformatted:
