2.1.92: NFS Patch

Steve Dunham (dunham@cps.msu.edu)
03 Apr 1998 14:52:38 -0500


Below is a patch for the NFS client in the 2.1.92 kernel.

The problem was that setuid processes couldn't read files belonging to
the original user when the file resided on a root_squashed NFS mounted
partition.

The kernel contained a workaround for this, but it checked for the
NFSERR_PERM error from the NFS server and both the Solaris 2.5.1 and
the Linux userspace NFS server return NFSERR_ACCES in these cases. I
haven't checked what the 2.1.x kernel nfs server returns.

This problem causes xterm to break when nfs mounted home directories
are used.

My fix is to have the code check for either NFSERR_PERM or NFSERR_ACCES.
I'm not sure if checking for NFSERR_PERM is necessary or not, so I
left it in.

I don't know who is handling the NFS code right now, so I'm posting
the patch here. I'd appreciate it if they let me know that they got
the patch.

Thanks,
Steve
dunham@cps.msu.edu

--- linux/net/sunrpc/clnt.c.orig Fri Apr 3 09:13:07 1998
+++ linux/net/sunrpc/clnt.c Fri Apr 3 09:13:54 1998
@@ -637,7 +637,8 @@
* The following is an NFS-specific hack to cater for setuid
* processes whose uid is mapped to nobody on the server.
*/
- if (task->tk_client->cl_prog == 100003 && ntohl(*p) == NFSERR_PERM) {
+ if (task->tk_client->cl_prog == 100003 && (ntohl(*p) == NFSERR_PERM
+ || ntohl(*p) == NFSERR_ACCES)) {
if (RPC_IS_SETUID(task) && (task->tk_suid_retry)--) {
dprintk("RPC: %4d retry squashed uid\n", task->tk_pid);
task->tk_flags ^= RPC_CALL_REALUID;

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