Eric Dumazet
17e8fa8943
ila: serialize calls to nf_register_net_hooks()
[ Upstream commit 260466b576bca0081a7d4acecc8e93687aa22d0e ]
syzbot found a race in ila_add_mapping() [1]
commit 031ae72825ce ("ila: call nf_unregister_net_hooks() sooner")
attempted to fix a similar issue.
Looking at the syzbot repro, we have concurrent ILA_CMD_ADD commands.
Add a mutex to make sure at most one thread is calling nf_register_net_hooks().
[1]
BUG: KASAN: slab-use-after-free in rht_key_hashfn include/linux/rhashtable.h:159 [inline]
BUG: KASAN: slab-use-after-free in __rhashtable_lookup.constprop.0+0x426/0x550 include/linux/rhashtable.h:604
Read of size 4 at addr ffff888028f40008 by task dhcpcd/5501
CPU: 1 UID: 0 PID: 5501 Comm: dhcpcd Not tainted 6.13.0-rc4-syzkaller-00054-gd6ef8b40d075 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xc3/0x620 mm/kasan/report.c:489
kasan_report+0xd9/0x110 mm/kasan/report.c:602
rht_key_hashfn include/linux/rhashtable.h:159 [inline]
__rhashtable_lookup.constprop.0+0x426/0x550 include/linux/rhashtable.h:604
rhashtable_lookup include/linux/rhashtable.h:646 [inline]
rhashtable_lookup_fast include/linux/rhashtable.h:672 [inline]
ila_lookup_wildcards net/ipv6/ila/ila_xlat.c:127 [inline]
ila_xlat_addr net/ipv6/ila/ila_xlat.c:652 [inline]
ila_nf_input+0x1ee/0x620 net/ipv6/ila/ila_xlat.c:185
nf_hook_entry_hookfn include/linux/netfilter.h:154 [inline]
nf_hook_slow+0xbb/0x200 net/netfilter/core.c:626
nf_hook.constprop.0+0x42e/0x750 include/linux/netfilter.h:269
NF_HOOK include/linux/netfilter.h:312 [inline]
ipv6_rcv+0xa4/0x680 net/ipv6/ip6_input.c:309
__netif_receive_skb_one_core+0x12e/0x1e0 net/core/dev.c:5672
__netif_receive_skb+0x1d/0x160 net/core/dev.c:5785
process_backlog+0x443/0x15f0 net/core/dev.c:6117
__napi_poll.constprop.0+0xb7/0x550 net/core/dev.c:6883
napi_poll net/core/dev.c:6952 [inline]
net_rx_action+0xa94/0x1010 net/core/dev.c:7074
handle_softirqs+0x213/0x8f0 kernel/softirq.c:561
__do_softirq kernel/softirq.c:595 [inline]
invoke_softirq kernel/softirq.c:435 [inline]
__irq_exit_rcu+0x109/0x170 kernel/softirq.c:662
irq_exit_rcu+0x9/0x30 kernel/softirq.c:678
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline]
sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049
Fixes: 7f00feaf10 ("ila: Add generic ILA translation facility")
Reported-by: syzbot+47e761d22ecf745f72b9@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6772c9ae.050a0220.2f3838.04c7.GAE@google.com/T/#u
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Tom Herbert <tom@herbertland.com>
Link: https://patch.msgid.link/20241230162849.2795486-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-01-09 13:32:03 +01:00
..
2025-01-09 13:32:03 +01:00
2024-11-08 16:28:19 +01:00
2024-02-05 20:14:36 +00:00
2024-12-09 10:32:33 +01:00
2022-11-07 12:26:15 +00:00
2024-12-14 20:00:04 +01:00
2023-02-13 18:35:15 +08:00
2023-07-28 11:01:56 +01:00
2023-08-16 11:09:16 +01:00
2023-06-22 18:40:38 -07:00
2024-08-03 08:53:36 +02:00
2023-05-24 08:43:39 +01:00
2024-03-01 13:35:10 +01:00
2024-05-17 12:02:23 +02:00
2024-12-14 19:59:35 +01:00
2023-03-17 08:25:05 +00:00
2023-07-31 13:53:10 -07:00
2024-06-21 14:38:15 +02:00
2022-08-29 12:47:15 +01:00
2024-12-09 10:32:10 +01:00
2023-03-21 21:32:18 -07:00
2024-04-13 13:07:30 +02:00
2024-05-17 12:02:24 +02:00
2024-05-17 12:02:07 +02:00
2024-12-14 19:59:35 +01:00
2024-08-29 17:33:47 +02:00
2024-04-13 13:07:30 +02:00
2024-12-14 19:59:35 +01:00
2022-09-29 07:18:00 +02:00
2024-12-09 10:32:10 +01:00
2024-10-04 16:29:41 +02:00
2024-04-03 15:28:39 +02:00
2022-09-29 07:18:01 +02:00
2024-12-14 19:59:35 +01:00
2022-05-16 13:03:29 +02:00
2022-11-18 02:15:22 +01:00
2024-12-14 19:59:35 +01:00
2024-04-03 15:28:39 +02:00
2024-12-14 19:59:35 +01:00
2024-06-12 11:11:51 +02:00
2024-12-14 19:59:35 +01:00
2024-10-04 16:28:59 +02:00
2023-06-19 11:32:58 -07:00
2024-06-12 11:12:48 +02:00
2024-06-21 14:38:16 +02:00
2024-06-27 13:49:08 +02:00
2024-06-12 11:11:53 +02:00
2024-04-13 13:07:30 +02:00
2024-08-11 12:47:19 +02:00
2023-08-15 15:26:18 -07:00
2024-12-14 19:59:35 +01:00
2023-05-31 09:50:17 +01:00
2022-10-12 17:50:37 -07:00
2024-05-17 12:02:07 +02:00
2024-12-14 19:59:35 +01:00
2023-11-20 11:58:56 +01:00
2024-05-17 12:02:20 +02:00
2022-03-01 12:08:40 +01:00
2024-12-14 19:59:35 +01:00
2022-09-29 07:18:00 +02:00