NFS and setuid programs fails on 2.1

Kees Bakker (kees_bakker@tasking.nl)
Wed, 12 Aug 1998 14:07:43 +0200


Hi,

The 2.1 kernel has a problem with setuid programs that try to write a file
on NFS mounted fs. It has nothing to do with root access to NFS fs. It's
really a bug and it has been introduced in the 2.1 kernel.

If I am correct both Alan C. and Bill H. are keeping an eye on NFS related
issues. Perhaps they know what to do.

Here is a shell script to quickly show the effect. You need a NFS mounted
filesystem (for example /mnt/kernel). It doesn't matter if you use
localhost as the server. The script uses 'su' as the setuid program. First a
file gets opened by yourself, and then (in this case 'date') writes into
the file as a different user. Normal UNIX behaviour allows this, and it
works on 2.0.x kernels, as well as other unices. It also works fine if you
write a non-NFS file.

#!/bin/sh
#
file1=${1-/mnt/kernel/temp}
user=hanneke

# Now execute a suid program by some other user.
su $user -c date > $file1

ls -l $file1
ls -l $file1
ls -l $file1
ls -l $file1
sleep 4
ls -l $file1

# Cleanup afterwards
rm -f $file1

Note that recently a change was made in sunrpc (2.1.88) to fix another
problem in this area. However the above problem still exists.

-- 
---------------------------------------------------------------------- 
telephone:  +31 33 455 85 84                Tasking Software BV
fax:        +31 33 455 10 05                P.O. Box 899
email:      kees_bakker@tasking.com         3800 AW  Amersfoort
WWW:        http://www.tasking.com          The Netherlands
----------------------------------------------------------------------
     -----  Quality Development Tools Worldwide  -----
            -----------------------------------
A mind is a terrible thing to ugg.. I forgot...

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html