syzbot


KASAN: use-after-free Read in ax25_fillin_cb

Status: auto-obsoleted due to no activity on 2024/10/12 11:28
Reported-by: syzbot+80850ac3f752495d8e28@syzkaller.appspotmail.com
First crash: 170d, last: 170d
Similar bugs (1)
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 2187d 2184d 11/28 fixed on 2019/01/15 20:25

Sample crash report:
==================================================================
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 ffff88801e69ab38 by task syz.1.694/6036

CPU: 1 PID: 6036 Comm: syz.1.694 Not tainted 5.15.161-syzkaller #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+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:2198
 __do_sys_setsockopt net/socket.c:2209 [inline]
 __se_sys_setsockopt net/socket.c:2206 [inline]
 __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2206
 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:0x7f13ab2f4bd9
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:00007f13a9d75048 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 00007f13ab482f60 RCX: 00007f13ab2f4bd9
RDX: 0000000000000019 RSI: 0000000000000101 RDI: 0000000000000005
RBP: 00007f13ab363aa1 R08: 0000000000000010 R09: 0000000000000000
R10: 00000000200003c0 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f13ab482f60 R15: 00007ffe0be93968
 </TASK>

Allocated by task 4424:
 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:8889
 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 5979:
 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+0x3bf/0x890 fs/file_table.c:280
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
 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 ffff88801e69ab00
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 56 bytes inside of
 192-byte region [ffff88801e69ab00, ffff88801e69abc0)
The buggy address belongs to the page:
page:ffffea000079a680 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801e69a100 pfn:0x1e69a
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00004a8c80 0000000700000007 ffff888011c41a00
raw: ffff88801e69a100 000000008010000f 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 4197, ts 72681386264, free_ts 72540629692
 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_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
 v9fs_alloc_inode+0x41/0x120 fs/9p/vfs_inode.c:231
 alloc_inode fs/inode.c:236 [inline]
 new_inode_pseudo+0x60/0x210 fs/inode.c:937
 new_inode+0x25/0x1d0 fs/inode.c:966
 v9fs_get_inode+0x49/0xf0 fs/9p/vfs_inode.c:362
 v9fs_mount+0x4b0/0x860 fs/9p/vfs_super.c:146
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1517
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
 __vunmap+0x8d4/0xa20 mm/vmalloc.c:2621
 bpf_prog_calc_tag+0x69a/0x8f0 kernel/bpf/core.c:337
 resolve_pseudo_ldimm64+0xe0/0x1240 kernel/bpf/verifier.c:11802
 bpf_check+0x4341/0x12d00 kernel/bpf/verifier.c:14088
 bpf_prog_load+0x12b3/0x1b60 kernel/bpf/syscall.c:2353
 __sys_bpf+0x343/0x670 kernel/bpf/syscall.c:4651
 __do_sys_bpf kernel/bpf/syscall.c:4755 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:4753 [inline]
 __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4753
 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

Memory state around the buggy address:
 ffff88801e69aa00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88801e69aa80: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88801e69ab00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff88801e69ab80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff88801e69ac00: 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/07/04 11:27 linux-5.15.y 4878aadf2d15 3f2748a3 .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.