syzbot


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

Status: upstream: reported on 2025/07/09 17:47
Reported-by: syzbot+5f4d957714be889a3ee2@syzkaller.appspotmail.com
First crash: 7d23h, last: 1d14h
Similar bugs (5)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in rose_timer_expiry (3) hams 19 829 now 59d 0/29 upstream: reported on 2025/05/19 14:23
upstream KASAN: slab-use-after-free Read in rose_timer_expiry (2) hams 19 158 64d 188d 28/29 fixed on 2025/05/14 23:24
upstream KASAN: slab-use-after-free Read in rose_timer_expiry hams 19 5 428d 439d 0/29 closed as invalid on 2024/06/04 18:05
linux-5.15 KASAN: use-after-free Read in rose_timer_expiry 19 87 15h15m 76d 0/3 upstream: reported on 2025/05/02 15:02
linux-6.1 KASAN: use-after-free Read in rose_timer_expiry 19 39 22h13m 75d 0/3 upstream: reported on 2025/05/03 12:30

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in rose_timer_expiry+0x46a/0x4b0 net/rose/rose_timer.c:183
Read of size 2 at addr ffff88801db2b82a by task syz.1.416/7529

CPU: 1 PID: 7529 Comm: syz.1.416 Not tainted 6.6.98-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <IRQ>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xac/0x230 mm/kasan/report.c:475
 kasan_report+0x117/0x150 mm/kasan/report.c:588
 rose_timer_expiry+0x46a/0x4b0 net/rose/rose_timer.c:183
 call_timer_fn+0x16e/0x530 kernel/time/timer.c:1700
 expire_timers kernel/time/timer.c:1751 [inline]
 __run_timers+0x52d/0x7d0 kernel/time/timer.c:2022
 run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035
 handle_softirqs+0x280/0x820 kernel/softirq.c:578
 __do_softirq kernel/softirq.c:612 [inline]
 invoke_softirq kernel/softirq.c:452 [inline]
 __irq_exit_rcu+0xc7/0x190 kernel/softirq.c:661
 irq_exit_rcu+0x9/0x20 kernel/softirq.c:673
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1088 [inline]
 sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1088
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:687
RIP: 0010:__set_page_owner_handle+0xc1/0x3c0 mm/page_owner.c:170
Code: 24 10 44 89 f6 e8 8f 29 9e ff 45 39 e6 0f 84 cc 02 00 00 4c 8b 35 cf 02 fd 0a 4b 8d 7c 37 08 48 89 f8 48 c1 e8 03 0f b6 04 18 <84> c0 0f 85 ce 01 00 00 4d 01 fe 8b 44 24 08 41 89 46 08 4c 89 f0
RSP: 0018:ffffc900050e7288 EFLAGS: 00000a06
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000002
RDX: ffff88802a279e00 RSI: 0000000000000001 RDI: ffff88801a901500
RBP: 0000000000000000 R08: dffffc0000000000 R09: 1ffffffff21b4ca4
R10: dffffc0000000000 R11: fffffbfff21b4ca5 R12: 0000000000000000
R13: 0000000000000001 R14: 0000000000000008 R15: ffff88801a9014f0
 __set_page_owner+0x45/0x60 mm/page_owner.c:197
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
 prep_new_page mm/page_alloc.c:1561 [inline]
 get_page_from_freelist+0x195c/0x19f0 mm/page_alloc.c:3191
 __alloc_pages+0x1e3/0x460 mm/page_alloc.c:4457
 __folio_alloc+0x10/0x20 mm/page_alloc.c:4489
 vma_alloc_folio+0x47a/0x8f0 mm/mempolicy.c:2242
 shmem_alloc_folio+0x179/0x230 mm/shmem.c:1680
 shmem_alloc_and_acct_folio+0x189/0x630 mm/shmem.c:1705
 shmem_get_folio_gfp+0xcde/0x2ac0 mm/shmem.c:2042
 shmem_get_folio mm/shmem.c:2165 [inline]
 shmem_write_begin+0xf2/0x420 mm/shmem.c:2707
 generic_perform_write+0x2fb/0x5b0 mm/filemap.c:4016
 shmem_file_write_iter+0xfb/0x120 mm/shmem.c:2884
 call_write_iter include/linux/fs.h:2018 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x43b/0x940 fs/read_write.c:584
 ksys_write+0x147/0x250 fs/read_write.c:637
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f585b58d3df
Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 f9 92 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 4c 93 02 00 48
RSP: 002b:00007f585c383df0 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000001000000 RCX: 00007f585b58d3df
RDX: 0000000001000000 RSI: 00007f5850df7000 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000004424
R10: 0000000000000002 R11: 0000000000000293 R12: 0000000000000003
R13: 00007f585c383ef0 R14: 00007f585c383eb0 R15: 00007f5850df7000
 </TASK>

Allocated by task 5453:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x8f/0xa0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:600 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 kernfs_fop_open+0x3f5/0xcc0 fs/kernfs/file.c:672
 do_dentry_open+0x8c6/0x1500 fs/open.c:929
 do_open fs/namei.c:3632 [inline]
 path_openat+0x274b/0x3190 fs/namei.c:3789
 do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
 do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
 do_sys_open fs/open.c:1434 [inline]
 __do_sys_openat fs/open.c:1450 [inline]
 __se_sys_openat fs/open.c:1445 [inline]
 __x64_sys_openat+0x139/0x160 fs/open.c:1445
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 5453:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:522
 ____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:164 [inline]
 slab_free_hook mm/slub.c:1806 [inline]
 slab_free_freelist_hook+0x130/0x1b0 mm/slub.c:1832
 slab_free mm/slub.c:3816 [inline]
 __kmem_cache_free+0xba/0x1f0 mm/slub.c:3829
 kernfs_fop_release+0x166/0x190 fs/kernfs/file.c:810
 __fput+0x234/0x970 fs/file_table.c:384
 __do_sys_close fs/open.c:1571 [inline]
 __se_sys_close+0x15f/0x220 fs/open.c:1556
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff88801db2b800
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 42 bytes inside of
 freed 512-byte region [ffff88801db2b800, ffff88801db2ba00)

The buggy address belongs to the physical page:
page:ffffea000076ca00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1db28
head:ffffea000076ca00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888017841c80 ffffea00017af300 dead000000000002
raw: 0000000000000000 0000000000100010 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 375, tgid 375 (kworker/u4:2), ts 5768568497, free_ts 0
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
 prep_new_page mm/page_alloc.c:1561 [inline]
 get_page_from_freelist+0x195c/0x19f0 mm/page_alloc.c:3191
 __alloc_pages+0x1e3/0x460 mm/page_alloc.c:4457
 alloc_slab_page+0x5d/0x170 mm/slub.c:1876
 allocate_slab mm/slub.c:2023 [inline]
 new_slab+0x87/0x2e0 mm/slub.c:2076
 ___slab_alloc+0xc6d/0x12f0 mm/slub.c:3230
 __slab_alloc mm/slub.c:3329 [inline]
 __slab_alloc_node mm/slub.c:3382 [inline]
 slab_alloc_node mm/slub.c:3475 [inline]
 __kmem_cache_alloc_node+0x1a2/0x260 mm/slub.c:3524
 kmalloc_trace+0x2a/0xe0 mm/slab_common.c:1098
 kmalloc include/linux/slab.h:600 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 alloc_bprm+0x56/0x9c0 fs/exec.c:1538
 kernel_execve+0x98/0x9c0 fs/exec.c:2023
 call_usermodehelper_exec_async+0x20b/0x350 kernel/umh.c:110
 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88801db2b700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88801db2b780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88801db2b800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff88801db2b880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801db2b900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	24 10                	and    $0x10,%al
   2:	44 89 f6             	mov    %r14d,%esi
   5:	e8 8f 29 9e ff       	call   0xff9e2999
   a:	45 39 e6             	cmp    %r12d,%r14d
   d:	0f 84 cc 02 00 00    	je     0x2df
  13:	4c 8b 35 cf 02 fd 0a 	mov    0xafd02cf(%rip),%r14        # 0xafd02e9
  1a:	4b 8d 7c 37 08       	lea    0x8(%r15,%r14,1),%rdi
  1f:	48 89 f8             	mov    %rdi,%rax
  22:	48 c1 e8 03          	shr    $0x3,%rax
  26:	0f b6 04 18          	movzbl (%rax,%rbx,1),%eax
* 2a:	84 c0                	test   %al,%al <-- trapping instruction
  2c:	0f 85 ce 01 00 00    	jne    0x200
  32:	4d 01 fe             	add    %r15,%r14
  35:	8b 44 24 08          	mov    0x8(%rsp),%eax
  39:	41 89 46 08          	mov    %eax,0x8(%r14)
  3d:	4c 89 f0             	mov    %r14,%rax

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/16 02:17 linux-6.6.y 9247f4e6573a 03fcfc4b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in rose_timer_expiry
2025/07/15 10:40 linux-6.6.y 9247f4e6573a 03fcfc4b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in rose_timer_expiry
2025/07/12 13:22 linux-6.6.y 59a2de10b81a 3cda49cf .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in rose_timer_expiry
2025/07/09 17:46 linux-6.6.y a5df3a702b2c f4e5e155 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in rose_timer_expiry
2025/07/09 17:46 linux-6.6.y a5df3a702b2c f4e5e155 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in rose_timer_expiry
* Struck through repros no longer work on HEAD.