From nobody@FreeBSD.org  Sat Jun  3 04:17:37 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4621F16A420
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  3 Jun 2006 04:17:37 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0245A43D45
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  3 Jun 2006 04:17:37 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k534HaIS075984
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 3 Jun 2006 04:17:36 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k534HZEd075766;
	Sat, 3 Jun 2006 04:17:35 GMT
	(envelope-from nobody)
Message-Id: <200606030417.k534HZEd075766@www.freebsd.org>
Date: Sat, 3 Jun 2006 04:17:35 GMT
From: "A. Skrobov" <tyomitch@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: fts_read disregards permissions of mounted volume 
X-Send-Pr-Version: www-2.3

>Number:         98414
>Category:       kern
>Synopsis:       [libc] fts_read(3) disregards permissions of mounted volume
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    yar
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jun 03 04:20:28 GMT 2006
>Closed-Date:    Mon Nov 20 21:20:52 GMT 2006
>Last-Modified:  Mon Nov 20 21:20:52 GMT 2006
>Originator:     A. Skrobov
>Release:        5.4-RELEASE
>Organization:
>Environment:
FreeBSD tyomitch.isnet.ru 5.4-RELEASE FreeBSD 5.4-RELEASE #4: Mon Apr 10 11:28:57 YEKST 2006     tyomitch@tyomitch.isnet.ru:/usr/src/sys/i386/compile/NAT  i386
>Description:
fts_read seems to use the permissions of the mount-point dir, where all
other functions use the permissions of the mounted volume itself.

AFAICT, the permissions used by fts_read can't be displayed in any
documented way, which increases the confusion.

This issue is likely the cause of Problem Report "bin/33235" as well.
>How-To-Repeat:
-bash-2.05b$ sudo mkdir /mnt/TestPoint
-bash-2.05b$ sudo chmod 000 /mnt/TestPoint
-bash-2.05b$ ls -l /mnt
total 2
d---------  2 root  wheel  512 Jun  3 10:01 TestPoint
-bash-2.05b$ sudo mount /dev/ad2s2d /mnt/TestPoint
-bash-2.05b$ ls -l /mnt
total 2
drwxr-xr-x  3 root  wheel  512 Jun  1 19:29 TestPoint
-bash-2.05b$ ls -lR /mnt
total 2
drwxr-xr-x  3 root  wheel  512 Jun  1 19:29 TestPoint

/mnt/TestPoint:
total 0
ls: fts_read: Permission denied
-bash-2.05b$ ls -lR /mnt/TestPoint
total 12324160
-rw-r--r--  1 root  wheel  4418652160 May 31 17:54 <file names omitted>
-rw-r--r--  1 root  wheel  4439671513 Mar 18 01:52 <file names omitted>
-rw-r--r--  1 root  wheel  3755358680 May 31 19:57 <file names omitted>
-bash-2.05b$ sudo umount /dev/ad2s2d
-bash-2.05b$ sudo chmod 777 /mnt/TestPoint
-bash-2.05b$ ls -l /mnt
total 2
drwxrwxrwx  2 root  wheel  512 Jun  3 10:01 TestPoint
-bash-2.05b$ sudo mount /dev/ad2s2d /mnt/TestPoint
-bash-2.05b$ ls -l /mnt
total 2
drwxr-xr-x  3 root  wheel  512 Jun  1 19:29 TestPoint
-bash-2.05b$ ls -lR /mnt
total 2
drwxr-xr-x  3 root  wheel  512 Jun  1 19:29 TestPoint

/mnt/TestPoint:
total 12324160
-rw-r--r--  1 root  wheel  4418652160 May 31 17:54 <file names omitted>
-rw-r--r--  1 root  wheel  4439671513 Mar 18 01:52 <file names omitted>
-rw-r--r--  1 root  wheel  3755358680 May 31 19:57 <file names omitted>

>Fix:

>Release-Note:
>Audit-Trail:

From: Yar Tikhiy <yar@comp.chem.msu.su>
To: bug-followup@FreeBSD.org, tyomitch@gmail.com
Cc:  
Subject: Re: kern/98414: [libc] fts_read(3) disregards permissions of mounted volume
Date: Mon, 16 Oct 2006 13:59:23 +0400

 I think that this problem is closely related to the fact that the
 permissions on the original mountpoint directory affect the ability
 of a process to access ".." from the mounted filesystem root.  See
 CAVEATS in mount(8) for details.  AFAIK fts(3) uses chdir("..")
 when traversing a directory tree unless FTS_NOCHDIR was specified
 to fts_open(3).  FTS_NOCHDIR is usually no good because it limits
 the depth of the tree fts(3) is able to traverse to PATH_MAX.
 
 Would you agree now that there is no bug to fix and so this PR can
 be closed?
 
 -- 
 Yar
State-Changed-From-To: open->feedback 
State-Changed-By: yar 
State-Changed-When: Mon Oct 16 10:00:46 UTC 2006 
State-Changed-Why:  
This is a known fact documented in mount(8). 


Responsible-Changed-From-To: freebsd-bugs->yar 
Responsible-Changed-By: yar 
Responsible-Changed-When: Mon Oct 16 10:00:46 UTC 2006 
Responsible-Changed-Why:  
I hope I can handle this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98414 
State-Changed-From-To: feedback->closed 
State-Changed-By: yar 
State-Changed-When: Mon Nov 20 21:19:54 UTC 2006 
State-Changed-Why:  
Originator timeout. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98414 
>Unformatted:
