syzbot


KASAN: use-after-free Read in snd_timer_interrupt

Status: closed as invalid on 2017/10/27 08:15
Subsystems: sound
[Documentation on labels]
Reported-by: syzbot+468fb09240f7574b12891a2962b4dc6a55271f50@syzkaller.appspotmail.com
First crash: 2409d, last: 2409d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 KASAN: use-after-free Read in snd_timer_interrupt 1 1617d 1617d 0/1 auto-closed as invalid on 2020/03/14 16:44
android-49 KASAN: use-after-free Read in snd_timer_interrupt syz 2 2153d 1832d 0/3 public: reported syz repro on 2019/04/14 09:28
android-44 KASAN: use-after-free Read in snd_timer_interrupt 1 2028d 2028d 0/2 auto-closed as invalid on 2019/03/29 03:33

Sample crash report:
BUG: KASAN: use-after-free in snd_timer_interrupt+0x1510/0x1520 sound/core/timer.c:810
Read of size 4 at addr ffff8801d11a2310 by task syz-executor5/9916

CPU: 0 PID: 9916 Comm: syz-executor5 Not tainted 4.13.0-mm1+ #7
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report+0x24e/0x340 mm/kasan/report.c:409
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429
 snd_timer_interrupt+0x1510/0x1520 sound/core/timer.c:810
 snd_timer_s_function+0xbd/0x120 sound/core/timer.c:1043
 call_timer_fn+0x246/0x850 kernel/time/timer.c:1281
 expire_timers kernel/time/timer.c:1320 [inline]
 __run_timers+0x7fd/0xb90 kernel/time/timer.c:1620
 run_timer_softirq+0x4c/0xb0 kernel/time/timer.c:1646
 __do_softirq+0x2bb/0xbd0 kernel/softirq.c:284
 invoke_softirq kernel/softirq.c:364 [inline]
 irq_exit+0x1d3/0x210 kernel/softirq.c:405
 exiting_irq arch/x86/include/asm/apic.h:638 [inline]
 smp_apic_timer_interrupt+0x177/0x710 arch/x86/kernel/apic/apic.c:1048
 apic_timer_interrupt+0x9d/0xb0 arch/x86/entry/entry_64.S:770
 </IRQ>
RIP: 0010:arch_local_irq_enable arch/x86/include/asm/paravirt.h:787 [inline]
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:168 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x56/0x70 kernel/locking/spinlock.c:199
RSP: 0018:ffff8801d6917220 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff10
RAX: dffffc0000000000 RBX: ffff8801db225c00 RCX: 0000000000000000
RDX: 1ffffffff0b592ff RSI: 0000000000000001 RDI: ffffffff85ac97f8
RBP: ffff8801d6917228 R08: ffff8801d6916ba8 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801cf65c500
R13: 1ffff1003ad22e4d R14: ffff8801cff76300 R15: ffff8801cff76300
 finish_lock_switch kernel/sched/sched.h:1335 [inline]
 finish_task_switch+0x1d3/0x740 kernel/sched/core.c:2657
 context_switch kernel/sched/core.c:2793 [inline]
 __schedule+0x8f0/0x2070 kernel/sched/core.c:3366
 schedule+0x108/0x440 kernel/sched/core.c:3425
 freezable_schedule include/linux/freezer.h:171 [inline]
 futex_wait_queue_me+0x3ed/0x7e0 kernel/futex.c:2459
 futex_wait+0x357/0xa00 kernel/futex.c:2574
 do_futex+0x10c6/0x2130 kernel/futex.c:3455
 SYSC_futex kernel/futex.c:3515 [inline]
 SyS_futex+0x260/0x390 kernel/futex.c:3483
 entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x451e59
RSP: 002b:0000000000a6f918 EFLAGS: 00000206 ORIG_RAX: 00000000000000ca
RAX: ffffffffffffffda RBX: 00000000007180dc RCX: 0000000000451e59
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000007180dc
RBP: 0000000000000082 R08: 00000000007180b0 R09: 000000030001dce9
R10: 0000000000a6f980 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000000a6f7ef R14: 00007f78708069c0 R15: 0000000000000002

Allocated by task 9922:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3627
 kmalloc include/linux/slab.h:493 [inline]
 kzalloc include/linux/slab.h:666 [inline]
 snd_timer_instance_new+0xda/0x610 sound/core/timer.c:108
 snd_timer_open+0x902/0x1790 sound/core/timer.c:291
 snd_timer_user_tselect sound/core/timer.c:1655 [inline]
 __snd_timer_user_ioctl sound/core/timer.c:1918 [inline]
 snd_timer_user_ioctl+0x96f/0x32e0 sound/core/timer.c:1948
 vfs_ioctl fs/ioctl.c:45 [inline]
 do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
 SYSC_ioctl fs/ioctl.c:700 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
 entry_SYSCALL_64_fastpath+0x1f/0xbe

Freed by task 9935:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xca/0x250 mm/slab.c:3820
 snd_timer_close+0x888/0xf20 sound/core/timer.c:374
 snd_timer_user_tselect sound/core/timer.c:1645 [inline]
 __snd_timer_user_ioctl sound/core/timer.c:1918 [inline]
 snd_timer_user_ioctl+0x80d/0x32e0 sound/core/timer.c:1948
 vfs_ioctl fs/ioctl.c:45 [inline]
 do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
 SYSC_ioctl fs/ioctl.c:700 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
 entry_SYSCALL_64_fastpath+0x1f/0xbe

The buggy address belongs to the object at ffff8801d11a2300
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 16 bytes inside of
 256-byte region [ffff8801d11a2300, ffff8801d11a2400)
The buggy address belongs to the page:
page:ffffea0007446880 count:1 mapcount:0 mapping:ffff8801d11a2080 index:0x0
flags: 0x200000000000100(slab)
raw: 0200000000000100 ffff8801d11a2080 0000000000000000 000000010000000c
raw: ffffea000763b060 ffffea00074155a0 ffff8801dac007c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d11a2200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d11a2280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8801d11a2300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff8801d11a2380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d11a2400: 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
2017/09/14 03:58 mmots 720bbe532b7c c26ea367 .config console log report syz ci-upstream-mmots-kasan-gce
* Struck through repros no longer work on HEAD.