Bug 135160

Summary: 100.chksetuid and non local filesystem mounted on subdirs
Product: Base System Reporter: Roberto Grassi <r.grassi-at-obicon.it>
Component: confAssignee: Brian Somers <brian>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 7.2-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Roberto Grassi freebsd_committer freebsd_triage 2009-06-01 18:20:04 UTC
The find options in the 100.chksetuid script will traverse mount points found as local (ufs or zfs) but the test if they are local is done on the mount point itself, no further checks are done for non local file system file below them.
In the case a mount point is a subdir of a local mount point, the find will traverse it, causing the traverse go to other machine.
Example:
with this mount command output :
   /dev/da0d on /usr
   10.10.10.10:/usr/ports on /usr/ports
   10.10.10.11:/usr/src on /usr/src
the command inside 100.chksetuid 
   find -sx $MP /dev/null -type f \
     \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
     ...
will go on 10.10.10.10 and 10.10.10.11 server.

Moreover, in the case the NFS, SMBFS or other non local FS server did not respond all the periodic checks will not finish.

How-To-Repeat: use mountpoints for non local FS in subdirectory of /.
Comment 1 Brian Somers freebsd_committer freebsd_triage 2009-06-02 07:44:32 UTC
Responsible Changed
From-To: freebsd-bugs->brian

I'll take this - it's probably a similar problem to pr 122811
Comment 2 Brian Somers freebsd_committer freebsd_triage 2009-06-02 09:38:20 UTC
State Changed
From-To: open->feedback

Can the submitter re-check to see if this is indeed the case? 

# find -sx /usr /dev/null -type f | wc -l 
# umount /usr/ports /usr/src 
# find -sx /usr /dev/null -type f | wc -l 

On my 7.2 system this returns the same number.  The -x switch 
avoids the mountpoint traversal (as advertised). 

Does the above return two different numbers on your system?
Comment 3 Roberto Grassi 2009-06-05 13:39:58 UTC
I done the tests and I will change the problem description as follows:

------- here the required tests output -------
ux-hylafax <<root>> 101 ~ >mount -t nfs 172.27.9.8:/usr/src /usr/src
ux-hylafax <<root>> 102 ~ >mount -t nfs 172.27.9.8:/usr/obj /usr/obj
ux-hylafax <<root>> 103 ~ >find -sx /usr /dev/null -type f | wc -l
   26400
ux-hylafax <<root>> 104 ~ >umount /usr/src
ux-hylafax <<root>> 105 ~ >umount /usr/obj
ux-hylafax <<root>> 106 ~ >find -sx /usr /dev/null -type f | wc -l
   26400
ux-hylafax <<root>> 107 ~ >mount -t nfs 172.27.9.8:/usr/src /usr/src
ux-hylafax <<root>> 108 ~ >mount -t nfs 172.27.9.8:/usr/obj /usr/obj
ux-hylafax <<root>> 109 ~ >cd /usr/src
ux-hylafax <<root>> 110 /usr/src >find . -type f | wc -l
   39532
ux-hylafax <<root>> 111 /usr/src >
ux-hylafax <<root>> 111 /usr/src >mount
/dev/da0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/da0s1d on /usr (ufs, local, soft-updates)
/dev/da0s1f on /var (ufs, local, soft-updates)
172.27.9.8:/usr/src on /usr/src (nfs)
172.27.9.8:/usr/obj on /usr/obj (nfs)
ux-hylafax <<root>> 112 /usr/src >cd
ux-hylafax <<root>> 113 ~ >ping 172.27.9.8
PING 172.27.9.8 (172.27.9.8): 56 data bytes
^C
--- 172.27.9.8 ping statistics ---
3 packets transmitted, 0 packets received, 100.0% packet loss
ux-hylafax <<root>> 114 ~ >find -sx /usr /dev/null -type f | wc -l
nfs server 172.27.9.8:/usr/obj: not responding
^C^C^C^C^Cnfs server 172.27.9.8:/usr/obj: not responding
nfs server 172.27.9.8:/usr/obj: not responding
^Cnfs server 172.27.9.8:/usr/obj: not responding

*** FINAL System shutdown message from root@ux-hylafax ***
System going down IMMEDIATELY

------------- end of output transcript ---------

As you stated the command "find -sx /usr /dev/null -type f | wc -l" returne=
d=20
the same result with mounted and unmounted NFS file systems.

Now, if the NFS server give up (in the transcript the command #113 was run=
=20
after the shutdown of the 172.27.9.8 server), the find command will stale.

Even if I user the  "\( -fstype ufs -or -fstype zfs \)" the command will=20
stale.
In both cases I tried to kill the PID of the find commands with every signa=
l=20
(from 0 to 31), but  no one was successful in killing the process.

The only option to stop the find is to reboot the server or to wait the NFS=
=20
server come back on line (in case of hw failure can be a problem as=20
happened)

Maybe, the PR as to be change to other category.
Comment 4 Brian Somers freebsd_committer freebsd_triage 2009-06-08 11:39:50 UTC
State Changed
From-To: feedback->closed

The investigation went something like this: 

> On Fri, 5 Jun 2009 08:06:08 -0700 Brian Somers <brian@FreeBSD.org> wrote:   
[.....]