KASAN: use-after-free Read in snd_mixer_oss_get_volume1

10 views
Skip to first unread message

syzbot

unread,
Sep 7, 2021, 8:32:32 PM9/7/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: b172b44fcb17 Linux 4.19.206
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=155f41b3300000
kernel config: https://syzkaller.appspot.com/x/.config?x=b9ba3521ce0be3cd
dashboard link: https://syzkaller.appspot.com/bug?extid=248bd82ed0e0bcc729d3
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

Unfortunately, I don't have any reproducer for this issue yet.

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

R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffd762cdc6f R14: 00007f7273d48300 R15: 0000000000022000
IPVS: ftp: loaded support on port[0] = 21
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: use-after-free in snd_mixer_oss_get_volume1+0x574/0x610 sound/core/oss/mixer_oss.c:612
Read of size 4 at addr ffff8880388cd404 by task syz-executor.1/29795

CPU: 1 PID: 29795 Comm: syz-executor.1 Not tainted 4.19.206-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__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_load4_noabort+0x88/0x90 mm/kasan/report.c:432
snd_mixer_oss_get_volume1+0x574/0x610 sound/core/oss/mixer_oss.c:612
snd_mixer_oss_get_volume sound/core/oss/mixer_oss.c:272 [inline]
snd_mixer_oss_ioctl1+0x236/0x18f0 sound/core/oss/mixer_oss.c:372
snd_mixer_oss_ioctl+0x40/0x50 sound/core/oss/mixer_oss.c:382
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
RIP: 0033:0x4665f9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f7273d48188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665f9
RDX: 0000000020000000 RSI: 0000000080254d18 RDI: 0000000000000004
RBP: 00007f7273d481d0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffd762cdc6f R14: 00007f7273d48300 R15: 0000000000022000

Allocated by task 24357:
kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
snd_mixer_oss_build_input+0x640/0xd80 sound/core/oss/mixer_oss.c:1092
snd_mixer_oss_proc_write+0x37e/0x530 sound/core/oss/mixer_oss.c:1232
snd_info_text_entry_release+0xfa/0x260 sound/core/info.c:425
close_pdeo.part.0+0xda/0x2f0 fs/proc/inode.c:176
close_pdeo fs/proc/inode.c:401 [inline]
proc_reg_release+0x21e/0x270 fs/proc/inode.c:395
__fput+0x2ce/0x890 fs/file_table.c:278
task_work_run+0x148/0x1c0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 29793:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
snd_mixer_oss_slot_free+0xf3/0x130 sound/core/oss/mixer_oss.c:955
mixer_slot_clear+0x5a/0xb0 sound/core/oss/mixer_oss.c:963
snd_mixer_oss_build_input+0x7d3/0xd80 sound/core/oss/mixer_oss.c:1100
snd_mixer_oss_proc_write+0x37e/0x530 sound/core/oss/mixer_oss.c:1232
snd_info_text_entry_release+0xfa/0x260 sound/core/info.c:425
close_pdeo.part.0+0xda/0x2f0 fs/proc/inode.c:176
close_pdeo fs/proc/inode.c:401 [inline]
proc_reg_release+0x21e/0x270 fs/proc/inode.c:395
__fput+0x2ce/0x890 fs/file_table.c:278
task_work_run+0x148/0x1c0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880388cd400
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 4 bytes inside of
96-byte region [ffff8880388cd400, ffff8880388cd460)
The buggy address belongs to the page:
page:ffffea0000e23340 count:1 mapcount:0 mapping:ffff88813bff04c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002708648 ffffea0002aebb48 ffff88813bff04c0
raw: 0000000000000000 ffff8880388cd000 0000000100000020 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880388cd300: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff8880388cd380: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
>ffff8880388cd400: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff8880388cd480: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
ffff8880388cd500: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc
==================================================================


---
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

unread,
Sep 7, 2021, 9:46:32 PM9/7/21
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: b172b44fcb17 Linux 4.19.206
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1058d463300000
kernel config: https://syzkaller.appspot.com/x/.config?x=b9ba3521ce0be3cd
dashboard link: https://syzkaller.appspot.com/bug?extid=248bd82ed0e0bcc729d3
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=109c9eb3300000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16a956b3300000

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

==================================================================
BUG: KASAN: use-after-free in snd_mixer_oss_get_volume1+0x574/0x610 sound/core/oss/mixer_oss.c:612
Read of size 4 at addr ffff888098918084 by task syz-executor087/8128

CPU: 1 PID: 8128 Comm: syz-executor087 Not tainted 4.19.206-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__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_load4_noabort+0x88/0x90 mm/kasan/report.c:432
snd_mixer_oss_get_volume1+0x574/0x610 sound/core/oss/mixer_oss.c:612
snd_mixer_oss_get_volume sound/core/oss/mixer_oss.c:272 [inline]
snd_mixer_oss_ioctl1+0x236/0x18f0 sound/core/oss/mixer_oss.c:372
snd_mixer_oss_ioctl+0x40/0x50 sound/core/oss/mixer_oss.c:382
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
RIP: 0033:0x440339
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdb4003348 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000000f4240 RCX: 0000000000440339
RDX: 0000000000000000 RSI: 0000000080254d18 RDI: 0000000000000003
RBP: 00000000004830b6 R08: 0000000000000001 R09: 0000000000000001
R10: 00007ffdb4002dc0 R11: 0000000000000246 R12: 0000000000008a17
R13: 00007ffdb400335c R14: 00007ffdb4003370 R15: 00007ffdb4003360

Allocated by task 8127:
kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
snd_mixer_oss_build_input+0x640/0xd80 sound/core/oss/mixer_oss.c:1092
snd_mixer_oss_proc_write+0x37e/0x530 sound/core/oss/mixer_oss.c:1232
snd_info_text_entry_release+0xfa/0x260 sound/core/info.c:425
close_pdeo.part.0+0xda/0x2f0 fs/proc/inode.c:176
close_pdeo fs/proc/inode.c:401 [inline]
proc_reg_release+0x21e/0x270 fs/proc/inode.c:395
__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

Freed by task 8125:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
snd_mixer_oss_slot_free+0xf3/0x130 sound/core/oss/mixer_oss.c:955
mixer_slot_clear+0x5a/0xb0 sound/core/oss/mixer_oss.c:963
snd_mixer_oss_build_input+0x7d3/0xd80 sound/core/oss/mixer_oss.c:1100
snd_mixer_oss_proc_write+0x37e/0x530 sound/core/oss/mixer_oss.c:1232
snd_info_text_entry_release+0xfa/0x260 sound/core/info.c:425
close_pdeo.part.0+0xda/0x2f0 fs/proc/inode.c:176
close_pdeo fs/proc/inode.c:401 [inline]
proc_reg_release+0x21e/0x270 fs/proc/inode.c:395
__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 ffff888098918080
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 4 bytes inside of
96-byte region [ffff888098918080, ffff8880989180e0)
The buggy address belongs to the page:
page:ffffea0002624600 count:1 mapcount:0 mapping:ffff88813bff04c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002bee108 ffffea0002aea848 ffff88813bff04c0
raw: 0000000000000000 ffff888098918000 0000000100000020 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888098917f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888098918000: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
>ffff888098918080: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff888098918100: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff888098918180: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================

Reply all
Reply to author
Forward
0 new messages