Linux NFS development
 help / color / mirror / Atom feed
From: Bruce Fields <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Trond Myklebust <trondmy@hammerspace.com>,
	Jeff Layton <jlayton@kernel.org>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: GSS unwrapping breaks the DRC
Date: Thu, 23 Apr 2020 15:34:05 -0400	[thread overview]
Message-ID: <20200423193405.GB4561@fieldses.org> (raw)
In-Reply-To: <AA069628-0668-4F15-8C29-23997D04185B@oracle.com>

On Fri, Apr 17, 2020 at 05:48:35PM -0400, Chuck Lever wrote:
> I've hit a snag here.
> 
> I reverted 241b1f419f0e on my server, and all tests completed
> successfully.
> 
> I reverted 241b1f419f0e on my client, and now krb5p is failing. Using
> xdr_buf_trim does the right thing on the server, but on the client it
> has exposed a latent bug in gss_unwrap_resp_priv() (ie, the bug does
> not appear to be harmful until 241b1f419f0e has been reverted).
> 
> The calculation of au_ralign in that function is wrong, and that forces
> rpc_prepare_reply_pages to allocate a zero-length tail. xdr_buf_trim()
> then lops off the end of each subsequent clear-text RPC message, and
> eventually a short READ results in test failures.
> 
> After experimenting with this for a day, I don't see any way for
> gss_unwrap_resp_priv() to estimate au_ralign based on what gss_unwrap()
> has done to the xdr_buf. The kerberos_v1 unwrap method does not appear
> to have any trailing checksum, for example, but v2 does.
> 
> The best approach for now seems to be to have the pseudoflavor-specific
> unwrap methods return the correct ralign value. A straightforward way
> to do this would be to add a *int parameter to ->gss_unwrap that would
> be set to the proper value; or hide that value somewhere in the xdr_buf.
> 
> Any other thoughts or random bits of inspiration?

No.  Among other things, a quick skim wasn't enough to remind me what
au_ralign is and why we have both that and au_rslack....  Sorry!  I've
got not much to offer but sympathy.

...

I have a random thought out of left field: after the xdr_stream
conversion, fs/nfs/nfs4xdr.c mostly doesn't deal directly with the reply
buffer any more.  It calls xdr_inline_decode(xdr, n) and gets back a
pointer to the next n bytes of rpc data.  Or it calls xdr_read_pages()
after which read data's supposed to be moved to the right place.

Would it be possible to delay rpcsec_gss decoding until then?  Would
that make things simpler or more complicated?

Eh, I think the answer is probably "more complicated".

--b.

  reply	other threads:[~2020-04-23 19:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 17:05 GSS unwrapping breaks the DRC Chuck Lever
2020-04-15 19:25 ` Bruce Fields
2020-04-15 20:06   ` Chuck Lever
2020-04-15 21:58     ` Bruce Fields
2020-04-15 22:23       ` Chuck Lever
2020-04-16  0:00         ` Bruce Fields
2020-04-16 14:07           ` Chuck Lever
2020-04-16 14:28             ` Bruce Fields
2020-04-17 21:48         ` Chuck Lever
2020-04-23 19:34           ` Bruce Fields [this message]
2020-04-23 19:41             ` Chuck Lever

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=20200423193405.GB4561@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@hammerspace.com \
    /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