KASAN: use-after-free Read in snd_timer_interrupt

Status: auto-closed as invalid on 2020/03/14 16:44
First crash: 1677d, last: 1677d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in snd_timer_interrupt sound syz 1 2470d 2427d 0/27 closed as invalid on 2017/10/27 08:15
android-49 KASAN: use-after-free Read in snd_timer_interrupt syz 2 2213d 1892d 0/3 public: reported syz repro on 2019/04/14 09:28
android-44 KASAN: use-after-free Read in snd_timer_interrupt 1 2089d 2089d 0/2 auto-closed as invalid on 2019/03/29 03:33

Sample crash report:
BUG: KASAN: use-after-free in snd_timer_interrupt sound/core/timer.c:861 [inline]
BUG: KASAN: use-after-free in snd_timer_interrupt+0xbdb/0xed0 sound/core/timer.c:768
Read of size 4 at addr ffff88819e70f790 by task blkid/24535

CPU: 0 PID: 24535 Comm: blkid Not tainted 4.14.154+ #0
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0xe5/0x154 lib/dump_stack.c:58
 print_address_description+0x60/0x226 mm/kasan/report.c:187
 __kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316
 snd_timer_interrupt sound/core/timer.c:861 [inline]
 snd_timer_interrupt+0xbdb/0xed0 sound/core/timer.c:768
 call_timer_fn+0x15b/0x6a0 kernel/time/timer.c:1279
 expire_timers+0x227/0x4c0 kernel/time/timer.c:1318
 __run_timers kernel/time/timer.c:1636 [inline]
 run_timer_softirq+0x1eb/0x5d0 kernel/time/timer.c:1649
 __do_softirq+0x234/0x9ec kernel/softirq.c:288
 invoke_softirq kernel/softirq.c:368 [inline]
 irq_exit+0x114/0x150 kernel/softirq.c:409
 exiting_irq arch/x86/include/asm/apic.h:648 [inline]
 smp_apic_timer_interrupt+0x1a7/0x650 arch/x86/kernel/apic/apic.c:1102
 apic_timer_interrupt+0x8c/0xa0 arch/x86/entry/entry_64.S:792
RIP: 0033:0x7f7e871989b1
RSP: 002b:00007fff52013110 EFLAGS: 00000212 ORIG_RAX: ffffffffffffff10
RAX: 00007f7e873a98b0 RBX: 00007f7e86f6bc22 RCX: 0000000000000040
RDX: 0000000000000000 RSI: 000000000000117c RDI: 00007f7e86f6bc25
RBP: 0000000000000011 R08: 00007f7e873ae870 R09: 0000000000000000
R10: 000000006ffffeff R11: 0000000000000246 R12: 0000000000000023
R13: 00007f7e873a9718 R14: 0000000000002cd7 R15: 7fffffffffffffff

Allocated by task 24516:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_kmalloc.part.0+0x53/0xc0 mm/kasan/common.c:501
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 snd_timer_instance_new+0x4a/0x3c0 sound/core/timer.c:108
 snd_timer_open+0x877/0x1590 sound/core/timer.c:313
 snd_timer_user_tselect sound/core/timer.c:1707 [inline]
 __snd_timer_user_ioctl.isra.0+0x626/0x1fa0 sound/core/timer.c:1970
 snd_timer_user_ioctl+0x75/0xa0 sound/core/timer.c:2000
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0xabe/0x1040 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292

Freed by task 24508:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_slab_free+0x164/0x210 mm/kasan/common.c:463
 slab_free_hook mm/slub.c:1407 [inline]
 slab_free_freelist_hook mm/slub.c:1458 [inline]
 slab_free mm/slub.c:3039 [inline]
 kfree+0x108/0x3a0 mm/slub.c:3976
 snd_timer_close_locked+0x71a/0xb30 sound/core/timer.c:406
 snd_timer_close+0x89/0xf0 sound/core/timer.c:432
 snd_timer_user_release+0x92/0x130 sound/core/timer.c:1456
 __fput+0x25e/0x710 fs/file_table.c:210
 task_work_run+0x125/0x1a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x13b/0x160 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x3a3/0x520 arch/x86/entry/common.c:297

The buggy address belongs to the object at ffff88819e70f780
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 16 bytes inside of
 256-byte region [ffff88819e70f780, ffff88819e70f880)
The buggy address belongs to the page:
page:ffffea000679c3c0 count:1 mapcount:0 mapping:          (null) index:0x0
flags: 0x4000000000000200(slab)
raw: 4000000000000200 0000000000000000 0000000000000000 00000001000c000c
raw: ffffea0006768e80 0000000300000003 ffff8881da802e00 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88819e70f680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88819e70f700: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88819e70f780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88819e70f800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88819e70f880: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/15 16:43 android-4.14 460dc7c31cef cdac920b .config console log report ci-android-414-kasan-gce-root
* Struck through repros no longer work on HEAD.