Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 00/10] Deliver TLS session tags to upper-layer consumers (NFSD)
@ 2026-11-12 14:52 Chuck Lever
  2026-11-12 14:52 ` [PATCH net-next v2 01/10] handshake: Add tags to "done" downcall Chuck Lever
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Chuck Lever @ 2026-11-12 14:52 UTC (permalink / raw)
  To: Donald Hunter, Jakub Kicinski, David S. Miller, Paolo Abeni,
	Simon Horman, John Fastabend, Sabrina Dubroca, Keith Busch,
	Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
	Chuck Lever, Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo,
	Tom Talpey, Eric Dumazet
  Cc: kernel-tls-handshake, netdev, linux-nvme, linux-nfs,
	Hannes Reinecke

NFSD and similar upper-layer services want access-control decisions
based on TLS peer-certificate characteristics, but in-kernel x.509
parsing would duplicate work mature userspace libraries already do.
tlshd evaluates certificates against admin-defined policy and reports
the policies that matched back to the kernel as opaque string tags.
Intersection against per-resource tag sets stays the consumer's
problem.

The series builds on commit 81246a65303d ("handshake: Require admin
permission for DONE command"), now in net-next. Without it a forged
DONE downcall could set session tags for a real handshake.

Four architectural choices shape the series, only one of which is
visible in any single patch.

The tagging vocabulary is opaque to the kernel. tlshd decides what
each tag means, and the handshake layer and its consumers only test
membership. Any future attribute the kernel wants to gate on has to
be expressed as a tag rather than as a new netlink field.

HANDSHAKE_MAX_SESSIONTAGS rides on every ACCEPT reply as
HANDSHAKE_A_ACCEPT_MAX_SESSION_TAGS (patch 7), so tlshd can size its
DONE-side tag list to the running kernel's limit rather than to a
header constant.

Session tags have one owner at each step. The DONE handler collects
them into a private stringset before taking the completion gate, so
no allocation happens inside the gate. The gate's winner hands the
set to handshake_finish_complete() (patch 6 adds a kunit test for the
gate). svcsock copies the set into the transport and orders the copy
before setting XPT_TLS_SESSION. check_xprtsec_policy() reads that bit
with test_bit_acquire(), so a transport that reports a TLS session
always has its tags visible.

The stringset helper (patch 2) is a generic library so that NFSD
export tagging (patches 9 and 10) can use it without further churn in
net/handshake/.

This series applies to the nfsd-testing branch of
https://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git
The base-commit below is the tip of that branch as of August 18.

---
Changes in v2:
- Drop v1's 1/9, sent ahead of the set per Jeff and now merged.
- Adopt the pinned hr_file/fput lifetime model.
- Adapt to the errno-valued handshake status (hp_done takes int).
- Rename "tagset" to "stringset" throughout (Hannes)
- Warn and return false when a query precedes stringset_finalize().
- Add a patch with KUnit tests for stringset.
- Split the hp_done session-tags argument into its own patch.
- Collect the session tags before taking the completion gate.
- Pass ownership of the tag set to handshake_finish_complete().
- Add handshake_session_tag_len(), shared with the NFSD parser.
- Add KUnit tests for session-tag collection.
- Check the file reference count in the completion-gate KUnit case.
- Rename the ACCEPT cap attribute MAX_TAGS to MAX_SESSION_TAGS.
- Publish the saved tags with smp_wmb() and test_bit_acquire().
- Deny a tagged export on the non-mTLS arms of check_xprtsec_policy().
- Extract nfsd_nl_parse_allow_tags() from the netlink export parser.
- Build stringset only when a consumer selects CONFIG_STRINGSET.
- Free the session tags as soon as hp_done() returns.
- Report a rejected session tag or allow-tag through the extack.
- Show allow_tags in /proc/fs/nfsd/exports.
- Record the client address and XID in nfsd_export_tags_denied.
- Link to v1: https://patch.msgid.link/20260605-tls-session-tags-v1-0-47bd1d94d552@oracle.com

---
Chuck Lever (10):
      handshake: Add tags to "done" downcall
      lib: Add a "stringset" data structure
      lib: Add KUnit tests for the stringset data structure
      handshake: Add a session-tags argument to the TLS done callback
      handshake: Pick up session tags passed during the DONE downcall
      handshake: Add a kunit test for the completion gate
      handshake: Advertise the session-tag cap to user space
      SUNRPC: Copy the TLS session tags when they are available
      NFSD: Implement export tagging
      NFSD: Add allow_tags to the netlink export interface

 Documentation/core-api/index.rst           |   1 +
 Documentation/core-api/stringset.rst       | 243 +++++++++++++++++++++++
 Documentation/netlink/specs/handshake.yaml |  19 ++
 Documentation/netlink/specs/nfsd.yaml      |  10 +
 Documentation/networking/tls-handshake.rst |  62 +++++-
 MAINTAINERS                                |   8 +
 drivers/nvme/host/tcp.c                    |   3 +-
 drivers/nvme/target/tcp.c                  |   3 +-
 fs/nfsd/Kconfig                            |   1 +
 fs/nfsd/export.c                           | 194 +++++++++++++++++-
 fs/nfsd/export.h                           |   9 +
 fs/nfsd/netlink.c                          |   4 +-
 fs/nfsd/netlink.h                          |   3 +-
 fs/nfsd/trace.h                            |  27 +++
 include/linux/stringset.h                  | 191 ++++++++++++++++++
 include/linux/sunrpc/svc_xprt.h            |   7 +-
 include/net/handshake.h                    |  50 ++++-
 include/uapi/linux/handshake.h             |   4 +
 include/uapi/linux/nfsd_netlink.h          |   1 +
 lib/Kconfig                                |  12 ++
 lib/Kconfig.debug                          |   6 +
 lib/Makefile                               |   1 +
 lib/stringset.c                            | 190 ++++++++++++++++++
 lib/tests/Makefile                         |   1 +
 lib/tests/stringset_kunit.c                | 308 +++++++++++++++++++++++++++++
 net/Kconfig                                |   1 +
 net/handshake/genl.c                       |   5 +-
 net/handshake/handshake-test.c             | 307 ++++++++++++++++++++++++++++
 net/handshake/handshake.h                  |   9 +
 net/handshake/netlink.c                    | 110 ++++++++++-
 net/handshake/request.c                    |  61 +++++-
 net/handshake/tlshd.c                      |  10 +-
 net/sunrpc/Kconfig                         |   1 +
 net/sunrpc/svc_xprt.c                      |  11 +-
 net/sunrpc/svcauth_unix.c                  |  14 +-
 net/sunrpc/svcsock.c                       |  63 +++++-
 net/sunrpc/xprtsock.c                      |   4 +-
 tools/net/ynl/Makefile.deps                |   3 +-
 38 files changed, 1911 insertions(+), 46 deletions(-)
---
base-commit: c88fd6989aea9237a60a4859139a265bfb7ddc0b
change-id: 20260512-tls-session-tags-9d0042583f44

Best regards,
--  
Chuck Lever <cel@kernel.org>



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-11-13 14:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 14:52 [PATCH net-next v2 00/10] Deliver TLS session tags to upper-layer consumers (NFSD) Chuck Lever
2026-11-12 14:52 ` [PATCH net-next v2 01/10] handshake: Add tags to "done" downcall Chuck Lever
2026-11-12 14:52 ` [PATCH net-next v2 02/10] lib: Add a "stringset" data structure Chuck Lever
2026-11-13 14:52   ` sashiko-bot
2026-11-12 14:52 ` [PATCH net-next v2 03/10] lib: Add KUnit tests for the stringset " Chuck Lever
2026-11-12 14:52 ` [PATCH net-next v2 04/10] handshake: Add a session-tags argument to the TLS done callback Chuck Lever
2026-11-12 14:52 ` [PATCH net-next v2 05/10] handshake: Pick up session tags passed during the DONE downcall Chuck Lever
2026-11-12 14:52 ` [PATCH net-next v2 06/10] handshake: Add a kunit test for the completion gate Chuck Lever
2026-11-13 14:52   ` sashiko-bot
2026-11-12 14:52 ` [PATCH net-next v2 07/10] handshake: Advertise the session-tag cap to user space Chuck Lever
2026-11-12 14:52 ` [PATCH net-next v2 08/10] SUNRPC: Copy the TLS session tags when they are available Chuck Lever
2026-11-12 14:52 ` [PATCH net-next v2 09/10] NFSD: Implement export tagging Chuck Lever
2026-11-12 14:52 ` [PATCH net-next v2 10/10] NFSD: Add allow_tags to the netlink export interface Chuck Lever
2026-11-13 14:52   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox