KASAN: use-after-free Read in snd_seq_timer_interrupt

9 views
Skip to first unread message

syzbot

unread,
Jun 23, 2021, 7:22:17 AM6/23/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: eb575cd5 Linux 4.19.195
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13785600300000
kernel config: https://syzkaller.appspot.com/x/.config?x=5506475cccaff975
dashboard link: https://syzkaller.appspot.com/bug?extid=5169fc0121896ee7b28a
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=134a8b34300000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16e74444300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+5169fc...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in snd_seq_timer_interrupt+0x316/0x380 sound/core/seq/seq_timer.c:145
Read of size 8 at addr ffff8880a237fcd8 by task syz-executor842/8550

CPU: 0 PID: 8550 Comm: syz-executor842 Not tainted 4.19.195-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:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report mm/kasan/report.c:412 [inline]
__asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
snd_seq_timer_interrupt+0x316/0x380 sound/core/seq/seq_timer.c:145
snd_timer_interrupt.part.0+0x94f/0xf40 sound/core/timer.c:877
snd_timer_interrupt sound/core/timer.c:1116 [inline]
snd_timer_s_function+0x14b/0x1e0 sound/core/timer.c:1116
call_timer_fn+0x177/0x700 kernel/time/timer.c:1338
expire_timers+0x243/0x4e0 kernel/time/timer.c:1375
__run_timers kernel/time/timer.c:1696 [inline]
run_timer_softirq+0x21c/0x670 kernel/time/timer.c:1709
__do_softirq+0x265/0x980 kernel/softirq.c:292
invoke_softirq kernel/softirq.c:372 [inline]
irq_exit+0x215/0x260 kernel/softirq.c:412
exiting_irq arch/x86/include/asm/apic.h:536 [inline]
smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1098
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894
</IRQ>
RIP: 0010:lock_is_held_type+0x187/0x210 kernel/locking/lockdep.c:3951
Code: 00 00 00 00 48 c1 e8 03 80 3c 10 00 75 63 48 83 3d 75 ce a6 08 00 74 2c 48 89 df 57 9d 0f 1f 44 00 00 48 83 c4 08 44 89 e0 5b <5d> 41 5c c3 48 83 c4 08 41 bc 01 00 00 00 5b 44 89 e0 5d 41 5c c3
RSP: 0000:ffff888093c37b60 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000001
RDX: dffffc0000000000 RSI: 00000000ffffffff RDI: 0000000000000286
RBP: ffff8880ac3c4240 R08: ffffffffffffffe8 R09: 0000000000000000
R10: 0000000000000004 R11: 0000000047376564 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: ffff888093c37d48
lock_is_held include/linux/lockdep.h:344 [inline]
___might_sleep+0x227/0x2b0 kernel/sched/core.c:6157
process_huge_page mm/memory.c:4761 [inline]
clear_huge_page+0x98/0x460 mm/memory.c:4822
__do_huge_pmd_anonymous_page mm/huge_memory.c:580 [inline]
do_huge_pmd_anonymous_page+0xbb5/0x1e60 mm/huge_memory.c:737
create_huge_pmd mm/memory.c:4025 [inline]
__handle_mm_fault+0x289c/0x41c0 mm/memory.c:4229
handle_mm_fault+0x436/0xb10 mm/memory.c:4295
__do_page_fault+0x68e/0xd60 arch/x86/mm/fault.c:1412
page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1205
RIP: 0033:0x401854
Code: 48 8d 35 0a 18 08 00 e8 5a 0c 00 00 b8 c0 01 00 20 48 8d 35 36 18 08 00 31 d2 48 89 c7 b9 1d 00 00 00 41 b8 c0 01 00 20 31 c0 <f3> a4 41 b9 80 02 00 20 83 ce ff b9 63 00 00 00 c6 07 00 bf 37 00
RSP: 002b:00007ffd5fe5dda0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 00000000000f4240 RCX: 000000000000001d
RDX: 0000000000000000 RSI: 0000000000483078 RDI: 00000000200001c0
RBP: 0000000000000000 R08: 00000000200001c0 R09: 00007ffd5fe5d810
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000008cfc
R13: 00007ffd5fe5ddac R14: 00007ffd5fe5ddc0 R15: 00007ffd5fe5ddb0

Allocated by task 8540:
kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kzalloc include/linux/slab.h:709 [inline]
queue_new sound/core/seq/seq_queue.c:113 [inline]
snd_seq_queue_alloc+0x51/0x500 sound/core/seq/seq_queue.c:185
snd_seq_ioctl_create_queue+0xab/0x320 sound/core/seq/seq_clientmgr.c:1531
snd_seq_ioctl+0x203/0x400 sound/core/seq/seq_clientmgr.c:2140
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:501 [inline]
do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
__do_sys_ioctl fs/ioctl.c:712 [inline]
__se_sys_ioctl fs/ioctl.c:710 [inline]
__x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8540:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
snd_seq_queue_client_leave+0x31/0x160 sound/core/seq/seq_queue.c:592
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+0x7b/0xf0 sound/core/seq/seq_clientmgr.c:285
snd_seq_release+0x4d/0xe0 sound/core/seq/seq_clientmgr.c:366
__fput+0x2ce/0x890 fs/file_table.c:278
task_work_run+0x148/0x1c0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0xbf3/0x2be0 kernel/exit.c:870
do_group_exit+0x125/0x310 kernel/exit.c:967
__do_sys_exit_group kernel/exit.c:978 [inline]
__se_sys_exit_group kernel/exit.c:976 [inline]
__x64_sys_exit_group+0x3a/0x50 kernel/exit.c:976
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a237fc80
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 88 bytes inside of
512-byte region [ffff8880a237fc80, ffff8880a237fe80)
The buggy address belongs to the page:
page:ffffea000288dfc0 count:1 mapcount:0 mapping:ffff88813bff0940 index:0xffff8880a237f000
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002a733c8 ffffea00028c8988 ffff88813bff0940
raw: ffff8880a237f000 ffff8880a237f000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a237fb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a237fc00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a237fc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880a237fd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a237fd80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages