Skip to content

Harden server-side RPCSEC GSS decode and backchannel teardown

Chuck Lever linux-nfs netdev 1 version In review

Get series with b4
b4 am [email protected] change-id 20260528-tier2-d0dedb949b3d

Versions newest first

  1. v1 Latest6 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6SUNRPC: Reject krb5 v2 wrap tokens with oversized ec fieldnet/sunrpc/auth_gss/gss_krb5_wrap.c+2 -00 replies
2/6SUNRPC: fix gssx_dec_option_array error path bugsnet/sunrpc/auth_gss/gss_rpc_xdr.c+6 -30 replies
3/6SUNRPC: reject duplicate CREDS_VALUE optionsnet/sunrpc/auth_gss/gss_rpc_xdr.c+6 -00 replies
4/6SUNRPC: Guard svcauth_gss_release() dispatch on rq_auth_statnet/sunrpc/auth_gss/svcauth_gss.c+2 -00 replies
5/6SUNRPC: Zero rpc_gss_wire_cred at svcauth_gss_decode_credbody() entrynet/sunrpc/auth_gss/svcauth_gss.c+3 -00 replies
6/6SUNRPC: close backchannel before destroying callback servicefs/nfs/callback.c include/linux/sunrpc/bc_xprt.h net/sunrpc/backchannel_rqst.c+39 -80 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJeff Layton
SeriesR-b
1/6
2/6
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/6] Harden server-side RPCSEC GSS decode and backchannel teardown

Address findings from an audit of how the server-side RPCSEC GSS accept path handles partially decoded and stale credential state. The common defect class: gss_svc_data and the rpc_gss_wire_cred it embeds (svcdata->clcred) are allocated with non-zeroing kmalloc and reused across requests, so an early decode failure leaves this request's partial writes mixed with the previous request's residue for a later consumer to trust.

The two gssx option-array decoder patches carry a hard ordering dependency. The error-path fix must come first: it wires free_svc_cred() into free_creds: and converts the out_free_groups:
teardown to the refcount-aware put_group_info(). Only once that refcount-aware free path exists does rejecting a duplicate CREDS_VALUE option actually release the single installed group_info instead of leaking it. Reviewed out of order, the duplicate-rejection patch looks incomplete.

The backchannel patch stands apart from the GSS decode work: a genuine race and use-after-free in callback-service teardown. It closes the producer side -- clearing xprt->bc_serv under bc_pa_lock -- before the callback threads stop, then drains any request that raced in before svc_destroy() frees the service.

---
Chris Mason (4):
SUNRPC: fix gssx_dec_option_array error path bugs
SUNRPC: reject duplicate CREDS_VALUE options
SUNRPC: Guard svcauth_gss_release() dispatch on rq_auth_stat
SUNRPC: Zero rpc_gss_wire_cred at svcauth_gss_decode_credbody() entry

Chuck Lever (2):
SUNRPC: Reject krb5 v2 wrap tokens with oversized ec field
SUNRPC: close backchannel before destroying callback service

 fs/nfs/callback.c                   |  4 +++-
 include/linux/sunrpc/bc_xprt.h      |  5 +++++
 net/sunrpc/auth_gss/gss_krb5_wrap.c |  2 ++
 net/sunrpc/auth_gss/gss_rpc_xdr.c   | 15 ++++++++++++---
 net/sunrpc/auth_gss/svcauth_gss.c   |  5 +++++
 net/sunrpc/backchannel_rqst.c       | 38 ++++++++++++++++++++++++++++++-------
 6 files changed, 58 insertions(+), 11 deletions(-)

---
base-commit: 4d4d6605de5f91a40335729b6a7cc15e83b280f3
change-id: 20260528-tier2-d0dedb949b3d

Best regards,

Signature · 1 line
Chuck Lever <[email protected]>