NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/42130: NFS: open(...O_CREAT...) fails, yet file is created



>Number:         42130
>Category:       kern
>Synopsis:       NFS: open(...O_CREAT...) fails, yet file is created
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 26 16:55:00 +0000 2009
>Originator:     Edgar Fuß
>Release:        4.0
>Organization:
Mathematisches Institut der Uni Bonn
>Environment:
NetBSD xxx 4.0_STABLE NetBSD 4.0_STABLE (xxx) #x: xxx amd64
>Description:
There is at least one situation where an open(...O_CREAT...) fails, yet the 
file in question is created:

1. The file is on NFS
2. flags include O_EXCL
3. mode includes S_ISGID
4. the parent directory belongs to a group the user is not a member of

This happens with both NetBSD and Linux NFS clients (they differ in errno, 
being EPERM on NetBSD and EIO on Linux).

I suspect this is a consequence of the open(2) being split into multiple NFS 
RPCs, some of which succeed and some of which fail.

On a local fs, the open() just fails without the file being created.

I'm not sure what POSIX says about this situation; the current behaviour is 
somewhat surprising to me.
>How-To-Repeat:
On an NFS file system:

mkdir(1) a directory
chown(1) the directory to user:group where user is NOT a member of group
as user, inside the directory, execute an open(2) with flags O_CREAT|O_EXCL and 
mode S_ISGID   
>Fix:



Home | Main Index | Thread Index | Old Index