From serge@serge.yahoo.com  Fri Oct  2 20:02:30 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 UAA16508
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 2 Oct 1998 20:02:29 -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 UAA28040;
	Fri, 2 Oct 1998 20:02:10 -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 UAA05261;
	Fri, 2 Oct 1998 20:02:02 -0700 (PDT)
Received: (from serge@localhost)
	by serge.yahoo.com (8.8.8/8.8.7) id UAA11598;
	Fri, 2 Oct 1998 20:01:05 -0700 (PDT)
	(envelope-from serge)
Message-Id: <199810030301.UAA11598@serge.yahoo.com>
Date: Fri, 2 Oct 1998 20:01:05 -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:         8132
>Category:       misc
>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:   Fri Oct  2 20:10:00 PDT 1998
>Closed-Date:    Fri Oct 16 13:09:46 PDT 1998
>Last-Modified:  Fri Oct 16 13:11:23 PDT 1998
>Originator:     
>Release:        
>Organization:
>Environment:
>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

the bug is present in all bsd 2.1.x and 2.2.x (including the latest STABLE)

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: steve 
Responsible-Changed-When: Sat Oct 3 15:56:04 PDT 1998 
Responsible-Changed-Why:  
Misfiled PR. 
State-Changed-From-To: open->closed 
State-Changed-By: dt 
State-Changed-When: Fri Oct 16 13:09:46 PDT 1998 
State-Changed-Why:  
Duplicate of kern/8180. 
>Unformatted:
 
