On Fri, Dec 04, 2026 at 06:22 PM Paul Moses <…@1g4.org> wrote:
> Yes, the refcount bug is independent. My concern is that patch 2 clears CA state
> already initialized by the hook.
>
> unpatched (#14): init=1 release=1
> all patches without [2]: init=2 release=1
> all patches with [2]: init=1 release=1
>
> Without [2], the child's CA is initialized twice without a release in between.
Yes. ->init() runs twice. It's harmless.
The second ->init() starts from zeroed icsk_ca_priv, like the first one.
Rows 1 and 2 have a real bug. They leak a reference on ca_count.
The lsm prog takes one. tcp_ca_openreq_child() takes one more, because
icsk_ca_setsockopt == 1. close() puts one.
So this prog needs [2] with and without patch 2.
> I can move the reset before the hook instead and drop the backport prereq note,
> but I feel like we're making this more complicated than it needs to be.
Pls don't move it. Without [2] the moved reset misses this case:
inet_csk_clone_lock()
reset
lsm prog: bpf_setsockopt("vegas") tcp_vegas_init()
icsk_ca_initialized = 1
tcp_ca_openreq_child() route has "congctl cdg"
icsk_ca_ops = cdg
tcp_init_transfer() skips tcp_cdg_init()
cdg sees ca->gradients == 0x7fffffff7fffffff again.
The reset in tcp_ca_openreq_child() covers it with and without [2].
Keep patch 2 as-is. Drop the note only.