syzbot


KASAN: use-after-free Read in rose_timer_expiry

Status: upstream: reported on 2025/05/02 15:02
Reported-by: syzbot+3373ecf7f0857d6eb397@syzkaller.appspotmail.com
First crash: 7d11h, last: 8h11m
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in rose_timer_expiry (2) hams 138 3h14m 119d 27/28 internal: reported on 2025/01/10 04:53
linux-6.1 KASAN: use-after-free Read in rose_timer_expiry 8 1d22h 6d14h 0/3 upstream: reported on 2025/05/03 12:30
upstream KASAN: slab-use-after-free Read in rose_timer_expiry hams 5 360d 370d 0/28 closed as invalid on 2024/06/04 18:05

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in rose_timer_expiry+0x470/0x490 net/rose/rose_timer.c:183
Read of size 2 at addr ffff8880618ff02a by task syz.5.2555/12449

CPU: 0 PID: 12449 Comm: syz.5.2555 Not tainted 5.15.181-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Call Trace:
 <IRQ>
 dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
 print_address_description+0x60/0x2d0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xdf/0x130 mm/kasan/report.c:451
 rose_timer_expiry+0x470/0x490 net/rose/rose_timer.c:183
 call_timer_fn+0x16c/0x530 kernel/time/timer.c:1451
 expire_timers kernel/time/timer.c:1496 [inline]
 __run_timers+0x525/0x7c0 kernel/time/timer.c:1767
 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780
 handle_softirqs+0x328/0x820 kernel/softirq.c:558
 __do_softirq kernel/softirq.c:592 [inline]
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu+0x12f/0x220 kernel/softirq.c:641
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:653
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline]
 sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676
RIP: 0010:check_kcov_mode kernel/kcov.c:172 [inline]
RIP: 0010:write_comp_data kernel/kcov.c:227 [inline]
RIP: 0010:__sanitizer_cov_trace_const_cmp4+0x13/0x80 kernel/kcov.c:293
Code: 4a 89 7c 02 10 4a 89 74 02 18 4a 89 44 02 20 48 ff c1 48 89 0a c3 90 48 8b 04 24 65 48 8b 0d 44 ae 8a 7e 65 8b 15 45 ae 8a 7e <81> e2 00 01 ff 00 74 11 81 fa 00 01 00 00 75 5b 83 b9 34 16 00 00
RSP: 0018:ffffc90002e1f758 EFLAGS: 00000246
RAX: ffffffff888088fb RBX: 00000000ffffffff RCX: ffff88804596bb80
RDX: 0000000080000000 RSI: 00000000ffffffff RDI: 00000000ffffffff
RBP: ffffc90002e1f8f0 R08: dffffc0000000000 R09: ffffed100ca7cc0d
R10: ffffed100ca7cc0d R11: 1ffff1100ca7cc0c R12: dffffc0000000000
R13: ffffc90002e1fd40 R14: 1ffff920005c3efc R15: ffff888060762500
 sk_peek_offset_bwd include/net/sock.h:641 [inline]
 sk_peek_offset_fwd include/net/sock.h:649 [inline]
 __unix_dgram_recvmsg+0x89b/0xd50 net/unix/af_unix.c:2374
 ____sys_recvmsg+0x291/0x580 net/socket.c:-1
 ___sys_recvmsg+0x1af/0x4f0 net/socket.c:2697
 do_recvmmsg+0x344/0x7a0 net/socket.c:2791
 __sys_recvmmsg net/socket.c:2870 [inline]
 __do_sys_recvmmsg net/socket.c:2893 [inline]
 __se_sys_recvmmsg net/socket.c:2886 [inline]
 __x64_sys_recvmmsg+0x18d/0x240 net/socket.c:2886
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f402fdd0969
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:00007f402dc17038 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007f402fff8080 RCX: 00007f402fdd0969
RDX: 0000000000010106 RSI: 00002000000000c0 RDI: 0000000000000003
RBP: 00007f402fe52ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f402fff8080 R15: 00007ffd0d6ed9e8
 </TASK>

Allocated by task 10103:
 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+0xb5/0xf0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:604 [inline]
 rose_add_node+0x227/0xdb0 net/rose/rose_route.c:85
 rose_rt_ioctl+0x9db/0xe20 net/rose/rose_route.c:745
 rose_ioctl+0x27a/0x790 net/rose/af_rose.c:1372
 sock_do_ioctl+0xd3/0x2f0 net/socket.c:1140
 sock_ioctl+0x4ed/0x6e0 net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 12407:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd5/0x110 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+0xea/0x170 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xef/0x2a0 mm/slub.c:4559
 rose_rt_device_down+0x3e5/0x430 net/rose/rose_route.c:522
 rose_device_event+0x5ec/0x680 net/rose/af_rose.c:247
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:391
 call_netdevice_notifiers_extack net/core/dev.c:2061 [inline]
 call_netdevice_notifiers net/core/dev.c:2075 [inline]
 dev_close_many+0x28d/0x400 net/core/dev.c:1650
 dev_close+0x14c/0x200 net/core/dev.c:1672
 bpq_device_event+0x2f4/0x9c0 drivers/net/hamradio/bpqether.c:548
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:391
 call_netdevice_notifiers_extack net/core/dev.c:2061 [inline]
 call_netdevice_notifiers net/core/dev.c:2075 [inline]
 dev_close_many+0x28d/0x400 net/core/dev.c:1650
 dev_close+0x14c/0x200 net/core/dev.c:1672
 bond_setup_by_slave+0x61/0x3a0 drivers/net/bonding/bond_main.c:1471
 bond_enslave+0x77c/0x3a40 drivers/net/bonding/bond_main.c:1855
 bond_do_ioctl+0x2a2/0x8c0 drivers/net/bonding/bond_main.c:4238
 dev_ifsioc+0xc01/0xe70 net/core/dev_ioctl.c:417
 dev_ioctl+0x55f/0xe50 net/core/dev_ioctl.c:587
 sock_do_ioctl+0x222/0x2f0 net/socket.c:1154
 sock_ioctl+0x4ed/0x6e0 net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff8880618ff000
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 42 bytes inside of
 512-byte region [ffff8880618ff000, ffff8880618ff200)
The buggy address belongs to the page:
page:ffffea0001863f00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880618fe800 pfn:0x618fc
head:ffffea0001863f00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea00008cf008 ffffea000182a608 ffff888016841c80
raw: ffff8880618fe800 000000000010000a 00000001ffffffff 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4168, ts 66477014912, free_ts 21845643392
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192
 __alloc_pages+0x1e1/0x470 mm/page_alloc.c:5466
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xc0/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x81e/0xdf0 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 __kmalloc_node_track_caller+0x1fc/0x3a0 mm/slub.c:4958
 kmalloc_reserve net/core/skbuff.c:356 [inline]
 __alloc_skb+0x22c/0x750 net/core/skbuff.c:427
 alloc_skb include/linux/skbuff.h:1162 [inline]
 nlmsg_new include/net/netlink.h:953 [inline]
 inet_netconf_notify_devconf+0x16f/0x230 net/ipv4/devinet.c:2122
 __devinet_sysctl_register+0x321/0x380 net/ipv4/devinet.c:2610
 devinet_sysctl_register+0x17c/0x1f0 net/ipv4/devinet.c:2644
 inetdev_init+0x28c/0x4d0 net/ipv4/devinet.c:277
 inetdev_event+0x280/0x1360 net/ipv4/devinet.c:1544
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:391
 call_netdevice_notifiers_extack net/core/dev.c:2061 [inline]
 call_netdevice_notifiers net/core/dev.c:2075 [inline]
 register_netdevice+0x1275/0x16b0 net/core/dev.c:10428
 veth_newlink+0x8ed/0xda0 drivers/net/veth.c:1714
 __rtnl_newlink net/core/rtnetlink.c:3524 [inline]
 rtnl_newlink+0x114c/0x17d0 net/core/rtnetlink.c:3572
 rtnetlink_rcv_msg+0x9b9/0xe60 net/core/rtnetlink.c:5650
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+0x637/0x6c0 mm/page_alloc.c:3317
 free_unref_page+0x94/0x280 mm/page_alloc.c:3396
 free_contig_range+0x96/0xf0 mm/page_alloc.c:9385
 destroy_args+0xef/0x8b0 mm/debug_vm_pgtable.c:1018
 debug_vm_pgtable+0x318/0x370 mm/debug_vm_pgtable.c:1331
 do_one_initcall+0x1ee/0x680 init/main.c:1302
 do_initcall_level+0x137/0x1f0 init/main.c:1375
 do_initcalls+0x4b/0x90 init/main.c:1391
 kernel_init_freeable+0x3ce/0x560 init/main.c:1615
 kernel_init+0x19/0x1b0 init/main.c:1506
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
 ffff8880618fef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880618fef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880618ff000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff8880618ff080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880618ff100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	4a 89 7c 02 10       	mov    %rdi,0x10(%rdx,%r8,1)
   5:	4a 89 74 02 18       	mov    %rsi,0x18(%rdx,%r8,1)
   a:	4a 89 44 02 20       	mov    %rax,0x20(%rdx,%r8,1)
   f:	48 ff c1             	inc    %rcx
  12:	48 89 0a             	mov    %rcx,(%rdx)
  15:	c3                   	ret
  16:	90                   	nop
  17:	48 8b 04 24          	mov    (%rsp),%rax
  1b:	65 48 8b 0d 44 ae 8a 	mov    %gs:0x7e8aae44(%rip),%rcx        # 0x7e8aae67
  22:	7e
  23:	65 8b 15 45 ae 8a 7e 	mov    %gs:0x7e8aae45(%rip),%edx        # 0x7e8aae6f
* 2a:	81 e2 00 01 ff 00    	and    $0xff0100,%edx <-- trapping instruction
  30:	74 11                	je     0x43
  32:	81 fa 00 01 00 00    	cmp    $0x100,%edx
  38:	75 5b                	jne    0x95
  3a:	83                   	.byte 0x83
  3b:	b9 34 16 00 00       	mov    $0x1634,%ecx

Crashes (17):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/05/09 04:32 linux-5.15.y 16fdf2c7111b bb813bcc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_timer_expiry
2025/05/07 21:02 linux-5.15.y 16fdf2c7111b dbf35fa1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_timer_expiry
2025/05/06 22:08 linux-5.15.y 16fdf2c7111b 350f4ffc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_timer_expiry
2025/05/06 07:51 linux-5.15.y 16fdf2c7111b ae98e6b9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_timer_expiry
2025/05/06 06:10 linux-5.15.y 16fdf2c7111b ae98e6b9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_timer_expiry
2025/05/06 06:10 linux-5.15.y 16fdf2c7111b ae98e6b9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_timer_expiry
2025/05/06 06:10 linux-5.15.y 16fdf2c7111b ae98e6b9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_timer_expiry
2025/05/03 13:03 linux-5.15.y 16fdf2c7111b b0714e37 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_timer_expiry
2025/05/02 15:02 linux-5.15.y 16fdf2c7111b d7f099d1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in rose_timer_expiry
2025/05/09 18:23 linux-5.15.y 3b8db0e4f263 77908e5f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_timer_expiry
2025/05/09 12:18 linux-5.15.y 3b8db0e4f263 bb813bcc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_timer_expiry
2025/05/09 05:04 linux-5.15.y 16fdf2c7111b bb813bcc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_timer_expiry
2025/05/06 23:27 linux-5.15.y 16fdf2c7111b 350f4ffc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_timer_expiry
2025/05/06 22:22 linux-5.15.y 16fdf2c7111b 350f4ffc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_timer_expiry
2025/05/06 22:20 linux-5.15.y 16fdf2c7111b 350f4ffc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_timer_expiry
2025/05/06 09:32 linux-5.15.y 16fdf2c7111b ae98e6b9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_timer_expiry
2025/05/06 09:27 linux-5.15.y 16fdf2c7111b ae98e6b9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in rose_timer_expiry
* Struck through repros no longer work on HEAD.