[PATCH v2 0/2] Fix two latent server-side initialization bugs
Chuck Lever <[email protected]>
| Newsgroups | gmane.linux.nfs |
|---|---|
| Message-ID | <[email protected]> |
Both patches fix the same bug shape in the SUNRPC server: an object
becomes reachable by a consumer while a field it depends on is still
invalid. The use-gss-proxy proc entry is published before its mutex
is initialized; a half-allocated svc_serv whose per-pool percpu
counters never got backing storage is returned to its caller. In
each case the common path hides the flaw, and only a narrow trigger
exposes it -- a preemption-timed write to /proc/net/rpc/use-gss-proxy,
or a percpu allocation failure under memory pressure during RPC server
startup.
Each fix rests on an argument that no consumer observes the object
mid-initialization, and the two arguments differ. For the proc entry,
the guarantee comes from module load order: sunrpc.ko is a build-time
dependency of auth_rpcgss.ko, so sunrpc_init_net() has initialized
gssp_lock on every net namespace before auth_gss pernet init can
publish the file. Moving the init there ties the lock's lifetime to
the sunrpc_net it lives in and lets the lazy init_gssp_clnt() helper
go away. For the svc_serv, the guarantee is local: the percpu
allocation failure is caught and unwound inside __svc_create(), so a
half-constructed service never reaches nfsd, lockd, or the NFS
callback service. Both arguments are worth checking against the diffs.
The two fixes are independent, touch different files, and may be
applied in any order.
---
Changes in v2:
- Reverted the percpu_counter_init_many() consolidation back to
discrete percpu_counter_init()/percpu_counter_destroy() calls.
- Link to v1: https://patch.msgid.link/20260530-tier2-local-v1-0-fc294d34848a-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org
---
Chris Mason (1):
sunrpc: init gssp_lock before publishing proc entry
Chuck Lever (1):
SUNRPC: Check svc pool percpu counter allocation
net/sunrpc/auth_gss/gss_rpc_upcall.c | 6 -----
net/sunrpc/auth_gss/gss_rpc_upcall.h | 1 -
net/sunrpc/auth_gss/svcauth_gss.c | 1 -
net/sunrpc/sunrpc_syms.c | 1 +
net/sunrpc/svc.c | 45 +++++++++++++++++++++++++++++++-----
5 files changed, 40 insertions(+), 14 deletions(-)
---
base-commit: 4d4d6605de5f91a40335729b6a7cc15e83b280f3
change-id: 20260530-tier2-local-58cbe6d49337
Best regards,
--
Chuck Lever <[email protected]>