Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next RESEND] net: tcp: Mark TCP-AO key derivation labels as nonstrings
@ 2026-12-03 16:50 Anggara Putra
  2026-12-03 18:24 ` Eric Biggers
  0 siblings, 1 reply; 2+ messages in thread
From: Anggara Putra @ 2026-12-03 16:50 UTC (permalink / raw)
  To: netdev
  Cc: edumazet, ncardwell, kuniyu, davem, kuba, pabeni, willemb, horms,
	linux-hardening

The TCP-AO key derivation input contains the six bytes of the
RFC 5926 label. Mark both fixed-width fields as __nonstring so GCC
can distinguish them from unterminated C strings. The serialized
input and its length stay the same for both address families.

OpenAI Codex assisted with the patch, commit message, and local tests
using the public KSPP compiler diagnostics.

Fixes: 068f5a009556 ("net/tcp-ao: Use crypto library API instead of
crypto_ahash")
Link: https://github.com/KSPP/linux/issues/382
Link: https://github.com/KSPP/linux/issues/383
Signed-off-by: Anggara Putra <anggaraputra87.ap@gmail.com>
---
The IPv4 and IPv6 TCP-AO objects matched their pre-patch x86-64 builds
byte for byte. The connect, self-connect and key-management kselftests
passed for both address families in QEMU.

 net/ipv4/tcp_ao.c | 2 +-
 net/ipv6/tcp_ao.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_ao.c b/net/ipv4/tcp_ao.c
index 857b868..ecf397f 100644
--- a/net/ipv4/tcp_ao.c
+++ b/net/ipv4/tcp_ao.c
@@ -445,7 +445,7 @@ static void tcp_v4_ao_calc_key(struct tcp_ao_key
*mkt, u8 *key,
 	/* See RFC5926 3.1.1 */
 	struct kdf_input_block {
 		u8                      counter;
-		u8                      label[6];
+		u8			label[6] __nonstring;
 		struct tcp4_ao_context	ctx;
 		__be16                  outlen;
 	} __packed input = {
diff --git a/net/ipv6/tcp_ao.c b/net/ipv6/tcp_ao.c
index 01a8472..e448ea3 100644
--- a/net/ipv6/tcp_ao.c
+++ b/net/ipv6/tcp_ao.c
@@ -20,7 +20,7 @@ static void tcp_v6_ao_calc_key(struct tcp_ao_key
*mkt, u8 *key,
 {
 	struct kdf_input_block {
 		u8			counter;
-		u8			label[6];
+		u8			label[6] __nonstring;
 		struct tcp6_ao_context	ctx;
 		__be16			outlen;
 	} __packed input = {

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

end of thread, other threads:[~2026-12-03 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 16:50 [PATCH net-next RESEND] net: tcp: Mark TCP-AO key derivation labels as nonstrings Anggara Putra
2026-12-03 18:24 ` Eric Biggers

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