KASAN: use-after-free Read in snd_seq_timer_interrupt

10 views
Skip to first unread message

syzbot

unread,
Mar 23, 2020, 7:55:12 AM3/23/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 01364dad Linux 4.14.174
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=130ae223e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=664dd71881ab2b2d
dashboard link: https://syzkaller.appspot.com/bug?extid=0d4211f386d0172c4af4
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=166c3223e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=105838c5e00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+0d4211...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in snd_seq_timer_interrupt+0x305/0x380 sound/core/seq/seq_timer.c:145
Read of size 8 at addr ffff88808ec0e618 by task swapper/1/0

CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.174-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x13e/0x194 lib/dump_stack.c:58
print_address_description.cold+0x7c/0x1e2 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2ae mm/kasan/report.c:393
snd_seq_timer_interrupt+0x305/0x380 sound/core/seq/seq_timer.c:145
snd_timer_interrupt sound/core/timer.c:869 [inline]
snd_timer_interrupt+0x653/0xec0 sound/core/timer.c:778
call_timer_fn+0x14a/0x650 kernel/time/timer.c:1279
expire_timers kernel/time/timer.c:1318 [inline]
__run_timers kernel/time/timer.c:1636 [inline]
__run_timers kernel/time/timer.c:1604 [inline]
run_timer_softirq+0x52a/0x1390 kernel/time/timer.c:1649
__do_softirq+0x254/0x9bf kernel/softirq.c:288
invoke_softirq kernel/softirq.c:368 [inline]
irq_exit+0x15b/0x1a0 kernel/softirq.c:409
exiting_irq arch/x86/include/asm/apic.h:648 [inline]
smp_apic_timer_interrupt+0x141/0x5e0 arch/x86/kernel/apic/apic.c:1102
apic_timer_interrupt+0x8f/0xa0 arch/x86/entry/entry_64.S:792
</IRQ>
RIP: 0010:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61
RSP: 0018:ffff8880a989fee0 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff10
RAX: 1ffffffff0fa2cd4 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffff8880a988abbc
RBP: ffffffff87d16690 R08: 1ffffffff1124101 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffed1015311468
R13: ffff8880a988a340 R14: 0000000000000000 R15: 0000000000000000
arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline]
default_idle+0x47/0x370 arch/x86/kernel/process.c:566
cpuidle_idle_call kernel/sched/idle.c:156 [inline]
do_idle+0x250/0x3c0 kernel/sched/idle.c:246
cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:351
secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240

Allocated by task 8523:
save_stack+0x32/0xa0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:529
kmem_cache_alloc_trace+0x14d/0x7b0 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
queue_new sound/core/seq/seq_queue.c:113 [inline]
snd_seq_queue_alloc+0x51/0x490 sound/core/seq/seq_queue.c:195
snd_seq_ioctl_create_queue+0xa5/0x2f0 sound/core/seq/seq_clientmgr.c:1528
snd_seq_ioctl+0x1af/0x2f0 sound/core/seq/seq_clientmgr.c:2144
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 8523:
save_stack+0x32/0xa0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcb/0x260 mm/slab.c:3815
snd_seq_queue_client_leave+0x2f/0x120 sound/core/seq/seq_queue.c:604
seq_free_client1.part.0+0xf0/0x270 sound/core/seq/seq_clientmgr.c:263
seq_free_client1 sound/core/seq/seq_clientmgr.c:256 [inline]
seq_free_client+0x6c/0xe0 sound/core/seq/seq_clientmgr.c:285
snd_seq_release+0x4d/0xe0 sound/core/seq/seq_clientmgr.c:367
__fput+0x25f/0x790 fs/file_table.c:210
task_work_run+0x113/0x190 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x9f2/0x2b00 kernel/exit.c:858
do_group_exit+0x100/0x310 kernel/exit.c:955
SYSC_exit_group kernel/exit.c:966 [inline]
SyS_exit_group+0x19/0x20 kernel/exit.c:964
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff88808ec0e5c0
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 88 bytes inside of
512-byte region [ffff88808ec0e5c0, ffff88808ec0e7c0)
The buggy address belongs to the page:
page:ffffea00023b0380 count:1 mapcount:0 mapping:ffff88808ec0e0c0 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88808ec0e0c0 0000000000000000 0000000100000006
raw: ffffea00023b9c60 ffffea00023b1a20 ffff88812fe56940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808ec0e500: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88808ec0e580: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff88808ec0e600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88808ec0e680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88808ec0e700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages