syzbot


KASAN: use-after-free Read in ax25_heartbeat_expiry

Status: upstream: reported on 2025/02/21 07:36
Reported-by: syzbot+[email protected]
First crash: 124d, last: 44d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ax25_heartbeat_expiry+0x10c/0x128 net/ax25/ax25_timer.c:125
Read of size 4 at addr ffff0000cb97b250 by task syz.4.80/4463

CPU: 1 PID: 4463 Comm: syz.4.80 Not tainted 5.15.182-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Call trace:
 dump_backtrace+0x0/0x43c arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack+0x30/0x40 lib/dump_stack.c:88
 dump_stack_lvl+0xf8/0x160 lib/dump_stack.c:106
 print_address_description+0x78/0x30c mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xec/0x15c mm/kasan/report.c:451
 __asan_report_load4_noabort+0x44/0x50 mm/kasan/report_generic.c:308
 ax25_heartbeat_expiry+0x10c/0x128 net/ax25/ax25_timer.c:125
 call_timer_fn+0x19c/0x858 kernel/time/timer.c:1451
 expire_timers kernel/time/timer.c:1496 [inline]
 __run_timers+0x46c/0x6c4 kernel/time/timer.c:1767
 run_timer_softirq+0x7c/0x114 kernel/time/timer.c:1780
 handle_softirqs+0x344/0xbf0 kernel/softirq.c:558
 __do_softirq kernel/softirq.c:592 [inline]
 do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline]
 invoke_softirq kernel/softirq.c:439 [inline]
 __irq_exit_rcu+0x240/0x440 kernel/softirq.c:641
 irq_exit+0x14/0x88 kernel/softirq.c:665
 handle_domain_irq+0x14c/0x1fc kernel/irq/irqdesc.c:711
 gic_handle_irq+0x78/0x1c8 drivers/irqchip/irq-gic-v3.c:765
 call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:899
 do_interrupt_handler+0x6c/0x88 arch/arm64/kernel/entry-common.c:267
 el0_interrupt+0x94/0x25c arch/arm64/kernel/entry-common.c:683
 __el0_irq_handler_common+0x18/0x24 arch/arm64/kernel/entry-common.c:690
 el0t_64_irq_handler+0x10/0x1c arch/arm64/kernel/entry-common.c:695
 el0t_64_irq+0x1a0/0x1a4 arch/arm64/kernel/entry.S:585

Allocated by task 4238:
 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 mm/kasan/common.c:513 [inline]
 __kasan_kmalloc+0xb0/0xf0 mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x274/0x3fc mm/slub.c:3247
 kmalloc include/linux/slab.h:604 [inline]
 kzalloc include/linux/slab.h:735 [inline]
 ax25_dev_device_up+0x5c/0x540 net/ax25/ax25_dev.c:55
 ax25_device_event+0x504/0x590 net/ax25/af_ax25.c:139
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xd4/0x164 kernel/notifier.c:391
 call_netdevice_notifiers_info net/core/dev.c:2049 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2061 [inline]
 call_netdevice_notifiers net/core/dev.c:2075 [inline]
 __dev_notify_flags+0x250/0x46c net/core/dev.c:-1
 dev_change_flags+0xc8/0x154 net/core/dev.c:8929
 dev_ifsioc+0x504/0xef4 net/core/dev_ioctl.c:324
 dev_ioctl+0x4d0/0xc94 net/core/dev_ioctl.c:587
 sock_do_ioctl+0x18c/0x240 net/socket.c:1154
 sock_ioctl+0x5c8/0x87c net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x78/0x1e0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 4402:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1e8 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0x170/0x40c mm/slub.c:4559
 ax25_dev_put include/net/ax25.h:302 [inline]
 ax25_release+0x564/0x814 net/ax25/af_ax25.c:1062
 __sock_release net/socket.c:649 [inline]
 sock_close+0xb4/0x1f8 net/socket.c:1336
 __fput+0x1c0/0x7f8 fs/file_table.c:311
 ____fput+0x20/0x30 fs/file_table.c:339
 task_work_run+0x12c/0x1e0 kernel/task_work.c:188
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 do_notify_resume+0x24b4/0x3128 arch/arm64/kernel/signal.c:949
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
 el0_svc+0xf0/0x1e0 arch/arm64/kernel/entry-common.c:609
 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Last potentially related work creation:
 kasan_save_stack+0x38/0x68 mm/kasan/common.c:38
 kasan_record_aux_stack+0xcc/0x114 mm/kasan/generic.c:348
 insert_work+0x64/0x388 kernel/workqueue.c:1366
 __queue_work+0xb30/0x1054 kernel/workqueue.c:1532
 queue_work_on+0xc4/0x17c kernel/workqueue.c:1559
 queue_work include/linux/workqueue.h:512 [inline]
 netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:659 [inline]
 netdevice_event+0x6ac/0x79c drivers/infiniband/core/roce_gid_mgmt.c:802
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xd4/0x164 kernel/notifier.c:391
 call_netdevice_notifiers_info net/core/dev.c:2049 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2061 [inline]
 call_netdevice_notifiers+0x10c/0x18c net/core/dev.c:2075
 register_netdevice+0xf04/0x1304 net/core/dev.c:10428
 register_vlan_dev+0x34c/0x718 net/8021q/vlan.c:180
 vlan_newlink+0x384/0x52c net/8021q/vlan_netlink.c:195
 __rtnl_newlink net/core/rtnetlink.c:3524 [inline]
 rtnl_newlink+0xeac/0x1404 net/core/rtnetlink.c:3572
 rtnetlink_rcv_msg+0x9d4/0xd04 net/core/rtnetlink.c:5650
 netlink_rcv_skb+0x208/0x3c4 net/netlink/af_netlink.c:2489
 rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:5668
 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
 netlink_unicast+0x60c/0x89c net/netlink/af_netlink.c:1337
 netlink_sendmsg+0x6e8/0x9cc net/netlink/af_netlink.c:1905
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 __sys_sendto+0x2e8/0x3d8 net/socket.c:2063
 __do_sys_sendto net/socket.c:2075 [inline]
 __se_sys_sendto net/socket.c:2071 [inline]
 __arm64_sys_sendto+0xd8/0xf8 net/socket.c:2071
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x78/0x1e0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Second to last potentially related work creation:
 kasan_save_stack+0x38/0x68 mm/kasan/common.c:38
 kasan_record_aux_stack+0xcc/0x114 mm/kasan/generic.c:348
 insert_work+0x64/0x388 kernel/workqueue.c:1366
 __queue_work+0xb30/0x1054 kernel/workqueue.c:1532
 queue_work_on+0xc4/0x17c kernel/workqueue.c:1559
 queue_work include/linux/workqueue.h:512 [inline]
 call_usermodehelper_exec+0x22c/0x478 kernel/umh.c:435
 kobject_uevent_env+0x670/0x888 lib/kobject_uevent.c:633
 kobject_uevent+0x2c/0x3c lib/kobject_uevent.c:657
 disk_uevent+0x280/0x430 block/genhd.c:367
 device_add_disk+0x838/0xad0 block/genhd.c:520
 add_disk include/linux/genhd.h:200 [inline]
 brd_alloc+0x480/0x634 drivers/block/brd.c:444
 brd_init+0x120/0x194 drivers/block/brd.c:524
 do_one_initcall+0x228/0x8b0 init/main.c:1302
 do_initcall_level+0x154/0x214 init/main.c:1375
 do_initcalls+0x58/0xac init/main.c:1391
 do_basic_setup+0x8c/0xa0 init/main.c:1410
 kernel_init_freeable+0x404/0x5fc init/main.c:1615
 kernel_init+0x24/0x1d0 init/main.c:1506
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

The buggy address belongs to the object at ffff0000cb97b200
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 80 bytes inside of
 256-byte region [ffff0000cb97b200, ffff0000cb97b300)
The buggy address belongs to the page:
page:0000000007bdc11d refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10b97a
head:0000000007bdc11d order:1 compound_mapcount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 fffffc000320d880 0000000700000007 ffff0000c0002480
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000cb97b100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000cb97b180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000cb97b200: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff0000cb97b280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000cb97b300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/05/12 22:47 linux-5.15.y 3b8db0e4f263 f6671af7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in ax25_heartbeat_expiry
2025/02/21 07:36 linux-5.15.y c16c81c81336 0808a665 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in ax25_heartbeat_expiry
* Struck through repros no longer work on HEAD.
OSZAR »