Re: [PATCH] SUNRPC: Make svcauth_gss sequence-number window size tunable

From: Chuck Lever

Date: Wed Dec 02 2026 - 14:47:18 EST




On Mon, Nov 23, 2026, at 11:26 AM, Fredrik Tolf wrote:
> On Mon, 23 Nov 2026, Chuck Lever wrote:
>> I don't think this is a SunRPC scheduling problem. Rather it's that the
>> crypto handling sometimes takes a while (and I don't know why that is)
>> and that delays one RPC just enough to trigger the sequence number
>> window check.
>
> I think that it is. I reckon that, since nfsd handles requests
> concurrently, there are no particular ordering guarantees on the sequence
> number checks. While it's true that the particularly long time that the
> MIC verification can take seems to be the actual cause of the issue in
> these cases, I don't think making that go away would be an actual
> root-cause fix.
>
> As I mentioned, I considered other heuristic solutions -- one of them was
> to effectively hold a lock during the MIC+seqnum check, or other
> mechanisms that would compensate for the time the MIC verification might
> take, but in the end I didn't consider them technically correct either.
> Again, since the request processing is concurrent, I reckon that, while
> much more unlikely, there could be other scheduling issues (ECC/MCE
> hickups, interrupt storms, &c&c) that could delay a particular nfsd thread
> from even reaching svcauth_gss_verify_header before the window has already
> excluded it by the work of other, faster-working threads. A *lot* less
> likely, yes, but still hard to consider technically correct and fixing
> the root cause, no?
>
> As I said, in a UDP context, I imagine this wouldn't be a problem, since
> the failing packet would just be considered lost and retransmitted, but
> that's not how things happen over TCP. Unless a TCP connection can also be
> made to just consider such requests lost and having them retransmitted
> later instead of closing the channel, I imagine the only real root-cause
> fix is to serialize the GSS verifier checks, so that they happen in TCP
> stream order, and that seems quite difficult to do given the asynchronous
> nature of the sunrpc servicing implementation, which is why it comes back
> to a scheduling problem.
>
> Again, since I considered that problem quite difficult to solve, that's
> why I suggested this solution in the interim, just because I'm sitting
> with disconnection storms on my home network that sometimes makes it very
> difficult to get anything done. ;)
>
> At least that's how I analyzed it, but I'm really not familiar with the
> NFS/sunrpc code; I'm normally just an ordinary home user of it. Thoughts?

I've made some time to investigate the issue again. The crypto functions
are not the source of the extra latency, agreed. Dequeuing incoming messages
from the transport endpoint happens in received order, but the nfsd threads
that pick up that work can run in any order. (What confused me about your
original suggestion was "sunrpc" and "scheduling" in the same sentence: here,
it's the kernel's scheduler that chooses which nfsd thread to awaken).

The behavior is the same for all security flavors and transports, but only
GSS is impacted because it's the only flavor with an ordering constraint.

There are some things that make this much worse: an underpowered NFS server,
CONFIG_PREEMPT_DYNAMIC in full mode on the server, or a client sharing the
same GSS context across multiple connections.

It appears to impact sec=krb5 as well as krb5i and krb5p, so using Kerberos
authentication-only over TLS is going to suffer from the same issue.

I'm looking at various solutions, but none of them appear to close the gap
entirely. But I'm still researching. Some scenarios we could try is skipping
the GSS sequence number window check when TLS or NFSv4.1 sessions are in use,
since inserting replays in either scenario would be detectable. But that
leaves NFSv3...


--
Chuck Lever