KASAN: use-after-free Read in delete_and_unsubscribe_port

11 views
Skip to first unread message

syzbot

unread,
Jul 30, 2020, 8:26:15 AM7/30/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e5a54aa2 Linux 4.14.190
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=105cb560900000
kernel config: https://syzkaller.appspot.com/x/.config?x=dbb53fc7192d83c3
dashboard link: https://syzkaller.appspot.com/bug?extid=a433a888645ae4eb2f6c
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=104d8c5c900000

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

==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline]
BUG: KASAN: use-after-free in list_empty include/linux/list.h:203 [inline]
BUG: KASAN: use-after-free in delete_and_unsubscribe_port+0x3c7/0x4a0 sound/core/seq/seq_ports.c:548
Read of size 8 at addr ffff88808aa5f890 by task syz-executor.0/22652

CPU: 1 PID: 22652 Comm: syz-executor.0 Not tainted 4.14.190-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
__read_once_size include/linux/compiler.h:183 [inline]
list_empty include/linux/list.h:203 [inline]
delete_and_unsubscribe_port+0x3c7/0x4a0 sound/core/seq/seq_ports.c:548
snd_seq_port_disconnect+0x372/0x500 sound/core/seq/seq_ports.c:628
snd_seq_ioctl_unsubscribe_port+0x1d4/0x370 sound/core/seq/seq_clientmgr.c:1505
snd_seq_kernel_client_ctl+0xcb/0x110 sound/core/seq/seq_clientmgr.c:2360
snd_seq_oss_midi_close+0x29c/0x400 sound/core/seq/oss/seq_oss_midi.c:418
snd_seq_oss_synth_reset+0x39d/0x830 sound/core/seq/oss/seq_oss_synth.c:419
snd_seq_oss_reset+0x64/0x250 sound/core/seq/oss/seq_oss_init.c:448
snd_seq_oss_ioctl+0x9a5/0xc30 sound/core/seq/oss/seq_oss_ioctl.c:106
odev_ioctl+0x4f/0x90 sound/core/seq/oss/seq_oss.c:187
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xff0 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+0x46/0xbb
RIP: 0033:0x45cc79
RSP: 002b:00007fc7fd2b0c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000000154c0 RCX: 000000000045cc79
RDX: 0000000000000000 RSI: 0000000000005100 RDI: 0000000000000003
RBP: 000000000078bfd8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000078bfac
R13: 00007ffdabb79c3f R14: 00007fc7fd2b19c0 R15: 000000000078bfac

Allocated by task 22651:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
snd_seq_port_connect+0x5d/0x4d0 sound/core/seq/seq_ports.c:571
snd_seq_ioctl_subscribe_port+0x1d4/0x370 sound/core/seq/seq_clientmgr.c:1464
snd_seq_kernel_client_ctl+0xcb/0x110 sound/core/seq/seq_clientmgr.c:2360
snd_seq_oss_midi_open+0x485/0x590 sound/core/seq/oss/seq_oss_midi.c:377
snd_seq_oss_synth_setup_midi+0x104/0x4d0 sound/core/seq/oss/seq_oss_synth.c:282
snd_seq_oss_open+0x7a0/0x920 sound/core/seq/oss/seq_oss_init.c:274
odev_open+0x62/0x80 sound/core/seq/oss/seq_oss.c:138
soundcore_open+0x3ee/0x5a0 sound/sound_core.c:640
chrdev_open+0x23c/0x6d0 fs/char_dev.c:423
do_dentry_open+0x44b/0xec0 fs/open.c:777
vfs_open+0x105/0x220 fs/open.c:888
do_last fs/namei.c:3428 [inline]
path_openat+0x628/0x2970 fs/namei.c:3569
do_filp_open+0x179/0x3c0 fs/namei.c:3603
do_sys_open+0x296/0x410 fs/open.c:1081
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 22651:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
snd_seq_port_disconnect+0x3f1/0x500 sound/core/seq/seq_ports.c:632
snd_seq_ioctl_unsubscribe_port+0x1d4/0x370 sound/core/seq/seq_clientmgr.c:1505
snd_seq_kernel_client_ctl+0xcb/0x110 sound/core/seq/seq_clientmgr.c:2360
snd_seq_oss_midi_close+0x29c/0x400 sound/core/seq/oss/seq_oss_midi.c:418
snd_seq_oss_synth_reset+0x39d/0x830 sound/core/seq/oss/seq_oss_synth.c:419
snd_seq_oss_reset+0x64/0x250 sound/core/seq/oss/seq_oss_init.c:448
snd_seq_oss_ioctl+0x9a5/0xc30 sound/core/seq/oss/seq_oss_ioctl.c:106
odev_ioctl+0x4f/0x90 sound/core/seq/oss/seq_oss.c:187
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xff0 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+0x46/0xbb

The buggy address belongs to the object at ffff88808aa5f840
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 80 bytes inside of
128-byte region [ffff88808aa5f840, ffff88808aa5f8c0)
The buggy address belongs to the page:
page:ffffea00022a97c0 count:1 mapcount:0 mapping:ffff88808aa5f000 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88808aa5f000 0000000000000000 0000000100000015
raw: ffffea00022a5960 ffffea00022ebce0 ffff88812fe52640 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808aa5f780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88808aa5f800: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff88808aa5f880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff88808aa5f900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88808aa5f980: fc fc fc fc fc fc fc fc 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

syzbot

unread,
Aug 29, 2020, 1:44:09 PM8/29/20
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit ccafbed8b2f6a9d9298534b39e76da9cb40ff717
Author: Takashi Iwai <ti...@suse.de>
Date: Tue Aug 4 18:58:15 2020 +0000

ALSA: seq: oss: Serialize ioctls

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1036768e900000
start commit: e5a54aa2 Linux 4.14.190
git tree: linux-4.14.y
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1553f66c900000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: ALSA: seq: oss: Serialize ioctls

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages