In the Linux kernel, the following vulnerability has been resolved:
ila: serialize calls to nfregisternet_hooks()
syzbot found a race in ilaaddmapping() [1]
commit 031ae72825ce ("ila: call nfunregisternet_hooks() sooner") attempted to fix a similar issue.
Looking at the syzbot repro, we have concurrent ILACMDADD commands.
Add a mutex to make sure at most one thread is calling nfregisternet_hooks().
[1] BUG: KASAN: slab-use-after-free in rhtkeyhashfn include/linux/rhashtable.h:159 [inline] BUG: KASAN: slab-use-after-free in _rhashtablelookup.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> _dumpstack lib/dumpstack.c:94 [inline] dumpstacklvl+0x116/0x1f0 lib/dumpstack.c:120 printaddressdescription mm/kasan/report.c:378 [inline] printreport+0xc3/0x620 mm/kasan/report.c:489 kasanreport+0xd9/0x110 mm/kasan/report.c:602 rhtkeyhashfn include/linux/rhashtable.h:159 [inline] _rhashtablelookup.constprop.0+0x426/0x550 include/linux/rhashtable.h:604 rhashtablelookup include/linux/rhashtable.h:646 [inline] rhashtablelookupfast include/linux/rhashtable.h:672 [inline] ilalookupwildcards net/ipv6/ila/ilaxlat.c:127 [inline] ilaxlataddr net/ipv6/ila/ilaxlat.c:652 [inline] ilanfinput+0x1ee/0x620 net/ipv6/ila/ilaxlat.c:185 nfhookentryhookfn include/linux/netfilter.h:154 [inline] nfhookslow+0xbb/0x200 net/netfilter/core.c:626 nfhook.constprop.0+0x42e/0x750 include/linux/netfilter.h:269 NFHOOK include/linux/netfilter.h:312 [inline] ipv6rcv+0xa4/0x680 net/ipv6/ip6input.c:309 _netifreceiveskbonecore+0x12e/0x1e0 net/core/dev.c:5672 _netifreceiveskb+0x1d/0x160 net/core/dev.c:5785 processbacklog+0x443/0x15f0 net/core/dev.c:6117 _napipoll.constprop.0+0xb7/0x550 net/core/dev.c:6883 napipoll net/core/dev.c:6952 [inline] netrxaction+0xa94/0x1010 net/core/dev.c:7074 handlesoftirqs+0x213/0x8f0 kernel/softirq.c:561 _dosoftirq kernel/softirq.c:595 [inline] invokesoftirq kernel/softirq.c:435 [inline] _irqexitrcu+0x109/0x170 kernel/softirq.c:662 irqexitrcu+0x9/0x30 kernel/softirq.c:678 instrsysvecapictimerinterrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvecapictimer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049