Netdev List
 help / color / mirror / Atom feed
* [PATCH net] tipc: compute the rekeying delay without wrapping
@ 2026-11-24 13:32 Kyuwon Cho
  0 siblings, 0 replies; only message in thread
From: Kyuwon Cho @ 2026-11-24 13:32 UTC (permalink / raw)
  To: Jon Maloy, Tung Quang Nguyen
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Willem de Bruijn, Simon Horman, Tuong Lien, netdev,
	tipc-discussion

tipc_crypto_rekeying_sched() converts the rekeying interval, given in
minutes, to milliseconds in 32 bits:

	delay = (now) ? 0 : tx->rekeying_intv * 60 * 1000;

TIPC_NLA_NODE_REKEYING accepts any u32, so intervals of 71583 minutes
and more wrap. An interval of 134217728 minutes gives a delay of 0. The
TX rekeying work then requeues itself without delay, and while its new
key waits for a peer to take it, each run goes straight back to the
requeue: a kworker spins until the key is flushed or the interval is
changed.

Compute the delay in jiffies in 64 bits and cap it at MAX_JIFFY_OFFSET,
the largest delay msecs_to_jiffies() returns.

Fixes: 23700da29b83 ("tipc: add automatic rekeying for encryption key")
Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>
---
The issue was found by an LLM-guided test generator that we are
developing as a research prototype. A reproducer, which runs as any
user with iproute2's tipc tool:

$ unshare -Urn sh -e <<'END'
tipc node set identity 1111111111111111
tipc node set key this_is_a_master_key master
tipc node set key rekeying 134217728
sleep 3
END

Without the patch, a kworker keeps one CPU busy until the namespace
goes away (about 300 ticks of system time in three seconds on a 2-CPU
VM, against 2 before the last command); with it, the system time stays
at the idle level.

The patch was written with LLM assistance; we reviewed and tested it.

 net/tipc/crypto.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c
index 4409bdb70fe9..ef08524ce2ca 100644
--- a/net/tipc/crypto.c
+++ b/net/tipc/crypto.c
@@ -2417,8 +2417,9 @@ void tipc_crypto_rekeying_sched(struct tipc_crypto *tx, bool changed,
 	}
 
 	if (tx->rekeying_intv || now) {
-		delay = (now) ? 0 : tx->rekeying_intv * 60 * 1000;
-		queue_delayed_work(tx->wq, &tx->work, msecs_to_jiffies(delay));
+		delay = now ? 0 : min_t(u64, (u64)tx->rekeying_intv * 60 * HZ,
+					MAX_JIFFY_OFFSET);
+		queue_delayed_work(tx->wq, &tx->work, delay);
 	}
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-24 13:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 13:32 [PATCH net] tipc: compute the rekeying delay without wrapping Kyuwon Cho

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