diff options
| author | Chuck Lever <cel@kernel.org> | 2026-10-06 11:31:16 -0400 |
|---|---|---|
| committer | Anna Schumaker <anna.schumaker@hammerspace.com> | 2026-10-12 16:28:08 -0400 |
| commit | 4f6cd78de1a78d359d46148ee72b57467fa26f84 (patch) | |
| tree | 8071edcc20d7cb40df12c862db027298dc2f230b /tools/lib/python | |
| parent | e27b84e076c1b623218ebe2887ca21c2c3217f5e (diff) | |
| download | linux-next-4f6cd78de1a78d359d46148ee72b57467fa26f84.tar.gz linux-next-4f6cd78de1a78d359d46148ee72b57467fa26f84.zip | |
NFS: add a key type that reveals the namespace .nfs keyring serial number
The per-namespace .nfs keyring is linked into no keyring that
userspace possesses, so a tool that provisions x509 credentials, or a
mount helper that searches for them, cannot reach it. Every keyring
operation from userspace takes a serial number, and nothing hands
this one out.
Register an "nfs_keyring" key type whose request_key handler runs in
the caller's context, without an upcall, and instantiates the key
with the serial number of the caller's namespace .nfs keyring.
Userspace reads the serial number with one request_key() and one
keyctl_read().
A keyring search runs before the handler does, and a task keeps its
session keyring across setns(). The type carries KEY_TYPE_NET_DOMAIN
so a key instantiated in one namespace does not answer a request from
another. Its preparse accepts no payload but the caller's own serial
number, so a key planted by add_key() cannot misdirect a later
request.
Register the type after register_pernet_subsys() has installed
nfs_net_id, and unregister it before the per-namespace state goes
away. unregister_key_type() waits for in-flight request_key() calls
to drain, so the handler never runs against a freed struct nfs_net.
Signed-off-by: Chuck Lever <cel@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
