net/sunrpc/auth_gss/svcauth_gss.c
Source file repositories/reference/linux-study-clean/net/sunrpc/auth_gss/svcauth_gss.c
File Facts
- System
- Linux kernel
- Corpus path
net/sunrpc/auth_gss/svcauth_gss.c- Extension
.c- Size
- 52366 bytes
- Lines
- 2127
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hlinux/types.hlinux/module.hlinux/pagemap.hlinux/user_namespace.hlinux/sunrpc/auth_gss.hlinux/sunrpc/gss_err.hlinux/sunrpc/svcauth.hlinux/sunrpc/svcauth_gss.hlinux/sunrpc/cache.hlinux/sunrpc/gss_krb5.htrace/events/rpcgss.hgss_rpc_upcall.h
Detected Declarations
struct gss_svc_datastruct rsistruct gss_svc_seq_datastruct rscstruct gss_domainfunction handlefunction rsi_freefunction rsi_free_rcufunction rsi_putfunction rsi_hashfunction rsi_matchfunction dup_to_netobjfunction dup_netobjfunction rsi_initfunction update_rsifunction rsi_upcallfunction rsi_requestfunction rsi_parsefunction rsc_freefunction rsc_free_rcufunction rsc_putfunction rsc_hashfunction rsc_matchfunction rsc_initfunction update_rscfunction rsc_allocfunction rsc_upcallfunction rsc_parsefunction gss_svc_searchbyctxfunction gss_check_seq_numfunction svcauth_gss_verify_headerfunction svcauth_gss_encode_verffunction find_gss_auth_domainfunction svcauth_gss_flavorfunction svcauth_gss_register_pseudoflavorfunction svcauth_gss_unwrap_integfunction svcauth_gss_unwrap_privfunction svcauth_gss_set_clientfunction svcauth_gss_proc_init_verffunction gss_free_in_token_pagesfunction gss_read_proxy_verffunction svcxdr_encode_gss_init_resfunction svcauth_gss_legacy_initfunction gss_proxy_save_rscfunction svcauth_gss_proxy_initfunction set_gss_proxyfunction use_gss_proxyfunction svcauth_gss_proc_init
Annotated Snippet
struct gss_svc_data {
/* decoded gss client cred: */
struct rpc_gss_wire_cred clcred;
u32 gsd_databody_offset;
struct rsc *rsci;
/* for temporary results */
__be32 gsd_seq_num;
u8 gsd_scratch[GSS_SCRATCH_SIZE];
};
/* The rpcsec_init cache is used for mapping RPCSEC_GSS_{,CONT_}INIT requests
* into replies.
*
* Key is context handle (\x if empty) and gss_token.
* Content is major_status minor_status (integers) context_handle, reply_token.
*
*/
static int netobj_equal(struct xdr_netobj *a, struct xdr_netobj *b)
{
return a->len == b->len && 0 == memcmp(a->data, b->data, a->len);
}
#define RSI_HASHBITS 6
#define RSI_HASHMAX (1<<RSI_HASHBITS)
struct rsi {
struct cache_head h;
struct xdr_netobj in_handle, in_token;
struct xdr_netobj out_handle, out_token;
int major_status, minor_status;
struct rcu_head rcu_head;
};
static struct rsi *rsi_update(struct cache_detail *cd, struct rsi *new, struct rsi *old);
static struct rsi *rsi_lookup(struct cache_detail *cd, struct rsi *item);
static void rsi_free(struct rsi *rsii)
{
kfree(rsii->in_handle.data);
kfree(rsii->in_token.data);
kfree(rsii->out_handle.data);
kfree(rsii->out_token.data);
}
static void rsi_free_rcu(struct rcu_head *head)
{
struct rsi *rsii = container_of(head, struct rsi, rcu_head);
rsi_free(rsii);
kfree(rsii);
}
static void rsi_put(struct kref *ref)
{
struct rsi *rsii = container_of(ref, struct rsi, h.ref);
call_rcu(&rsii->rcu_head, rsi_free_rcu);
}
static inline int rsi_hash(struct rsi *item)
{
return hash_mem(item->in_handle.data, item->in_handle.len, RSI_HASHBITS)
^ hash_mem(item->in_token.data, item->in_token.len, RSI_HASHBITS);
}
static int rsi_match(struct cache_head *a, struct cache_head *b)
{
struct rsi *item = container_of(a, struct rsi, h);
struct rsi *tmp = container_of(b, struct rsi, h);
return netobj_equal(&item->in_handle, &tmp->in_handle) &&
netobj_equal(&item->in_token, &tmp->in_token);
}
static int dup_to_netobj(struct xdr_netobj *dst, char *src, int len)
{
dst->len = len;
dst->data = (len ? kmemdup(src, len, GFP_KERNEL) : NULL);
if (len && !dst->data)
return -ENOMEM;
return 0;
}
static inline int dup_netobj(struct xdr_netobj *dst, struct xdr_netobj *src)
{
return dup_to_netobj(dst, src->data, src->len);
}
static void rsi_init(struct cache_head *cnew, struct cache_head *citem)
Annotation
- Immediate include surface: `linux/slab.h`, `linux/types.h`, `linux/module.h`, `linux/pagemap.h`, `linux/user_namespace.h`, `linux/sunrpc/auth_gss.h`, `linux/sunrpc/gss_err.h`, `linux/sunrpc/svcauth.h`.
- Detected declarations: `struct gss_svc_data`, `struct rsi`, `struct gss_svc_seq_data`, `struct rsc`, `struct gss_domain`, `function handle`, `function rsi_free`, `function rsi_free_rcu`, `function rsi_put`, `function rsi_hash`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.