syzbot


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

Status: upstream: reported on 2024/12/30 01:55
Subsystems: hams
[Documentation on labels]
Reported-by: syzbot+a5716c7fb89dcd7205d8@syzkaller.appspotmail.com
First crash: 203d, last: 3d12h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [hams?] KASAN: slab-use-after-free Read in ax25_release 0 (1) 2024/12/30 01:55

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in ax25_release+0x99a/0xa10 net/ax25/af_ax25.c:1062
Read of size 1 at addr ffff88802d3a0ecc by task syz.3.6/6003

CPU: 3 UID: 0 PID: 6003 Comm: syz.3.6 Not tainted 6.13.0-rc4-syzkaller-00110-g4099a71718b0 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xc3/0x620 mm/kasan/report.c:489
 kasan_report+0xd9/0x110 mm/kasan/report.c:602
 ax25_release+0x99a/0xa10 net/ax25/af_ax25.c:1062
 __sock_release+0xb0/0x270 net/socket.c:640
 sock_close+0x1c/0x30 net/socket.c:1408
 __fput+0x3f8/0xb60 fs/file_table.c:450
 task_work_run+0x14e/0x250 kernel/task_work.c:239
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x27b/0x2a0 kernel/entry/common.c:218
 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f655db85d29
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:00007ffeabe26088 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 000000000000b39b RCX: 00007f655db85d29
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007f655dd77ba0 R08: 0000000000000001 R09: 00007ffeabe2637f
R10: 00007f655da00000 R11: 0000000000000246 R12: 000000000000b3fa
R13: 00007f655dd75fa0 R14: 0000000000000032 R15: ffffffffffffffff
 </TASK>

Allocated by task 6004:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
 kmalloc_noprof include/linux/slab.h:901 [inline]
 kzalloc_noprof include/linux/slab.h:1037 [inline]
 ax25_dev_device_up+0x47/0x690 net/ax25/ax25_dev.c:57
 ax25_device_event+0x485/0x610 net/ax25/af_ax25.c:143
 notifier_call_chain+0xb7/0x410 kernel/notifier.c:85
 call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:1996
 call_netdevice_notifiers_extack net/core/dev.c:2034 [inline]
 call_netdevice_notifiers net/core/dev.c:2048 [inline]
 __dev_notify_flags+0x12d/0x2e0 net/core/dev.c:8988
 dev_change_flags+0x10c/0x160 net/core/dev.c:9026
 dev_ifsioc+0x9c8/0x10b0 net/core/dev_ioctl.c:526
 dev_ioctl+0x224/0x10c0 net/core/dev_ioctl.c:783
 sock_do_ioctl+0x19e/0x280 net/socket.c:1223
 sock_ioctl+0x228/0x6c0 net/socket.c:1328
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:906 [inline]
 __se_sys_ioctl fs/ioctl.c:892 [inline]
 __x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 6004:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:582
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2353 [inline]
 slab_free mm/slub.c:4613 [inline]
 kfree+0x14f/0x4b0 mm/slub.c:4761
 ax25_dev_put include/net/ax25.h:294 [inline]
 ax25_dev_device_down+0x341/0x400 net/ax25/ax25_dev.c:131
 ax25_device_event+0x4b5/0x610 net/ax25/af_ax25.c:148
 notifier_call_chain+0xb7/0x410 kernel/notifier.c:85
 call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:1996
 call_netdevice_notifiers_extack net/core/dev.c:2034 [inline]
 call_netdevice_notifiers net/core/dev.c:2048 [inline]
 dev_close_many+0x333/0x6a0 net/core/dev.c:1589
 dev_close net/core/dev.c:1611 [inline]
 dev_close+0x181/0x230 net/core/dev.c:1605
 bpq_device_event+0x820/0xaf0 drivers/net/hamradio/bpqether.c:547
 notifier_call_chain+0xb7/0x410 kernel/notifier.c:85
 call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:1996
 call_netdevice_notifiers_extack net/core/dev.c:2034 [inline]
 call_netdevice_notifiers net/core/dev.c:2048 [inline]
 dev_close_many+0x333/0x6a0 net/core/dev.c:1589
 dev_close net/core/dev.c:1611 [inline]
 dev_close+0x181/0x230 net/core/dev.c:1605
 bond_setup_by_slave drivers/net/bonding/bond_main.c:1631 [inline]
 bond_enslave+0x1f67/0x6040 drivers/net/bonding/bond_main.c:2043
 bond_do_ioctl+0x60e/0x6d0 drivers/net/bonding/bond_main.c:4685
 dev_siocbond net/core/dev_ioctl.c:471 [inline]
 dev_ifsioc+0x1ea/0x10b0 net/core/dev_ioctl.c:613
 dev_ioctl+0x224/0x10c0 net/core/dev_ioctl.c:783
 sock_do_ioctl+0x19e/0x280 net/socket.c:1223
 sock_ioctl+0x228/0x6c0 net/socket.c:1328
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:906 [inline]
 __se_sys_ioctl fs/ioctl.c:892 [inline]
 __x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88802d3a0e00
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 204 bytes inside of
 freed 256-byte region [ffff88802d3a0e00, ffff88802d3a0f00)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2d3a0
