Netdev List
 help / color / mirror / Atom feed
From: Kyuwon Cho <kyuwoncho18@gmail.com>
To: Jon Maloy <jmaloy@redhat.com>,
	Tung Quang Nguyen <tung.quang.nguyen@est.tech>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	Tuong Lien <tuong.t.lien@dektech.com.au>,
	netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net
Subject: [PATCH net] tipc: compute the rekeying delay without wrapping
Date: Tue, 24 Nov 2026 22:32:16 +0900	[thread overview]
Message-ID: <179552107131.1345245.11261172891282782083@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-24 13:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179552107131.1345245.11261172891282782083@gmail.com \
    --to=kyuwoncho18@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jmaloy@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tipc-discussion@lists.sourceforge.net \
    --cc=tung.quang.nguyen@est.tech \
    --cc=tuong.t.lien@dektech.com.au \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox