2.1.91/NFS: problem with setuid programs

Dick Streefland (dick_streefland@tasking.com)
Mon, 30 Mar 1998 11:34:18 +0200


Hi,

There seems to be a problem with the permission checking in the new
NFS client code. The problem is that when the output of a setuid
program is redirected to a file on an NFS partition, the output file
becomes corrupt. I first noticed this when I redirected the stderr of
the X server to a file on NFS. I got "NFS: inode ... had .. failed
requests" messages, and the output file was partially filled with null
bytes. The following shell script demonstrates the problem:

------------------------------------------------------------
#!/bin/sh

nfsfile=/mnt/temp # some file on NFS
user=dick

cp /bin/ls /tmp/ls
chmod u+s /tmp/ls
su $user -c "/tmp/ls / > $nfsfile"
ls -l $nfsfile
sleep 4
ls -l $nfsfile
rm /tmp/ls $nfsfile
------------------------------------------------------------

The output from this script is:

------------------------------------------------------------
/tmp/ls: write error: Permission denied
-rw-r--r-- 1 dick system 146 Mar 29 23:17 /mnt/temp
-rw-r--r-- 1 dick system 0 Mar 29 23:17 /mnt/temp
------------------------------------------------------------

I suspect that the problem is that the file persmissions are checked
for every I/O operation, while it should be sufficient to have access
permission at the open() call.

-- 
Dick Streefland                      ////            Tasking Software BV
dick_streefland@tasking.com         (@ @)         http://www.tasking.com
--------------------------------oOO--(_)--OOo---------------------------

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu