From: Junyoung Im <jade04342@gmail.com>
To: trondmy@kernel.org, anna@kernel.org
Cc: cel@kernel.org, jlayton@kernel.org, neil@brown.name,
okorniev@redhat.com, Dai.Ngo@oracle.com, tom@talpey.com,
linux-nfs@vger.kernel.org, Junyoung Im <jade04342@gmail.com>
Subject: [RFC PATCH 0/1] SUNRPC: complete verified GSS replies after context expiry
Date: Mon, 23 Nov 2026 18:21:03 +0900 [thread overview]
Message-ID: <20261123092104.2518133-1-jade04342@gmail.com> (raw)
Hi,
I'd like to request feedback on a client-side RPCSEC_GSS change that
allows an outstanding RPC to complete using its original reply after
the Kerberos security context has expired.
I encountered this problem with NFSv4.0 over Kerberos. A server can
execute a non-idempotent operation successfully, but its reply may be
delayed until after the client's GSS context expires. The client then
rejects the reply verifier, renews its credentials, and retransmits
the request with a new XID. For operations such as RENAME, REMOVE, and
MKDIR, the second execution can return ENOENT or EEXIST even though
the original operation succeeded. NFSv4.1 and later are largely
protected by the session reply cache, but they still renew credentials
and retransmit.
The original issue is documented here:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2173036
The proposed change allows an already-issued RPCSEC_GSS DATA request
to complete using its original reply when the reply passes the
required verification checks and the request satisfies a bounded
context-expiry exception. The main changes are:
* Bind reply verification to the GSS sequence number of the
corresponding transmitted request, including integrity- and
privacy-protected reply bodies.
* Record when the complete TCP request record was queued, and require
that this happened before the Kerberos context expired. Other
transports do not record this, so the exception does not apply to
them.
* Introduce reply-specific GSS verification callbacks so that
Kerberos can explicitly distinguish successful cryptographic
verification from context lifetime expiry. The existing strict
interfaces keep their behavior.
* Bound the exception using the actual Kerberos end time, REALTIME
and BOOTTIME deadlines, and clock-change checks.
* Accept an expired-context reply provisionally at the verifier
stage, with final acceptance only after all verification required
by the selected security service has completed.
The grace period defaults to 30 seconds, is capped at 120 seconds, and
can be disabled with auth_rpcgss.expired_reply_grace=0.
When the original reply satisfies these conditions, the client passes
it to the existing RPC result decoder. This preserves the actual NFS
result, including NFS errors, without retransmitting the operation.
Otherwise, the client keeps its existing credential renewal and
retransmission behavior, subject to the normal retry budget. The
change does not let new requests use expired contexts, and it does
not provide exactly-once semantics when the original reply cannot be
accepted. No server-side changes are required.
The patch is based on v7.4-rc3 and also applies cleanly to v7.4-rc4.
Testing
-------
Clients were QEMU/KVM guests running the patched v7.4-rc3 kernel, and
servers were guests running an unmodified v7.4-rc3 kernel. The final
campaign used 86 client/server VM pairs on 13 hosts and covered
NFSv4.0, v4.1, and v4.2 with sec=krb5, krb5i, and krb5p, using RENAME,
MKDIR, REMOVE, READ, and WRITE.
A TCP proxy in front of nfsd held the target reply until after context
expiry and, in some scenarios, modified it. The scenarios included
delayed replies, replies beyond the grace period or with the exception
disabled, GSS sequence-number re-encoding, invalid reply bodies,
missing, unknown, or error accept statuses, expiry boundaries, clock
steps, and original NFS error replies. A test-only kprobe delay was
used for the case where the deadline passes between header and body
verification.
All 8,670 valid trials matched their expected outcomes:
* 3,600 delayed original replies were accepted without credential
renewal or a new XID, including 900 trials in which the request had
been re-encoded once or twice with a new GSS sequence number. nfsd
executed the operation exactly once in each of these trials.
* 270 original NFS error replies were returned to the application
without retransmission.
* 4,800 trials in which the exception was unavailable or the reply
could not be accepted followed the existing credential renewal and
retransmission behavior.
No unexpected EIO or incorrect acceptance was observed. In 16 trials
of the initial campaign, and in one rerun, nfsd closed the connection
before the held reply could be delivered, so the injected condition
did not occur. These trials were excluded and replaced with valid
reruns.
As expected, when the original reply cannot be accepted, NFSv4.0 can
still re-execute non-idempotent operations. The patch avoids
retransmission only when the original reply can still be verified; it
does not change the NFSv4.0 recovery guarantees.
The testing did not cover NFSv3, non-TCP transports, nfsd callbacks,
requests queued after context expiry, exhaustion of the credential
retry budget, or NFS error replies to READ and WRITE. The refactored
Kerberos verify and unwrap helpers are also used by nfsd, but the
servers in these tests ran unmodified kernels.
Review feedback
---------------
I would particularly appreciate feedback on:
* Whether a bounded exception for completing an already-issued RPC
with a verified reply is appropriate for RPCSEC_GSS.
* Whether reply-specific verification callbacks are a suitable way to
keep cryptographic verification separate from context lifetime
enforcement.
* Whether keeping the existing credential renewal and retransmission
behavior when the original reply cannot be accepted is the right
compatibility policy.
Thanks for your time and review.
Junyoung Im
Junyoung Im (1):
SUNRPC: complete verified GSS replies after context expiry
include/linux/sunrpc/auth_gss.h | 10 ++
include/linux/sunrpc/gss_api.h | 38 +++++
include/linux/sunrpc/xprt.h | 44 +++++
net/sunrpc/auth_gss/auth_gss.c | 205 +++++++++++++++++++++---
net/sunrpc/auth_gss/gss_krb5_internal.h | 10 ++
net/sunrpc/auth_gss/gss_krb5_mech.c | 24 +++
net/sunrpc/auth_gss/gss_krb5_unseal.c | 52 ++++--
net/sunrpc/auth_gss/gss_krb5_wrap.c | 53 +++++-
net/sunrpc/auth_gss/gss_mech_switch.c | 39 +++++
net/sunrpc/clnt.c | 57 ++++++-
net/sunrpc/xprt.c | 58 +++++++
net/sunrpc/xprtsock.c | 1 +
12 files changed, 551 insertions(+), 40 deletions(-)
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
--
2.34.1
next reply other threads:[~2026-11-23 9:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 9:21 Junyoung Im [this message]
2026-11-23 9:21 ` [RFC PATCH 1/1] SUNRPC: complete verified GSS replies after context expiry Junyoung Im
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=20261123092104.2518133-1-jade04342@gmail.com \
--to=jade04342@gmail.com \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=cel@kernel.org \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
--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