linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] NFSv4 callback pg_authenticate fix
@ 2010-11-17  3:36 andros
  2010-11-17  3:36 ` [PATCH 1/3] NFS add minorversion to nfs_find_client search andros
  2010-11-17 22:49 ` [PATCH 0/3] NFSv4 callback pg_authenticate fix J. Bruce Fields
  0 siblings, 2 replies; 13+ messages in thread
From: andros @ 2010-11-17  3:36 UTC (permalink / raw)
  To: benny; +Cc: linux-nfs

The back channel server svc_process_common RPC layer pg_authenticate call
[nfs_callback_authenticate] is shared by both the NFSv4.0 and the NFSv4.1
callback threads. It authenticates the incoming request by finding (and
referencing) an nfs_client struct based on the incoming request address
and the NFS version (4). This is akin to the NFS server which authenticates
requests by matching the server address to the exports file client list.

Since there is no minorversion in the search, it may find the wrong
nfs_client struct. For the nfsv4.0 callback service thread, this means it
could find an NFSv4.1 nfs_client. For the NFSv4.1 callback service thread, it
could find an NFSv4.0 instead of v4.1, or find an NFSv4.1 nfs_client with the
wrong session.

The nfs_client is dereferenced at the end of pg_authenticate. Another
nfs_find_client call is done in the per operation  dispatcher routines
for NFSv4.0 and in the cb_sequence operation dispatcher routine for NFSv4.1
after decoding.

This means the callback server could start processing a callback, passing
the pg_authenticate test, and have the nfs_client struct freed between the
pg_authenticate call and the dispatcher operation call. Or, it could have
found the wrong nfs_client in the pg_authenticate call.

The current code has this behaviour: If the nfs_client is not found in
pg_authenticate, the request is simply dropped (SVC_DROP). If an nfs_client
is not found in the dispatcher routines NFS4ERR_BADSESSION is returned for
v4.1 requests and NFS4ERR_BADHANDLE for v4.0 requests.

The first patch fixes some of these issues. It adds a minorversion to the
nfs_find_client routine which means that the NFSv4.0 back channel service always
finds the correct nfs_client struct. The NFSv4.1 back channel service requires
the sessionid from the CB_SEQUENCE operation to guarantee that the correct
nfs_client struct is being used.

The minorversion is assigned by checking for the existance of the
bc_xprt field in the svc_rqst. This method of determining minorversion will
work until we support stand alone back channels for NFSv4.1.

The SVC_DROP return in pg_authenticate is changed to SVC_DENIED which sends
an rpc auth error back to the caller. This matches nfsd which returns
SVC_DENIED if there is no matching client address in the /etc/exports file.
SVC_DROP is used for a memory allocation error.

0001-NFS-add-minorversion-to-nfs_find_client-search.patch
0002-SQUASHME-pnfs-submit-fix-highest-backchannel-slot-us.patch

Both NFSv4.0 CB_RECALL and NFSv4.1 CB_LAYOUT_RECALL have been tested.

This third patch is for comment only. It compiles but has not been tested.
It returns SVC_DENIED if the dispatcher routines fail to find an
nfs_client struct - replacing the NFS4ERR_BADSESSION and NFS4ERR_BADHANDLE
currently returned. I'm not fully convinced that this is the behavior we want,
comments appreciated.

0003-NFS-return-an-rpc-auth-error-on-back-channel.patch

-->Andy


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-11-18 17:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-17  3:36 [PATCH 0/3] NFSv4 callback pg_authenticate fix andros
2010-11-17  3:36 ` [PATCH 1/3] NFS add minorversion to nfs_find_client search andros
2010-11-17  3:36   ` [PATCH 2/3] SQUASHME: pnfs-submit: fix highest backchannel slot used andros
2010-11-17  3:36     ` [PATCH 3/3] NFS return an rpc auth error on back channel andros
2010-11-17 23:26       ` Trond Myklebust
2010-11-18 14:42         ` William A. (Andy) Adamson
2010-11-18 15:05           ` Trond Myklebust
2010-11-18 15:08             ` William A. (Andy) Adamson
2010-11-17 23:10   ` [PATCH 1/3] NFS add minorversion to nfs_find_client search Trond Myklebust
2010-11-18 14:11     ` William A. (Andy) Adamson
2010-11-18 14:46       ` Trond Myklebust
2010-11-18 17:39         ` J. Bruce Fields
2010-11-17 22:49 ` [PATCH 0/3] NFSv4 callback pg_authenticate fix J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).