syzbot


KASAN: use-after-free Read in ila_nf_input

Status: upstream: reported on 2024/10/20 21:26
Reported-by: syzbot+e2cde7a686ef71f77d60@syzkaller.appspotmail.com
First crash: 61d, last: 61d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ila_nf_input net 43 1910d 2166d 0/28 auto-closed as invalid on 2020/01/27 14:15
upstream KASAN: use-after-free Read in ila_nf_input (2) net 14 63d 112d 28/28 fixed on 2024/10/22 15:46

Sample crash report:
==================================================================
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+0x733/0x960 include/linux/rhashtable.h:664
Read of size 4 at addr ffff888068338008 by task ksoftirqd/1/20

CPU: 1 PID: 20 Comm: ksoftirqd/1 Not tainted 5.15.168-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 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+0x733/0x960 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:654 [inline]
 ila_nf_input+0x1d0/0x370 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:584
 nf_hook include/linux/netfilter.h:257 [inline]
 NF_HOOK+0x26b/0x410 include/linux/netfilter.h:300
 __netif_receive_skb_one_core net/core/dev.c:5489 [inline]
 __netif_receive_skb+0x1c6/0x530 net/core/dev.c:5603
 process_backlog+0x363/0x7f0 net/core/dev.c:6480
 __napi_poll+0xc7/0x440 net/core/dev.c:7039
 napi_poll net/core/dev.c:7106 [inline]
 net_rx_action+0x617/0xda0 net/core/dev.c:7196
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:925
 smpboot_thread_fn+0x51b/0x9d0 kernel/smpboot.c:164
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 7378:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 kobject_uevent_env+0x283/0x8d0 lib/kobject_uevent.c:539
 netdev_queue_add_kobject net/core/net-sysfs.c:1677 [inline]
 netdev_queue_update_kobjects+0x1c1/0x3f0 net/core/net-sysfs.c:1711
 register_queue_kobjects net/core/net-sysfs.c:1772 [inline]
 netdev_register_kobject+0x263/0x310 net/core/net-sysfs.c:2018
 register_netdevice+0x108c/0x1720 net/core/dev.c:10361
 __rtnl_newlink net/core/rtnetlink.c:3521 [inline]
 rtnl_newlink+0x14e1/0x2070 net/core/rtnetlink.c:3569
 rtnetlink_rcv_msg+0x993/0xee0 net/core/rtnetlink.c:5647
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2504
 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
 netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1352
 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1920
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 __sys_sendto+0x564/0x720 net/socket.c:2063
 __do_sys_sendto net/socket.c:2075 [inline]
 __se_sys_sendto net/socket.c:2071 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2071
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 7378:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xf1/0x270 mm/slub.c:4559
 kobject_uevent_env+0x36a/0x8d0 lib/kobject_uevent.c:641
 netdev_queue_add_kobject net/core/net-sysfs.c:1677 [inline]
 netdev_queue_update_kobjects+0x1c1/0x3f0 net/core/net-sysfs.c:1711
 register_queue_kobjects net/core/net-sysfs.c:1772 [inline]
 netdev_register_kobject+0x263/0x310 net/core/net-sysfs.c:2018
 register_netdevice+0x108c/0x1720 net/core/dev.c:10361
 __rtnl_newlink net/core/rtnetlink.c:3521 [inline]
 rtnl_newlink+0x14e1/0x2070 net/core/rtnetlink.c:3569
 rtnetlink_rcv_msg+0x993/0xee0 net/core/rtnetlink.c:5647
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2504
 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
 netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1352
 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1920
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 __sys_sendto+0x564/0x720 net/socket.c:2063
 __do_sys_sendto net/socket.c:2075 [inline]
 __se_sys_sendto net/socket.c:2071 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2071
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888068338000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 8 bytes inside of
 4096-byte region [ffff888068338000, ffff888068339000)
The buggy address belongs to the page:
page:ffffea0001a0ce00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x68338
head:ffffea0001a0ce00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888017042140
raw: 0000000000000000 0000000000040004 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 7378, ts 349174821986, free_ts 349121107264
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc_trace+0x1a0/0x290 mm/slub.c:3245
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 kobject_uevent_env+0x283/0x8d0 lib/kobject_uevent.c:539
 netdev_queue_add_kobject net/core/net-sysfs.c:1677 [inline]
 netdev_queue_update_kobjects+0x1c1/0x3f0 net/core/net-sysfs.c:1711
 register_queue_kobjects net/core/net-sysfs.c:1772 [inline]
 netdev_register_kobject+0x263/0x310 net/core/net-sysfs.c:2018
 register_netdevice+0x108c/0x1720 net/core/dev.c:10361
 __rtnl_newlink net/core/rtnetlink.c:3521 [inline]
 rtnl_newlink+0x14e1/0x2070 net/core/rtnetlink.c:3569
 rtnetlink_rcv_msg+0x993/0xee0 net/core/rtnetlink.c:5647
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2504
 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
 netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1352
 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1920
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 __sys_sendto+0x564/0x720 net/socket.c:2063
 __do_sys_sendto net/socket.c:2075 [inline]
 __se_sys_sendto net/socket.c:2071 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2071
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_nonslab_page+0xe4/0x150 mm/slub.c:3535
 kfree+0x1cf/0x270 mm/slub.c:4556
 rhashtable_free_and_destroy+0x7ae/0x900 lib/rhashtable.c:1159
 ila_xlat_exit_net+0x4b/0xa0 net/ipv6/ila/ila_xlat.c:632
 ops_exit_list net/core/net_namespace.c:172 [inline]
 cleanup_net+0x6ce/0xb60 net/core/net_namespace.c:599
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
 ffff888068337f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888068337f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888068338000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff888068338080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888068338100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
================================================================================
UBSAN: shift-out-of-bounds in lib/rhashtable.c:1179:32
shift exponent 4294936704 is too large for 32-bit type 'unsigned int'
CPU: 1 PID: 20 Comm: ksoftirqd/1 Tainted: G    B             5.15.168-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 ubsan_epilogue lib/ubsan.c:151 [inline]
 __ubsan_handle_shift_out_of_bounds+0x3bf/0x420 lib/ubsan.c:321
 __rht_bucket_nested+0x631/0x640 lib/rhashtable.c:1179
 rht_bucket_nested+0x37/0x50 lib/rhashtable.c:1210
 rht_bucket include/linux/rhashtable.h:289 [inline]
 __rhashtable_lookup include/linux/rhashtable.h:597 [inline]
 rhashtable_lookup include/linux/rhashtable.h:638 [inline]
 rhashtable_lookup_fast+0x710/0x960 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:654 [inline]
 ila_nf_input+0x1d0/0x370 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:584
 nf_hook include/linux/netfilter.h:257 [inline]
 NF_HOOK+0x26b/0x410 include/linux/netfilter.h:300
 __netif_receive_skb_one_core net/core/dev.c:5489 [inline]
 __netif_receive_skb+0x1c6/0x530 net/core/dev.c:5603
 process_backlog+0x363/0x7f0 net/core/dev.c:6480
 __napi_poll+0xc7/0x440 net/core/dev.c:7039
 napi_poll net/core/dev.c:7106 [inline]
 net_rx_action+0x617/0xda0 net/core/dev.c:7196
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:925
 smpboot_thread_fn+0x51b/0x9d0 kernel/smpboot.c:164
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/20 21:26 linux-5.15.y 584a40a22cb9 cd6fc0a3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ila_nf_input
* Struck through repros no longer work on HEAD.