head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801b042b40 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
head: 00fff00000000040 ffff88801b042b40 dead000000000122 0000000000000000
head: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
head: 00fff00000000001 ffffea0000b4e801 ffffffffffffffff 0000000000000000
head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 6001, tgid 5999 (syz.1.2), ts 46086172956, free_ts 46085737874
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1558
 prep_new_page mm/page_alloc.c:1566 [inline]
 get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3476
 __alloc_pages_noprof+0x223/0x25b0 mm/page_alloc.c:4753
 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline]
 alloc_slab_page mm/slub.c:2425 [inline]
 allocate_slab mm/slub.c:2589 [inline]
 new_slab+0xca/0x410 mm/slub.c:2642
 ___slab_alloc+0xd7d/0x17a0 mm/slub.c:3830
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3920
 __slab_alloc_node mm/slub.c:3995 [inline]
 slab_alloc_node mm/slub.c:4156 [inline]
 __do_kmalloc_node mm/slub.c:4297 [inline]
 __kmalloc_node_noprof+0x2f0/0x510 mm/slub.c:4304
 kmalloc_array_node_noprof include/linux/slab.h:1018 [inline]
 alloc_slab_obj_exts+0x41/0xa0 mm/slub.c:1964
 account_slab mm/slub.c:2552 [inline]
 allocate_slab mm/slub.c:2607 [inline]
 new_slab+0x314/0x410 mm/slub.c:2642
 ___slab_alloc+0xd7d/0x17a0 mm/slub.c:3830
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3920
 __slab_alloc_node mm/slub.c:3995 [inline]
 slab_alloc_node mm/slub.c:4156 [inline]
 kmem_cache_alloc_lru_noprof+0xff/0x3d0 mm/slub.c:4187
 alloc_inode+0xbf/0x230 fs/inode.c:338
 new_inode_pseudo fs/inode.c:1174 [inline]
 new_inode+0x22/0x210 fs/inode.c:1193
 debugfs_get_inode fs/debugfs/inode.c:72 [inline]
 __debugfs_create_file+0x11a/0x660 fs/debugfs/inode.c:433
 debugfs_create_file_full+0x6d/0xa0 fs/debugfs/inode.c:462
page last free pid 6003 tgid 6003 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1127 [inline]
 free_unref_page+0x661/0x1080 mm/page_alloc.c:2659
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:250 [inline]
 slab_post_alloc_hook mm/slub.c:4119 [inline]
 slab_alloc_node mm/slub.c:4168 [inline]
 kmem_cache_alloc_lru_noprof+0x226/0x3d0 mm/slub.c:4187
 proc_alloc_inode+0x25/0x200 fs/proc/inode.c:57
 alloc_inode+0x5d/0x230 fs/inode.c:336
 new_inode_pseudo fs/inode.c:1174 [inline]
 new_inode+0x22/0x210 fs/inode.c:1193
 proc_pid_make_inode+0x22/0x160 fs/proc/base.c:1950
 proc_pident_instantiate+0x85/0x320 fs/proc/base.c:2697
 proc_pident_lookup+0x226/0x2a0 fs/proc/base.c:2733
 lookup_open.isra.0+0x92d/0x14c0 fs/namei.c:3627
 open_last_lookups fs/namei.c:3748 [inline]
 path_openat+0x904/0x2d60 fs/namei.c:3984
 do_filp_open+0x20c/0x470 fs/namei.c:4014
 do_sys_openat2+0x17a/0x1e0 fs/open.c:1402
 do_sys_open fs/open.c:1417 [inline]
 __do_sys_openat fs/open.c:1433 [inline]
 __se_sys_openat fs/open.c:1428 [inline]
 __x64_sys_openat+0x175/0x210 fs/open.c:1428

Memory state around the buggy address:
 ffff88802d3a0d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88802d3a0e00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802d3a0e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff88802d3a0f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88802d3a0f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/30 02:24 upstream 4099a71718b0 d3ccff63 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in ax25_release
2024/12/30 01:54 upstream 4099a71718b0 d3ccff63 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in ax25_release
2024/11/17 19:03 net-next 38f83a57aa8e cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in ax25_release
2024/06/13 14:04 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 ax25_release
2024/08/20 14:56 upstream 6e4436539ae1 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce-root KMSAN: uninit-value in ax25_release
2024/07/27 02:26 upstream 2f8c4f506285 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce-root KMSAN: uninit-value in ax25_release
* Struck through repros no longer work on HEAD.