From: Scott Mayhew <smayhew@redhat.com>
To: Trond Myklebust <trondmy@kernel.org>
Cc: anna@kernel.org, chuck.lever@oracle.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2] SUNRPC: Check if we need to recalculate slack estimates
Date: Thu, 4 Dec 2025 08:53:02 -0500 [thread overview]
Message-ID: <aTGSPl66JCYjlt6W@aion> (raw)
In-Reply-To: <305f38b14cec83b79921d5e1552ace515db59f24.camel@kernel.org>
On Wed, 03 Dec 2025, Trond Myklebust wrote:
> Hi Scott,
>
> On Thu, 2025-11-20 at 07:12 -0500, Scott Mayhew wrote:
> > If the incoming GSS verifier is larger than what we previously
> > recorded
> > on the gss_auth, that would indicate the GSS cred/context used for
> > that
> > RPC is using a different enctype than the one used by the machine
> > cred/context, and we should recalculate the slack variables
> > accordingly.
> >
> > Link: https://bugs.debian.org/1120598
> > Signed-off-by: Scott Mayhew <smayhew@redhat.com>
> > ---
> > net/sunrpc/auth_gss/auth_gss.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/net/sunrpc/auth_gss/auth_gss.c
> > b/net/sunrpc/auth_gss/auth_gss.c
> > index 5c095cb8cb20..bff5f10581a2 100644
> > --- a/net/sunrpc/auth_gss/auth_gss.c
> > +++ b/net/sunrpc/auth_gss/auth_gss.c
> > @@ -1721,6 +1721,18 @@ gss_validate(struct rpc_task *task, struct
> > xdr_stream *xdr)
> > if (maj_stat)
> > goto bad_mic;
> >
> > + /*
> > + * Normally we only recalculate the slack variables once
> > after
> > + * creating a new gss_auth, but we should also do it if the
> > incoming
> > + * verifier has a larger size than what was previously
> > recorded.
> > + * When the incoming verifier is larger than expected, the
> > + * GSS context is using a different enctype than the one
> > used
> > + * initially by the machine credential. Force a slack size
> > update
> > + * to maintain good payload alignment.
> > + */
> > + if (cred->cr_auth->au_verfsize < (XDR_QUADLEN(len) + 2))
> > + __set_bit(RPCAUTH_AUTH_UPDATE_SLACK, &cred->cr_auth-
> > >au_flags);
> > +
> > /* We leave it to unwrap to calculate au_rslack. For now we
> > just
> > * calculate the length of the verifier: */
> > if (test_bit(RPCAUTH_AUTH_UPDATE_SLACK, &cred->cr_auth-
> > >au_flags))
>
> What's the status here? Are you planning to put out a new version with
> the non-atomic __set_bit() -> atomic set_bit() change?
No. After discussing with Chuck and Jeff I'm not sure this is the
right approach.
I was under the impression that the slack and ralign values were more
like estimates and we could afford to be conservative, i.e. I was
thinking that as long as we were accommodating the enctype with the
largest space requirements then we'd be okay. But if that's not the
case, then updating the values when a user cred is using a SHA2
enctype would mean the values are incorrect if the machine cred is using
a SHA1 enctype.
Maybe we should instead just emit some sort of a warning when we
encounter a verifier with a different size that what we previously
recorded on the auth handle?
>
> --
> Trond Myklebust
> Linux NFS client maintainer, Hammerspace
> trondmy@kernel.org, trond.myklebust@hammerspace.com
>
next prev parent reply other threads:[~2025-12-04 13:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 12:12 [PATCH v2] SUNRPC: Check if we need to recalculate slack estimates Scott Mayhew
2025-11-20 13:44 ` Chuck Lever
2025-11-20 14:30 ` Jeff Layton
2025-11-20 20:22 ` Scott Mayhew
2025-12-03 19:29 ` Trond Myklebust
2025-12-04 13:53 ` Scott Mayhew [this message]
2025-12-04 14:00 ` 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=aTGSPl66JCYjlt6W@aion \
--to=smayhew@redhat.com \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@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