Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Kyuwon Cho
Tue, 24 Nov 2026 13:32
[PATCH net] tipc: compute the rekeying delay without wrapping
Author: Kyuwon Cho
Date: Tue, 24 Nov 2026 13:32
Date: Tue, 24 Nov 2026 13:32
58 lines
12774 bytes
12774 bytes
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
RE: [PATCH net] tipc: compute the rekeying delay without wrapping
Author: Tung Quang Nguyen
Date: Thu, 26 Nov 2026 07:44
Date: Thu, 26 Nov 2026 07:44
67 lines
19463 bytes
19463 bytes
>Subject: [PATCH net] tipc: compute the rekeying delay without wrapping
>
>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
Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
Re: [PATCH net] tipc: compute the rekeying delay without wrapping
Author: patchwork-bot+netdevbpf
Date: Mon, 30 Nov 2026 03:50
Date: Mon, 30 Nov 2026 03:50
29 lines
8927 bytes
8927 bytes
Hello:
This patch was applied to netdev/net.git (main)
by Willem de Bruijn <willemb@google.com>:
On Tue, 24 Nov 2026 22:32:16 +0900 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net] tipc: compute the rekeying delay without wrapping
https://git.kernel.org/netdev/net/c/e2fb9368a416
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads