[v6.1] KASAN: use-after-free Read in rhashtable_lookup_fast

1 view
Skip to first unread message

syzbot

unread,
May 20, 2024, 11:02:28 AMMay 20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 4078fa637fcd Linux 6.1.91
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1262c88a980000
kernel config: https://syzkaller.appspot.com/x/.config?x=715ba80acfd3def4
dashboard link: https://syzkaller.appspot.com/bug?extid=68e35b98db5869f9664c
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/20c616b95c1f/disk-4078fa63.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/78c98fa5c5a9/vmlinux-4078fa63.xz
kernel image: https://storage.googleapis.com/syzbot-assets/5dcdafdbe940/bzImage-4078fa63.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+68e35b...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in rht_key_hashfn include/linux/rhashtable.h:159 [inline]
BUG: KASAN: use-after-free in __rhashtable_lookup include/linux/rhashtable.h:596 [inline]
BUG: KASAN: use-after-free in rhashtable_lookup include/linux/rhashtable.h:638 [inline]
BUG: KASAN: use-after-free in rhashtable_lookup_fast+0x770/0x9a0 include/linux/rhashtable.h:664
Read of size 4 at addr ffff88805c798008 by task kworker/0:1/14

CPU: 0 PID: 14 Comm: kworker/0:1 Not tainted 6.1.91-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Workqueue: mld mld_dad_work
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:395
kasan_report+0x136/0x160 mm/kasan/report.c:495
rht_key_hashfn include/linux/rhashtable.h:159 [inline]
__rhashtable_lookup include/linux/rhashtable.h:596 [inline]
rhashtable_lookup include/linux/rhashtable.h:638 [inline]
rhashtable_lookup_fast+0x770/0x9a0 include/linux/rhashtable.h:664
ila_lookup_wildcards net/ipv6/ila/ila_xlat.c:133 [inline]
ila_xlat_addr net/ipv6/ila/ila_xlat.c:653 [inline]
ila_nf_input+0x1f5/0x3b0 net/ipv6/ila/ila_xlat.c:191
nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
nf_hook_slow+0xae/0x1e0 net/netfilter/core.c:614
nf_hook include/linux/netfilter.h:257 [inline]
NF_HOOK+0x29a/0x450 include/linux/netfilter.h:300
__netif_receive_skb_one_core net/core/dev.c:5528 [inline]
__netif_receive_skb+0x1c6/0x530 net/core/dev.c:5642
process_backlog+0x381/0x760 net/core/dev.c:5970
__napi_poll+0xc7/0x470 net/core/dev.c:6537
napi_poll net/core/dev.c:6604 [inline]
net_rx_action+0x70f/0xeb0 net/core/dev.c:6718
__do_softirq+0x2e9/0xa4c kernel/softirq.c:571
do_softirq+0x162/0x240 kernel/softirq.c:472
</IRQ>
<TASK>
__local_bh_enable_ip+0x1b1/0x1f0 kernel/softirq.c:396
local_bh_enable include/linux/bottom_half.h:33 [inline]
rcu_read_unlock_bh include/linux/rcupdate.h:861 [inline]
__dev_queue_xmit+0x1790/0x3cf0 net/core/dev.c:4320
dev_queue_xmit include/linux/netdevice.h:3021 [inline]
neigh_hh_output include/net/neighbour.h:528 [inline]
neigh_output include/net/neighbour.h:542 [inline]
ip6_finish_output2+0xea9/0x1530 net/ipv6/ip6_output.c:134
__ip6_finish_output net/ipv6/ip6_output.c:201 [inline]
ip6_finish_output+0x6a0/0xa80 net/ipv6/ip6_output.c:212
dst_output include/net/dst.h:444 [inline]
NF_HOOK+0x167/0x530 include/linux/netfilter.h:302
mld_sendpack+0x85e/0xde0 net/ipv6/mcast.c:1820
mld_dad_work+0x40/0x400 net/ipv6/mcast.c:2262
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
</TASK>

Allocated by task 62:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slab_common.c:955 [inline]
__kmalloc_node_track_caller+0xb1/0x220 mm/slab_common.c:975
kmalloc_reserve net/core/skbuff.c:446 [inline]
__alloc_skb+0x135/0x670 net/core/skbuff.c:515
alloc_skb include/linux/skbuff.h:1271 [inline]
nlmsg_new include/net/netlink.h:991 [inline]
inet6_rt_notify+0xdc/0x280 net/ipv6/route.c:6167
fib6_del_route net/ipv6/ip6_fib.c:1993 [inline]
fib6_del+0x109b/0x1570 net/ipv6/ip6_fib.c:2028
fib6_clean_node+0x2ed/0x5d0 net/ipv6/ip6_fib.c:2190
fib6_walk_continue+0x636/0x8c0 net/ipv6/ip6_fib.c:2112
fib6_walk+0x168/0x2b0 net/ipv6/ip6_fib.c:2160
fib6_clean_tree net/ipv6/ip6_fib.c:2240 [inline]
__fib6_clean_all+0x31b/0x4b0 net/ipv6/ip6_fib.c:2256
rt6_sync_down_dev net/ipv6/route.c:4895 [inline]
rt6_disable_ip+0x14c/0x890 net/ipv6/route.c:4900
addrconf_ifdown+0x154/0x1b90 net/ipv6/addrconf.c:3781
addrconf_notify+0x3ec/0xf60
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
call_netdevice_notifiers_info net/core/dev.c:1970 [inline]
call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
call_netdevice_notifiers net/core/dev.c:2022 [inline]
dev_close_many+0x37c/0x530 net/core/dev.c:1570
unregister_netdevice_many+0x4f7/0x17a0 net/core/dev.c:10855
xfrmi_exit_batch_net+0x30b/0x350 net/xfrm/xfrm_interface_core.c:973
ops_exit_list net/core/net_namespace.c:177 [inline]
cleanup_net+0x763/0xb60 net/core/net_namespace.c:604
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Freed by task 62:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
__kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
skb_free_head net/core/skbuff.c:762 [inline]
skb_release_data+0x5de/0x7a0 net/core/skbuff.c:791
skb_release_all net/core/skbuff.c:856 [inline]
__kfree_skb net/core/skbuff.c:870 [inline]
consume_skb+0xa3/0x140 net/core/skbuff.c:1035
netlink_broadcast+0xf8b/0x10b0 net/netlink/af_netlink.c:1523
nlmsg_multicast include/net/netlink.h:1071 [inline]
nlmsg_notify+0xfb/0x1c0 net/netlink/af_netlink.c:2551
fib6_del_route net/ipv6/ip6_fib.c:1993 [inline]
fib6_del+0x109b/0x1570 net/ipv6/ip6_fib.c:2028
fib6_clean_node+0x2ed/0x5d0 net/ipv6/ip6_fib.c:2190
fib6_walk_continue+0x636/0x8c0 net/ipv6/ip6_fib.c:2112
fib6_walk+0x168/0x2b0 net/ipv6/ip6_fib.c:2160
fib6_clean_tree net/ipv6/ip6_fib.c:2240 [inline]
__fib6_clean_all+0x31b/0x4b0 net/ipv6/ip6_fib.c:2256
rt6_sync_down_dev net/ipv6/route.c:4895 [inline]
rt6_disable_ip+0x14c/0x890 net/ipv6/route.c:4900
addrconf_ifdown+0x154/0x1b90 net/ipv6/addrconf.c:3781
addrconf_notify+0x3ec/0xf60
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
call_netdevice_notifiers_info net/core/dev.c:1970 [inline]
call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
call_netdevice_notifiers net/core/dev.c:2022 [inline]
dev_close_many+0x37c/0x530 net/core/dev.c:1570
unregister_netdevice_many+0x4f7/0x17a0 net/core/dev.c:10855
xfrmi_exit_batch_net+0x30b/0x350 net/xfrm/xfrm_interface_core.c:973
ops_exit_list net/core/net_namespace.c:177 [inline]
cleanup_net+0x763/0xb60 net/core/net_namespace.c:604
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

The buggy address belongs to the object at ffff88805c798000
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 8 bytes inside of
1024-byte region [ffff88805c798000, ffff88805c798400)

The buggy address belongs to the physical page:
page:ffffea000171e600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5c798
head:ffffea000171e600 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888012441dc0
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 62, tgid 62 (kworker/u4:4), ts 125282477034, free_ts 125281425461
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
prep_new_page mm/page_alloc.c:2520 [inline]
get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5547
alloc_slab_page+0x6a/0x150 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x84/0x2d0 mm/slub.c:1992
___slab_alloc+0xc20/0x1270 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:954 [inline]
__kmalloc_node_track_caller+0xa0/0x220 mm/slab_common.c:975
kmalloc_reserve net/core/skbuff.c:446 [inline]
__alloc_skb+0x135/0x670 net/core/skbuff.c:515
alloc_skb include/linux/skbuff.h:1271 [inline]
nlmsg_new include/net/netlink.h:991 [inline]
inet6_rt_notify+0xdc/0x280 net/ipv6/route.c:6167
fib6_del_route net/ipv6/ip6_fib.c:1993 [inline]
fib6_del+0x109b/0x1570 net/ipv6/ip6_fib.c:2028
fib6_clean_node+0x2ed/0x5d0 net/ipv6/ip6_fib.c:2190
fib6_walk_continue+0x636/0x8c0 net/ipv6/ip6_fib.c:2112
fib6_walk+0x168/0x2b0 net/ipv6/ip6_fib.c:2160
fib6_clean_tree net/ipv6/ip6_fib.c:2240 [inline]
__fib6_clean_all+0x31b/0x4b0 net/ipv6/ip6_fib.c:2256
rt6_sync_down_dev net/ipv6/route.c:4895 [inline]
rt6_disable_ip+0x14c/0x890 net/ipv6/route.c:4900
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1440 [inline]
free_pcp_prepare mm/page_alloc.c:1490 [inline]
free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358
free_unref_page+0x33/0x3e0 mm/page_alloc.c:3453
free_large_kmalloc+0xfb/0x190 mm/slab_common.c:932
rhashtable_free_and_destroy+0x7ae/0x900 lib/rhashtable.c:1159
ila_xlat_exit_net+0x51/0x100 net/ipv6/ila/ila_xlat.c:627
ops_exit_list net/core/net_namespace.c:172 [inline]
cleanup_net+0x6ce/0xb60 net/core/net_namespace.c:604
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Memory state around the buggy address:
ffff88805c797f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88805c797f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88805c798000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88805c798080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805c798100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages