syzbot


KASAN: use-after-free Read in rose_get_neigh

Status: upstream: reported on 2024/07/31 20:40
Reported-by: syzbot+80b7a2fca6515eb551e0@syzkaller.appspotmail.com
First crash: 76d, last: 76d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in rose_get_neigh hams 26 26d 126d 0/28 upstream: reported on 2024/06/11 06:56

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in rose_get_neigh+0x1b2/0x6e0 net/rose/rose_route.c:690
Read of size 1 at addr ffff888062411030 by task syz.4.1128/8899

CPU: 1 PID: 8899 Comm: syz.4.1128 Not tainted 5.15.164-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/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
 rose_get_neigh+0x1b2/0x6e0 net/rose/rose_route.c:690
 rose_connect+0x456/0x1150 net/rose/af_rose.c:806
 __sys_connect_file net/socket.c:1918 [inline]
 __sys_connect+0x38b/0x410 net/socket.c:1935
 __do_sys_connect net/socket.c:1945 [inline]
 __se_sys_connect net/socket.c:1942 [inline]
 __x64_sys_connect+0x76/0x80 net/socket.c:1942
 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
RIP: 0033:0x7fe2ce9013b9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe2ccd80048 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 00007fe2cea8ff80 RCX: 00007fe2ce9013b9
RDX: 0000000000000040 RSI: 0000000020000000 RDI: 0000000000000005
RBP: 00007fe2ce96e8e6 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fe2cea8ff80 R15: 00007ffdf0128488
 </TASK>

Allocated by task 4377:
 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]
 batadv_forw_packet_alloc+0x198/0x3a0 net/batman-adv/send.c:519
 batadv_iv_ogm_aggregate_new net/batman-adv/bat_iv_ogm.c:563 [inline]
 batadv_iv_ogm_queue_add+0x6da/0xbe0 net/batman-adv/bat_iv_ogm.c:671
 batadv_iv_ogm_schedule_buff net/batman-adv/bat_iv_ogm.c:850 [inline]
 batadv_iv_ogm_schedule+0xb7e/0x1000 net/batman-adv/bat_iv_ogm.c:869
 batadv_iv_send_outstanding_bat_ogm_packet+0x6fa/0x800 net/batman-adv/bat_iv_ogm.c:1713
 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

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 insert_work+0x54/0x3e0 kernel/workqueue.c:1366
 __queue_work+0x963/0xd00 kernel/workqueue.c:1532
 call_timer_fn+0x16d/0x560 kernel/time/timer.c:1451
 expire_timers kernel/time/timer.c:1491 [inline]
 __run_timers+0x6a8/0x890 kernel/time/timer.c:1767
 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 __do_softirq kernel/softirq.c:592 [inline]
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu+0x157/0x240 kernel/softirq.c:641
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:653
 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1096
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638

Second to last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
 fib6_info_release include/net/ip6_fib.h:339 [inline]
 fib6_del_route net/ipv6/ip6_fib.c:1998 [inline]
 fib6_del+0x10e8/0x1570 net/ipv6/ip6_fib.c:2031
 fib6_clean_node+0x2ed/0x5d0 net/ipv6/ip6_fib.c:2193
 fib6_walk_continue+0x636/0x8c0 net/ipv6/ip6_fib.c:2115
 fib6_walk+0x168/0x2b0 net/ipv6/ip6_fib.c:2163
 fib6_clean_tree net/ipv6/ip6_fib.c:2243 [inline]
 __fib6_clean_all+0x2f8/0x480 net/ipv6/ip6_fib.c:2259
 rt6_sync_down_dev net/ipv6/route.c:4919 [inline]
 rt6_disable_ip+0x15d/0x6c0 net/ipv6/route.c:4924
 addrconf_ifdown+0x161/0x1bb0 net/ipv6/addrconf.c:3777
 addrconf_notify+0x432/0xf30
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
 call_netdevice_notifiers_info net/core/dev.c:2018 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2030 [inline]
 call_netdevice_notifiers net/core/dev.c:2044 [inline]
 dev_close_many+0x37c/0x530 net/core/dev.c:1619
 unregister_netdevice_many+0x4b0/0x18f0 net/core/dev.c:11070
 default_device_exit_batch+0x390/0x3f0 net/core/dev.c:11627
 ops_exit_list net/core/net_namespace.c:177 [inline]
 cleanup_net+0x763/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

The buggy address belongs to the object at ffff888062411000
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 48 bytes inside of
 512-byte region [ffff888062411000, ffff888062411200)
The buggy address belongs to the page:
page:ffffea0001890400 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888062413800 pfn:0x62410
head:ffffea0001890400 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea00018f8e08 ffffea000078f908 ffff888011c41c80
raw: ffff888062413800 0000000000100006 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3566, ts 53244488924, free_ts 11093903647
 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]
 __kmalloc_node_track_caller+0x1f6/0x390 mm/slub.c:4958
 kmalloc_reserve net/core/skbuff.c:356 [inline]
 __alloc_skb+0x12c/0x590 net/core/skbuff.c:427
 alloc_skb include/linux/skbuff.h:1167 [inline]
 nlmsg_new include/net/netlink.h:953 [inline]
 rtmsg_ifa+0x1e7/0x3a0 net/ipv4/devinet.c:1913
 __inet_insert_ifa+0x9e4/0xc10 net/ipv4/devinet.c:552
 inet_rtm_newaddr+0x8ca/0x1840 net/ipv4/devinet.c:956
 rtnetlink_rcv_msg+0x993/0xee0 net/core/rtnetlink.c:5629
 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:2058
 __do_sys_sendto net/socket.c:2070 [inline]
 __se_sys_sendto net/socket.c:2066 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2066
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
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_contig_range+0x95/0xf0 mm/page_alloc.c:9342
 destroy_args+0xfe/0x980 mm/debug_vm_pgtable.c:1018
 debug_vm_pgtable+0x40d/0x470 mm/debug_vm_pgtable.c:1331
 do_one_initcall+0x22b/0x7a0 init/main.c:1302
 do_initcall_level+0x157/0x210 init/main.c:1375
 do_initcalls+0x49/0x90 init/main.c:1391
 kernel_init_freeable+0x425/0x5c0 init/main.c:1615
 kernel_init+0x19/0x290 init/main.c:1506
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
 ffff888062410f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888062410f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888062411000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff888062411080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888062411100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/31 20:39 linux-5.15.y 7e89efd3ae1c 6fde257d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_get_neigh
* Struck through repros no longer work on HEAD.