syzbot


KASAN: slab-use-after-free Read in rose_get_neigh

Status: upstream: reported on 2024/06/11 06:56
Subsystems: hams
[Documentation on labels]
Reported-by: syzbot+e04e2c007ba2c80476cb@syzkaller.appspotmail.com
First crash: 42d, last: 2d04h
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] Monthly hams report (Jun 2024) 0 (1) 2024/06/11 13:40
[syzbot] [hams?] KASAN: slab-use-after-free Read in rose_get_neigh 0 (1) 2024/06/11 06:56

Sample crash report:
atomic_op ffff888021f77998 conn xmit_atomic 0000000000000000
==================================================================
BUG: KASAN: slab-use-after-free in rose_get_neigh+0x1b6/0x6f0 net/rose/rose_route.c:692
Read of size 1 at addr ffff88806c62c830 by task syz-executor.2/23642

CPU: 1 PID: 23642 Comm: syz-executor.2 Not tainted 6.10.0-rc2-syzkaller-00761-g3ec8d7572a69 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 rose_get_neigh+0x1b6/0x6f0 net/rose/rose_route.c:692
 rose_connect+0x45a/0x1170 net/rose/af_rose.c:808
 __sys_connect_file net/socket.c:2049 [inline]
 __sys_connect+0x2df/0x310 net/socket.c:2066
 __do_sys_connect net/socket.c:2076 [inline]
 __se_sys_connect net/socket.c:2073 [inline]
 __x64_sys_connect+0x7a/0x90 net/socket.c:2073
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f0e2fc7cea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f0e3094c0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 00007f0e2fdb3f80 RCX: 00007f0e2fc7cea9
RDX: 0000000000000040 RSI: 0000000020000040 RDI: 0000000000000008
RBP: 00007f0e2fcebff4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f0e2fdb3f80 R15: 00007ffecfed91e8
 </TASK>

Allocated by task 23470:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
 __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 kmalloc_trace_noprof+0x19c/0x2c0 mm/slub.c:4152
 kmalloc_noprof include/linux/slab.h:660 [inline]
 kzalloc_noprof include/linux/slab.h:778 [inline]
 mca_alloc net/ipv6/mcast.c:880 [inline]
 __ipv6_dev_mc_inc+0x426/0xa90 net/ipv6/mcast.c:936
 ipv6_add_dev+0xe03/0x1220 net/ipv6/addrconf.c:468
 addrconf_notify+0x6a7/0x1020 net/ipv6/addrconf.c:3652
 notifier_call_chain+0x19f/0x3e0 kernel/notifier.c:93
 call_netdevice_notifiers_extack net/core/dev.c:2030 [inline]
 call_netdevice_notifiers net/core/dev.c:2044 [inline]
 register_netdevice+0x1570/0x19e0 net/core/dev.c:10408
 ppp_unit_register drivers/net/ppp/ppp_generic.c:1204 [inline]
 ppp_dev_configure+0x883/0xb10 drivers/net/ppp/ppp_generic.c:1260
 ppp_create_interface drivers/net/ppp/ppp_generic.c:3333 [inline]
 ppp_unattached_ioctl drivers/net/ppp/ppp_generic.c:1045 [inline]
 ppp_ioctl+0x799/0x1cd0 drivers/net/ppp/ppp_generic.c:718
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:907 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:893
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5113:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240
 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2195 [inline]
 slab_free_freelist_hook mm/slub.c:2224 [inline]
 slab_free_bulk mm/slub.c:4460 [inline]
 kmem_cache_free_bulk+0x1f8/0x370 mm/slub.c:4674
 kfree_bulk include/linux/slab.h:568 [inline]
 kvfree_rcu_bulk+0x24b/0x4e0 kernel/rcu/tree.c:3371
 kfree_rcu_work+0x44b/0x500 kernel/rcu/tree.c:3450
 process_one_work kernel/workqueue.c:3231 [inline]
 process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312
 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Last potentially related work creation:
 kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47
 __kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:541
 kvfree_call_rcu+0xfc/0x790 kernel/rcu/tree.c:3781
 ipv6_mc_destroy_dev+0x3b2/0x570 net/ipv6/mcast.c:2810
 addrconf_ifdown+0x16dc/0x1bc0 net/ipv6/addrconf.c:3998
 addrconf_notify+0x3cb/0x1020
 notifier_call_chain+0x19f/0x3e0 kernel/notifier.c:93
 call_netdevice_notifiers_extack net/core/dev.c:2030 [inline]
 call_netdevice_notifiers net/core/dev.c:2044 [inline]
 unregister_netdevice_many_notify+0xd75/0x16b0 net/core/dev.c:11269
 unregister_netdevice_many net/core/dev.c:11327 [inline]
 unregister_netdevice_queue+0x303/0x370 net/core/dev.c:11206
 unregister_netdevice include/linux/netdevice.h:3119 [inline]
 ppp_release+0xf0/0x1f0 drivers/net/ppp/ppp_generic.c:409
 __fput+0x406/0x8b0 fs/file_table.c:422
 task_work_run+0x24f/0x310 kernel/task_work.c:180
 get_signal+0x15e6/0x1740 kernel/signal.c:2681
 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310
 exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0xc9/0x370 kernel/entry/common.c:218
 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88806c62c800
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 48 bytes inside of
 freed 512-byte region [ffff88806c62c800, ffff88806c62ca00)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6c62c
head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffefff(slab)
raw: 00fff00000000040 ffff888015041c80 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000100010 00000001ffffefff 0000000000000000
head: 00fff00000000040 ffff888015041c80 dead000000000100 dead000000000122
head: 0000000000000000 0000000000100010 00000001ffffefff 0000000000000000
head: 00fff00000000002 ffffea0001b18b01 ffffffffffffffff 0000000000000000
head: 0000000000000004 0000000000000000 00000000ffffffff 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 0x352800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 5123, tgid 5123 (syz-executor.3), ts 68336673186, free_ts 68196045053
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1468
 prep_new_page mm/page_alloc.c:1476 [inline]
 get_page_from_freelist+0x2e2d/0x2ee0 mm/page_alloc.c:3402
 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4660
 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline]
 alloc_pages_node_noprof include/linux/gfp.h:296 [inline]
 alloc_slab_page+0x5f/0x120 mm/slub.c:2264
 allocate_slab+0x5a/0x2e0 mm/slub.c:2427
 new_slab mm/slub.c:2480 [inline]
 ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3666
 __slab_alloc+0x58/0xa0 mm/slub.c:3756
 __slab_alloc_node mm/slub.c:3809 [inline]
 slab_alloc_node mm/slub.c:3988 [inline]
 __do_kmalloc_node mm/slub.c:4120 [inline]
 __kmalloc_node_noprof+0x286/0x440 mm/slub.c:4128
 kmalloc_array_node_noprof include/linux/slab.h:759 [inline]
 alloc_slab_obj_exts+0x3a/0xa0 mm/slub.c:1941
 __memcg_slab_post_alloc_hook+0x31c/0x7e0 mm/memcontrol.c:3775
 memcg_slab_post_alloc_hook mm/slub.c:2103 [inline]
 slab_post_alloc_hook mm/slub.c:3961 [inline]
 slab_alloc_node mm/slub.c:4000 [inline]
 kmem_cache_alloc_noprof+0x1de/0x2a0 mm/slub.c:4007
 anon_vma_chain_alloc mm/rmap.c:142 [inline]
 anon_vma_fork+0x1fa/0x580 mm/rmap.c:364
 dup_mmap kernel/fork.c:714 [inline]
 dup_mm kernel/fork.c:1688 [inline]
 copy_mm+0xdf3/0x2020 kernel/fork.c:1737
 copy_process+0x187a/0x3dc0 kernel/fork.c:2390
 kernel_clone+0x226/0x8f0 kernel/fork.c:2797
 __do_sys_clone kernel/fork.c:2940 [inline]
 __se_sys_clone kernel/fork.c:2924 [inline]
 __x64_sys_clone+0x258/0x2a0 kernel/fork.c:2924
page last free pid 5202 tgid 5201 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1088 [inline]
 free_unref_page+0xd22/0xea0 mm/page_alloc.c:2565
 __slab_free+0x31b/0x3d0 mm/slub.c:4347
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slub.c:3940 [inline]
 slab_alloc_node mm/slub.c:4000 [inline]
 kmem_cache_alloc_lru_noprof+0x139/0x2b0 mm/slub.c:4019
 sock_alloc_inode+0x28/0xc0 net/socket.c:308
 alloc_inode fs/inode.c:261 [inline]
 new_inode_pseudo+0x69/0x1e0 fs/inode.c:1007
 sock_alloc net/socket.c:634 [inline]
 __sock_create+0x123/0x920 net/socket.c:1535
 sock_create net/socket.c:1622 [inline]
 __sys_socket_create net/socket.c:1659 [inline]
 __sys_socket+0x150/0x3c0 net/socket.c:1706
 __do_sys_socket net/socket.c:1720 [inline]
 __se_sys_socket net/socket.c:1718 [inline]
 __x64_sys_socket+0x7a/0x90 net/socket.c:1718
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff88806c62c700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88806c62c780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88806c62c800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff88806c62c880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88806c62c900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/13 14:35 net-next 3ec8d7572a69 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in rose_get_neigh
2024/06/13 14:08 net-next 3ec8d7572a69 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in rose_get_neigh
2024/06/13 11:29 net-next 91579c93a9b2 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in rose_get_neigh
2024/06/11 06:55 net-next bb678f01804c 048c640a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in rose_get_neigh
2024/06/03 14:16 net-next 93e30878f7ec 0aba2352 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in rose_get_neigh
2024/05/18 05:56 net-next 1b294a1f3561 c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in rose_get_neigh
2024/05/10 18:54 net-next 383eed2de529 f7c35481 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in rose_get_neigh
2024/05/04 15:29 net-next 173e7622ccb3 610f2a54 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in rose_get_neigh
* Struck through repros no longer work on HEAD.