syzbot


KASAN: use-after-free Read in ax25_fillin_cb (2)

Status: upstream: reported on 2024/12/29 08:09
Reported-by: syzbot+cb55d909987f69524941@syzkaller.appspotmail.com
First crash: 17d, last: 17d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ax25_fillin_cb hams syz 4 2212d 2209d 11/28 fixed on 2019/01/15 20:25
linux-5.15 KASAN: use-after-free Read in ax25_fillin_cb 1 194d 194d 0/3 auto-obsoleted due to no activity on 2024/10/12 11:28

Sample crash report:
loop8: detected capacity change from 0 to 1024
==================================================================
BUG: KASAN: use-after-free in ax25_fillin_cb_from_dev net/ax25/af_ax25.c:468 [inline]
BUG: KASAN: use-after-free in ax25_fillin_cb+0x460/0x660 net/ax25/af_ax25.c:495
Read of size 4 at addr ffff88807a4b1138 by task syz.8.745/8335

CPU: 0 PID: 8335 Comm: syz.8.745 Not tainted 5.15.175-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
 ax25_fillin_cb_from_dev net/ax25/af_ax25.c:468 [inline]
 ax25_fillin_cb+0x460/0x660 net/ax25/af_ax25.c:495
 ax25_setsockopt+0xab7/0xe70 net/ax25/af_ax25.c:690
 __sys_setsockopt+0x57e/0x990 net/socket.c:2203
 __do_sys_setsockopt net/socket.c:2214 [inline]
 __se_sys_setsockopt net/socket.c:2211 [inline]
 __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2211
 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:0x7f75e4180d29
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:00007f75e1ff1038 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 00007f75e4370fa0 RCX: 00007f75e4180d29
RDX: 0000000000000019 RSI: 0000000000000101 RDI: 0000000000000005
RBP: 00007f75e41fcb08 R08: 0000000000000010 R09: 0000000000000000
R10: 0000000020000280 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f75e4370fa0 R15: 00007fff371316c8
 </TASK>

Allocated by task 6410:
 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]
 ax25_dev_device_up+0x51/0x5a0 net/ax25/ax25_dev.c:55
 ax25_device_event+0x49b/0x500 net/ax25/af_ax25.c:139
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
 __dev_notify_flags+0x304/0x610
 dev_change_flags+0xe7/0x190 net/core/dev.c:8897
 dev_ifsioc+0x147/0x10c0 net/core/dev_ioctl.c:324
 dev_ioctl+0x504/0xf60 net/core/dev_ioctl.c:587
 sock_do_ioctl+0x34f/0x5a0 net/socket.c:1154
 sock_ioctl+0x47f/0x770 net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860
 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 8161:
 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
 ax25_dev_put include/net/ax25.h:302 [inline]
 ax25_release+0x3b3/0x840 net/ax25/af_ax25.c:1062
 __sock_release net/socket.c:649 [inline]
 sock_close+0xcd/0x230 net/socket.c:1336
 __fput+0x3fe/0x8e0 fs/file_table.c:280
 task_work_run+0x129/0x1a0 kernel/task_work.c:188
 get_signal+0x143a/0x14e0 kernel/signal.c:2672
 arch_do_signal_or_restart+0xc3/0x1890 arch/x86/kernel/signal.c:867
 handle_signal_work kernel/entry/common.c:154 [inline]
 exit_to_user_mode_loop+0x97/0x130 kernel/entry/common.c:178
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff88807a4b1100
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 56 bytes inside of
 192-byte region [ffff88807a4b1100, ffff88807a4b11c0)
The buggy address belongs to the page:
page:ffffea0001e92c40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7a4b1
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 0000000600000001 ffff888017441a00
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 5906, ts 208706617137, free_ts 206434394241
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5465
 __alloc_pages_node include/linux/gfp.h:570 [inline]
 alloc_slab_page mm/slub.c:1777 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xb1/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+0x1fa/0x390 mm/slub.c:4451
 kmalloc_array_node include/linux/slab.h:684 [inline]
 kcalloc_node include/linux/slab.h:689 [inline]
 memcg_alloc_page_obj_cgroups+0x7e/0x120 mm/memcontrol.c:2836
 account_slab_page mm/slab.h:424 [inline]
 allocate_slab mm/slub.c:1928 [inline]
 new_slab+0xfb/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+0x18e/0x280 mm/slub.c:3233
 sock_alloc_inode+0x17/0xb0 net/socket.c:303
 alloc_inode fs/inode.c:236 [inline]
 new_inode_pseudo+0x60/0x210 fs/inode.c:976
 sock_alloc net/socket.c:626 [inline]
 __sock_create+0x11f/0x8f0 net/socket.c:1450
 sock_create net/socket.c:1542 [inline]
 __sys_socket+0x132/0x370 net/socket.c:1584
 __do_sys_socket net/socket.c:1593 [inline]
 __se_sys_socket net/socket.c:1591 [inline]
 __x64_sys_socket+0x76/0x80 net/socket.c:1591
 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
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_list+0x1f7/0x8e0 mm/page_alloc.c:3433
 release_pages+0x1bb9/0x1f40 mm/swap.c:963
 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
 tlb_flush_mmu mm/mmu_gather.c:247 [inline]
 tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:338
 exit_mmap+0x3cd/0x620 mm/mmap.c:3206
 __mmput+0x112/0x3b0 kernel/fork.c:1127
 exit_mm+0x688/0x7f0 kernel/exit.c:550
 do_exit+0x626/0x2480 kernel/exit.c:861
 do_group_exit+0x144/0x310 kernel/exit.c:996
 get_signal+0xc66/0x14e0 kernel/signal.c:2900
 arch_do_signal_or_restart+0xc3/0x1890 arch/x86/kernel/signal.c:867
 handle_signal_work kernel/entry/common.c:154 [inline]
 exit_to_user_mode_loop+0x97/0x130 kernel/entry/common.c:178
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
 irqentry_exit_to_user_mode+0x5/0x30 kernel/entry/common.c:320
 exc_page_fault+0x342/0x700 arch/x86/mm/fault.c:1504
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606

Memory state around the buggy address:
 ffff88807a4b1000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807a4b1080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88807a4b1100: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff88807a4b1180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff88807a4b1200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/29 08:08 linux-5.15.y 91786f140358 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ax25_fillin_cb
* Struck through repros no longer work on HEAD.