Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.70.43.23 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796189893; b=tUyCG/S09XuABVas/Ewu1R1lQFLdT3E/qMgnfE/3sFadxiNMGAJFcR1skai7j9fkjKl3 xwtpMm0UJOU+D5VEeds8GUAxpeahIeuItdh784I7Mk1Z8bWOVUHl5lYDdJwHk3jby3tgZ RnXZ/BNKSKZ+0swRSRE9KxPVgO/vuv8w5RworV8O5IATCDUE6p2VKa+oY2c+HP4VK6sHU JM+I24PCcYcBGjkvlTrL8P8HJnek9zFtHjG0ANKQXrR/K2mpFE8zcmphqSBLG5ztEfHaC k+YMNYFx9ysvK32yC7mcCNgonDJ67W9DcdNz4jk7IX5FHrjq3z+gGs7qen7WXWkTPCA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796189893; h=DMARC-Filter:DKIM-Signature:Date:To:From:Cc:Subject:Message-ID: Feedback-ID:X-Pm-Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=pCmaDa4vJgZNTlDcGsf/2RK+XSvcIZa8/Pm5ItbEXr4=; b=B06pwSV4TuVr5EjQoTAwxrPVEWqQ74dPStKKYLTU5/zWL98mRZnc3Dt3EgJlzby6fqP7 fUPmrS2VnIEl2WZv+siR1E0idoAls7E4enuxZIIaObZt4MwsX3xYvWWwSjoqb0zce4ZsQ Crx0LSZKjeZ1rwxxP+TzKRoNbIqHZwu0Y4FmohL4UOpy7RwDgAyFIeMu8ayUCGr+UaX3Y zaANaEX7DmCvvST30dKtpPTkYitoNGG1f3OI8xiOGSAObTh6mYJFRuthbYVWO0OwqgdYL 8ds5pxJX2AUhgJ0cNFDfpRhn3aZ98yoQ9SeklTC28JRKPYcWFODeyZF6+MBX1hPBj4g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=1g4.org; spf=pass smtp.mailfrom=1g4.org; dkim=pass header.d=1g4.org header.i=@1g4.org header.a=rsa-sha256 header.s=protonmail header.b=IZWTJ5UM; arc=none smtp.remote-ip=185.70.43.23 Received: from mail-4323.protonmail.ch (mail-4323.protonmail.ch [185.70.43.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9596A606A32A for ; Wed, 2 Dec 2026 05:38:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9596A606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=1g4.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=1g4.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=1g4.org header.i=@1g4.org header.a=rsa-sha256 header.s=protonmail header.b=IZWTJ5UM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1g4.org; s=protonmail; t=1796189887; x=1796449087; bh=pCmaDa4vJgZNTlDcGsf/2RK+XSvcIZa8/Pm5ItbEXr4=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=IZWTJ5UMGuehIlQvzxij125V1jv75hpXqqixMwrKH1yXL3c5ckFPk/5evsQxF8kre 902BuG8aJ+rgAjBCVhm0oAVwfj0LcdaoIHjrD4AJohTqQiQFxUpgm0IXgDYUU9TyXU M7agjcDC5gZHtsfByEH1YUNt0bEMmQFhp2zPIO6M0w9inopjQZrRZ4ByVyhJxoNHwb a6HMAkXvRZIH9BUF3XJYl7fYfCthi/84Ene6IE6uTBMGngd1OVtFPv8wgnTJUcMf+A QVBBzKqYz9JGwMkjVyp9XyoxHKPeMRFuin6DiGBsYQIpg8mFtjmC726z4s3Kdr1YYD +P93Z2IuGHkVg== Date: Wed, 02 Dec 2026 05:38:01 +0000 To: bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi From: Paul Moses Cc: Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Ihor Solodrai , Kui-Feng Lee , Paul Moses , stable@vger.kernel.org Subject: [PATCH bpf] bpf: Skip same map struct_ops link updates Message-ID: <20261202053703.938201-1-p@1g4.org> Feedback-ID: 8253658:user:proton X-Pm-Message-ID: 4d183b76233bf73e5f75892b8b2c5adfa298d986 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable bpf_struct_ops_map_link_update() invokes the subsystem update callback even when the link already uses the new map. For TCP congestion control, tcp_update_congestion_control() then adds and removes the same list entry, which can corrupt tcp_cong_list. Skip the callback when the maps are identical. Fixes: aef56f2e918b ("bpf: Update the struct_ops of a bpf_link.") Cc: stable@vger.kernel.org Signed-off-by: Paul Moses --- CAP_BPF/CAP_PERFMON required. --- list_del corruption, ffff000001e82a78->prev is LIST_POISON2 (dead0000000001= 22) WARNING: lib/list_debug.c:61 at __list_del_entry_valid_or_report+0x100/0x15= 4, CPU#1: fun2/47 CPU: 1 UID: 1000 PID: 47 Comm: fun2 Not tainted 7.4.0-rc4 #1 PREEMPT=20 Hardware name: linux,dummy-virt (DT) pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : __list_del_entry_valid_or_report+0x100/0x154 lr : __list_del_entry_valid_or_report+0xfc/0x154 sp : ffff800080ef3cf0 x29: ffff800080ef3cf0 x28: ffff0000011e6200 x27: 0000000000000000 x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000 x23: 00000000020a0001 x22: dead000000000122 x21: dead000000000122 x20: ffff800080c158c0 x19: ffff000001e82a78 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 000000000000009c x13: 0000000000000003 x12: ffff80003ee6e000 x11: ffff0000bf9cc508 x10: 0000000000000001 x9 : ffff800080b86cd0 x8 : 0000000100000001 x7 : 505f5453494c2073 x6 : 0000000000000029 x5 : ffff800080c3bd8f x4 : 0000000000000000 x3 : ffff800080ef3988 x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000 Call trace: __list_del_entry_valid_or_report+0x100/0x154 (P) tcp_unregister_congestion_control+0x24/0x5c bpf_tcp_ca_unreg+0xc/0x14 bpf_struct_ops_map_link_dealloc+0x30/0x4c bpf_link_dealloc+0x34/0x40 bpf_link_free+0xb0/0xbc bpf_link_put_direct+0x20/0x4c bpf_link_release+0x10/0x1c __fput+0x50/0x1cc fput_close_sync+0x38/0xec __arm64_sys_close+0x34/0x70 do_el0_svc+0x88/0xcc el0_svc+0x20/0x54 el0t_64_sync_handler+0x40/0xfc el0t_64_sync+0x154/0x158 =20 ... =20 Unable to handle kernel NULL pointer dereference at virtual address 0000000= 000000000 Mem abort info: ESR =3D 0x0000000086000006 EC =3D 0x21: IABT (current EL), IL =3D 32 bits SET =3D 0, FnV =3D 0 EA =3D 0, S1PTW =3D 0 FSC =3D 0x06: level 2 translation fault user pgtable: 4k pages, 48-bit VAs, pgdp=3D00000000412cf000 [0000000000000000] pgd=3D0800000041ec8403, p4d=3D0800000041ec8403, pud=3D08= 00000041ec9403, pmd=3D0000000000000000 Internal error: Oops: 0000000086000006 [#1] SMP CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Tainted: G W 7.4.0-rc= 4 #1 PREEMPT=20 Tainted: [W]=3DWARN Hardware name: linux,dummy-virt (DT) pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : 0x0 lr : tcp_enter_loss+0x16c/0x2dc sp : ffff800080cc3dc0 x29: ffff800080cc3dc0 x28: ffff800080cc3eb8 x27: 0000000000000000 x26: dead000000000122 x25: 000000000000001b x24: 0000000000000000 x23: ffff0000012981c0 x22: ffff800080c95b00 x21: 0000000000000060 x20: 0000000000000000 x19: ffff000001efd340 x18: 000000008cf6d33d x17: 000000009de3d1c8 x16: 0000000037b1d58d x15: 000000001f98cc76 x14: 00000000fd3a0fac x13: 00000000b211991d x12: 00000000c73d125d x11: 000000009518c73b x10: 0000000000000007 x9 : ffff000001e82a00 x8 : 0000000000000000 x7 : 00000000e1575f02 x6 : 00000000bde17e00 x5 : 000000000d8e05e2 x4 : 0000000077937876 x3 : 0000000037f0c725 x2 : 00000000863de794 x1 : ffff0000012981f0 x0 : ffff000001efd340 Call trace: 0x0 (P) tcp_retransmit_timer+0x600/0x860 tcp_write_timer_handler+0xf4/0x1e0 tcp_write_timer+0x78/0x130 call_timer_fn+0x20/0x80 run_timer_softirq+0x290/0x2f4 handle_softirqs+0x10c/0x250 __do_softirq+0x10/0x18 ____do_softirq+0xc/0x14 call_on_irq_stack+0x30/0x4c do_softirq_own_stack+0x18/0x20 irq_exit_rcu+0x40/0xc0 el1_interrupt+0x3c/0x58 el1h_64_irq_handler+0x14/0x1c el1h_64_irq+0x78/0x7c default_idle_call+0x20/0x28 (P) do_idle+0x5c/0xb4 cpu_startup_entry+0x30/0x34 secondary_start_kernel+0x128/0x148 __secondary_switched+0x74/0x78 --- kernel/bpf/bpf_struct_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c index 5461e0ebab2b..0985854d169a 100644 --- a/kernel/bpf/bpf_struct_ops.c +++ b/kernel/bpf/bpf_struct_ops.c @@ -1409,7 +1409,7 @@ static int bpf_struct_ops_map_link_update(struct bpf_= link *link, struct bpf_map =09mutex_lock(&update_mutex); =09old_map =3D st_link->map; =09err =3D bpf_struct_ops_link_update_check(new_map, old_map, expected_old= _map); -=09if (err) +=09if (err || new_map =3D=3D old_map) =09=09goto err_out; =20 =09old_st_map =3D container_of(old_map, struct bpf_struct_ops_map, map); --=20 2.56.0.lol.gf7de81456940