Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] SUNRPC: Refactor nfsd4_do_encode_secinfo()
Date: Thu, 7 Feb 2013 11:23:08 -0500	[thread overview]
Message-ID: <20130207162308.GI3222@fieldses.org> (raw)
In-Reply-To: <87316F41-4E5E-473C-A372-0AFC6721A355@oracle.com>

On Thu, Feb 07, 2013 at 10:58:25AM -0500, Chuck Lever wrote:
> 
> On Feb 7, 2013, at 10:02 AM, J. Bruce Fields <bfields@fieldses.org> wrote:
> 
> > On Fri, Feb 01, 2013 at 05:43:44PM -0500, Chuck Lever wrote:
> >> Clean up.  This matches a similar API for the client side, and
> >> keeps ULP fingers out the of the GSS mech switch.
> >> 
> >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> >> Acked-by: J. Bruce Fields <bfields@redhat.com>
> >> ---
> >> 
> >> Bruce-
> >> 
> >> This version of the patch follows the existing logic in
> >> nfsd4_do_encode_secinfo(): If the RPC layer can't find GSS info
> >> that matches an export security flavor, it assumes the flavor is
> >> not a GSS pseudoflavor, and simply puts it on the wire.
> >> 
> >> However, if the below XDR encoding logic is given a legitimate GSS
> >> pseudoflavor but the RPC layer says it does not support that
> >> pseudoflavor for some reason, then we leak GSS pseudoflavor numbers
> >> onto the wire.
> >> 
> >> I confirmed this happens by blacklisting rpcsec_gss_krb5, then
> >> attempted a client transition from the pseudo-fs to a Kerberos-only
> >> share.  The client received a flavor list containing the Kerberos
> >> pseudoflavor numbers, rather than GSS tuples.
> >> 
> >> The encoder logic can check that each pseudoflavor is less than
> >> MAXFLAVOR before writing it into the buffer, to prevent this.  But
> >> after "nflavs" is written into the XDR buffer, the encoder can't
> >> skip writing flavor information into the buffer when it discovers
> >> the RPC layer doesn't support that flavor.
> >> 
> >> Is there some way of writing "nflavs" into the XDR buffer after
> >> the loop that writes the flavor information is complete?
> > 
> > Yes, you can save a pointer and then go back and fill that in--see
> > encode_fattr for an example.
> 
> Thanks, I will submit an additional patch that describes this issue and fixes it.
> 
> I asked David Noveck, as one of the authors of RFC 3530, whether an NFS server should return a zero-length flavor list or an error if SECINFO can't find any flavors a client is allowed to use. His opinion was to return NFS4_OK and a zero-length flavor list.

Fine with me for this code.

(In practice though we should probably be warning somewhere (exportfs?)
if somebody creates an export like that.)

--b.

  reply	other threads:[~2013-02-07 16:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-01 22:43 [PATCH] SUNRPC: Refactor nfsd4_do_encode_secinfo() Chuck Lever
2013-02-07 15:02 ` J. Bruce Fields
2013-02-07 15:58   ` Chuck Lever
2013-02-07 16:23     ` J. Bruce Fields [this message]
2013-02-07 16:26       ` Chuck Lever
2013-02-07 16:55         ` J. Bruce Fields
2013-02-07 17:03           ` Chuck Lever
2013-02-07 17:12             ` Chuck Lever
2013-02-07 17:14               ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130207162308.GI3222@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox