I've generated a reproducer that can be used to verify the issue is
solved "gss-expiry-repro.sh", attaching here. I verified that applying
the "SUNRPC: fix handling expired GSS context" patch in a test build
solves both the Jammy and Noble issues.

** Attachment added: "gss-expiry-repro.sh"
   
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2173036/+attachment/6019837/+files/gss-expiry-repro.sh

** Description changed:

  [Impact]
  
  NFSv3 and v4 clients using a sec=krb5* mount option can run into a
  situation where the GSS context expires between sending a request and
  verifying its reply, causing gss_validate() to fail with
  GSS_S_CONTEXT_EXPIRED. This results in an EACCES error returned from
  gss_validate(), which behaves differently on Jammy vs Noble:
  
  On Jammy 5.15 kernels, this results in an I/O error being returned.
  
  On Noble 6.8 kernels (version 6.8.0-98 and later), because commit
  fadc0f3bb2de ("sunrpc: don't immediately retransmit on seqno miss") was
  backported without 9b62ef6d239e ("SUNRPC: fix handling expired GSS
  context"), the client discards the reply, which results in the task
  issuing the request never seeing that reply and thus hanging
  indefinitely.
  
  [Fix]
  
  The fix exists upstream as commit 9b62ef6d239e ("SUNRPC: fix handling
  expired GSS context"). The fix solves the issue by catching an error
  caused by an expired auth context and in that scenario, returning
  EKEYREJECTED, which triggers the caller to obtain new context and retry
  instead of stalling.
  
  This is a clean cherry pick to Noble 6.8 and Jammy 5.15.
  
  [Test plan]
  
- Build and boot tested.
+ Run gss-expiry-repro.sh (attached to the Launchpad bug) as root in a
+ Jammy or Noble VM running the -generic kernel. It sets up a KDC, an NFS
+ server and a sec=krb5 NFSv4 client on the same host, limits tickets (and
+ thus GSS contexts) to 3 minutes, and delays NFS replies by 3s so that
+ the request in flight when a context expires is verified by the client
+ after expiry. It then writes to the mount in a loop:
+ 
+   sudo ./gss-expiry-repro.sh 600
+ 
+ Without the fix:
+   Jammy: a write fails with EACCES at each context expiry (about every 3 
minutes); the script reports "write FAILED" and FAIL.
+   Noble: a write hangs at the first context expiry; the script reports "write 
HUNG (>60s)" and FAIL.
+ 
+ With the fix, the client obtains a new context and every write succeeds
+ across several expiries; the script reports PASS.
  
  [Where issues could occur]
  
  This modifies the SUNRPC client implementation. Regressions could occur
  in either it or users of it, including NFSv3 and v4 mounts using
  Kerberos.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2173036

Title:
  Tasks can hang forever when using NFSv4 with the sec=krb5 mount option

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2173036/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to