Skip to contentSkip to conversation

net/handshake: Add new parameter 'HANDSHAKE_A_ACCEPT_KEYRING'

PATCH Applied Hannes Reinecke 6 participants 7 messages Jul 1, 2025 – Jul 8, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/handshake: Add new parameter 'HANDSHAKE_A_ACCEPT_KEYRING'

Add a new netlink parameter 'HANDSHAKE_A_ACCEPT_KEYRING' to provide the serial number of the keyring to use.

---
 Documentation/netlink/specs/handshake.yaml | 4 ++++
 include/uapi/linux/handshake.h             | 1 +
 net/handshake/tlshd.c                      | 6 ++++++
 3 files changed, 11 insertions(+)
Documentation/netlink/specs/handshake.yaml +4 -0
index b934cc513e3d..a8be0b54755b 100644
@@ -71,6 +71,9 @@ attribute-sets:
       -
         name: peername
         type: string
+      -
+        name: keyring
+        type: u32
   -
     name: done
     attributes:
@@ -109,6 +112,7 @@ operations:
             - peer-identity
             - certificate
             - peername
+            - keyring
     -
       name: done
       doc: Handler reports handshake completion
include/uapi/linux/handshake.h +1 -0
index 3d7ea58778c9..662e7de46c54 100644
@@ -45,6 +45,7 @@ enum {
 	HANDSHAKE_A_ACCEPT_PEER_IDENTITY,
 	HANDSHAKE_A_ACCEPT_CERTIFICATE,
 	HANDSHAKE_A_ACCEPT_PEERNAME,
+	HANDSHAKE_A_ACCEPT_KEYRING,
 
 	__HANDSHAKE_A_ACCEPT_MAX,
 	HANDSHAKE_A_ACCEPT_MAX = (__HANDSHAKE_A_ACCEPT_MAX - 1)
net/handshake/tlshd.c +6 -0
index d6f52839827e..081093dfd553 100644
@@ -230,6 +230,12 @@ static int tls_handshake_accept(struct handshake_req *req,
 		if (ret < 0)
 			goto out_cancel;
 	}
+	if (treq->th_keyring) {
+		ret = nla_put_u32(msg, HANDSHAKE_A_ACCEPT_KEYRING,
+				  treq->th_keyring);
+		if (ret < 0)
+			goto out_cancel;
+	}
 
 	ret = nla_put_u32(msg, HANDSHAKE_A_ACCEPT_AUTH_MODE,
 			  treq->th_auth_mode);
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 51 lines · Hannes Reinecke

Add a new netlink parameter 'HANDSHAKE_A_ACCEPT_KEYRING' to provide the serial number of the keyring to use.

---
 Documentation/netlink/specs/handshake.yaml | 4 ++++
 include/uapi/linux/handshake.h             | 1 +
 net/handshake/tlshd.c                      | 6 ++++++
 3 files changed, 11 insertions(+)
Documentation/netlink/specs/handshake.yaml +4 -0
index b934cc513e3d..a8be0b54755b 100644
@@ -71,6 +71,9 @@ attribute-sets:
       -
         name: peername
         type: string
+      -
+        name: keyring
+        type: u32
   -
     name: done
     attributes:
@@ -109,6 +112,7 @@ operations:
             - peer-identity
             - certificate
             - peername
+            - keyring
     -
       name: done
       doc: Handler reports handshake completion
include/uapi/linux/handshake.h +1 -0
index 3d7ea58778c9..662e7de46c54 100644
@@ -45,6 +45,7 @@ enum {
 	HANDSHAKE_A_ACCEPT_PEER_IDENTITY,
 	HANDSHAKE_A_ACCEPT_CERTIFICATE,
 	HANDSHAKE_A_ACCEPT_PEERNAME,
+	HANDSHAKE_A_ACCEPT_KEYRING,
 
 	__HANDSHAKE_A_ACCEPT_MAX,
 	HANDSHAKE_A_ACCEPT_MAX = (__HANDSHAKE_A_ACCEPT_MAX - 1)
net/handshake/tlshd.c +0 -0
index d6f52839827e..081093dfd553 100644
@@ -230,6 +230,12 @@ static int tls_handshake_accept(struct handshake_req *req,
 		if (ret < 0)
 			goto out_cancel;

net/handshake/tlshd.c static int tls_handshake_accept(struct handshake_req *req, · line 241

Quoted 10 lines
net/handshake/tlshd.c +6 -0
 	}
+	if (treq->th_keyring) {
+		ret = nla_put_u32(msg, HANDSHAKE_A_ACCEPT_KEYRING,
+				  treq->th_keyring);
+		if (ret < 0)
+			goto out_cancel;
+	}
 
 	ret = nla_put_u32(msg, HANDSHAKE_A_ACCEPT_AUTH_MODE,
 			  treq->th_auth_mode);
Signature · 1 line
Chuck Lever
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Hannes Reinecke
Quoted 2 lines · On Tue, 1 Jul 2025 16:46:57 +0200 Hannes Reinecke wrote:

Add a new netlink parameter 'HANDSHAKE_A_ACCEPT_KEYRING' to provide the serial number of the keyring to use.

I presume you may have some dependent work for other trees? If yes - could you pop this on a branch off an -rc tag so that multiple trees can merge? Or do you want us to ack and route it via different tree directly?

#3 lore raw
Quoted 11 lines · Jakub Kicinski
Quoted 2 lines · On Tue, 1 Jul 2025 16:46:57 +0200 Hannes Reinecke wrote:

Add a new netlink parameter 'HANDSHAKE_A_ACCEPT_KEYRING' to provide the serial number of the keyring to use.

I presume you may have some dependent work for other trees? If yes - could you pop this on a branch off an -rc tag so that multiple trees can merge? Or do you want us to ack and route it via different tree directly?

We are good from the NVMe side; we already set the 'keyring' parameter in the handshake arguments, but only found out now that we never actually pass this argument over to userspace... But maybe the NFS folks have addiional patches queued. Chuck?

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
#4 lore raw
Quoted 10 lines · Hannes Reinecke
Quoted 9 lines · Jakub Kicinski
Quoted 2 lines · On Tue,  1 Jul 2025 16:46:57 +0200 Hannes Reinecke wrote:

Add a new netlink parameter 'HANDSHAKE_A_ACCEPT_KEYRING' to provide the serial number of the keyring to use.

I presume you may have some dependent work for other trees? If yes - could you pop this on a branch off an -rc tag so that multiple trees can merge? Or do you want us to ack and route it via different tree directly?

Quoted 7 lines
Quoted 2 lines

We are good from the NVMe side; we already set the 'keyring' parameter in the handshake arguments, but only found out now that we never actually pass this argument over to userspace... But maybe the NFS folks have addiional patches queued. Chuck?

Currently .keyring is used only with NVMe. I recall that hch has plans to make the mount.nfs command set .keyring as well. However, nothing is queued yet, as far as I know.

Signature · 1 line
Chuck Lever
maintainer
#5 lore raw
Quoted 19 lines · Chuck Lever
Quoted 10 lines · Hannes Reinecke
Quoted 9 lines · Jakub Kicinski
Quoted 2 lines · On Tue,  1 Jul 2025 16:46:57 +0200 Hannes Reinecke wrote:

Add a new netlink parameter 'HANDSHAKE_A_ACCEPT_KEYRING' to provide the serial number of the keyring to use.

I presume you may have some dependent work for other trees? If yes - could you pop this on a branch off an -rc tag so that multiple trees can merge? Or do you want us to ack and route it via different tree directly?

Quoted 7 lines
Quoted 2 lines

We are good from the NVMe side; we already set the 'keyring' parameter in the handshake arguments, but only found out now that we never actually pass this argument over to userspace... But maybe the NFS folks have addiional patches queued. Chuck?

Quoted 3 lines

Currently .keyring is used only with NVMe. I recall that hch has plans to make the mount.nfs command set .keyring as well. However, nothing is queued yet, as far as I know.

I read the above as we are good to apply this to net-next right now...

/P

#6 lore raw
In reply to Hannes Reinecke
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Tue, 1 Jul 2025 16:46:57 +0200 you wrote:

Add a new netlink parameter 'HANDSHAKE_A_ACCEPT_KEYRING' to provide the serial number of the keyring to use.

---
 Documentation/netlink/specs/handshake.yaml | 4 ++++
 include/uapi/linux/handshake.h             | 1 +
 net/handshake/tlshd.c                      | 6 ++++++
 3 files changed, 11 insertions(+)

Here is the summary with links:
- net/handshake: Add new parameter 'HANDSHAKE_A_ACCEPT_KEYRING'

    https://git.kernel.org/netdev/net-next/c/e22da4685013

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html