KASAN: use-after-free Read in snd_pcm_oss_release

13 views
Skip to first unread message

syzbot

unread,
Sep 2, 2020, 12:27:25 AM9/2/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: f6d5cb9e Linux 4.19.142
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17017656900000
kernel config: https://syzkaller.appspot.com/x/.config?x=30067df04d3254aa
dashboard link: https://syzkaller.appspot.com/bug?extid=2e14b29255294d1caa46
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=102dfcf5900000

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

IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
==================================================================
BUG: KASAN: use-after-free in snd_pcm_oss_release+0x283/0x300 sound/core/oss/pcm_oss.c:2554
Read of size 8 at addr ffff8880996de980 by task syz-executor.0/11633

CPU: 1 PID: 11633 Comm: syz-executor.0 Not tainted 4.19.142-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/0x2fe lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1c7 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_pcm_oss_release+0x283/0x300 sound/core/oss/pcm_oss.c:2554
__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
RIP: 0033:0x416f01
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007ffdc3ed2680 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000416f01
RDX: 0000000000000000 RSI: 00000000011904b0 RDI: 0000000000000004
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ffdc3ed2770 R11: 0000000000000293 R12: 00000000011904b0
R13: 0000000000017299 R14: ffffffffffffffff R15: 000000000118cfec

Allocated by task 11641:
kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kzalloc include/linux/slab.h:709 [inline]
snd_pcm_oss_open_file sound/core/oss/pcm_oss.c:2403 [inline]
snd_pcm_oss_open.part.0+0x53e/0x12a0 sound/core/oss/pcm_oss.c:2506
snd_pcm_oss_open+0x3c/0x50 sound/core/oss/pcm_oss.c:2470
soundcore_open+0x445/0x600 sound/sound_core.c:598
chrdev_open+0x266/0x770 fs/char_dev.c:423
do_dentry_open+0x4aa/0x1160 fs/open.c:796
do_last fs/namei.c:3421 [inline]
path_openat+0x793/0x2df0 fs/namei.c:3537
do_filp_open+0x18c/0x3f0 fs/namei.c:3567
do_sys_open+0x3b3/0x520 fs/open.c:1085
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 11641:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2385 [inline]
snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2375 [inline]
snd_pcm_oss_release+0x17e/0x300 sound/core/oss/pcm_oss.c:2563
__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 ffff8880996de980
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
32-byte region [ffff8880996de980, ffff8880996de9a0)
The buggy address belongs to the page:
page:ffffea000265b780 count:1 mapcount:0 mapping:ffff88812c39c1c0 index:0xffff8880996defc1
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea00023f1848 ffffea000265ce48 ffff88812c39c1c0
raw: ffff8880996defc1 ffff8880996de000 000000010000003f 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880996de880: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff8880996de900: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8880996de980: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
^
ffff8880996dea00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff8880996dea80: fb fb fb fb fc fc fc fc fb fb fb fb 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 can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Sep 2, 2020, 5:26:16 AM9/2/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d7e78d08 Linux 4.14.195
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10b0c8ae900000
kernel config: https://syzkaller.appspot.com/x/.config?x=6608b656f49b4e8c
dashboard link: https://syzkaller.appspot.com/bug?extid=fd52902b7e63cdcf0f6c
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1492ca85900000

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

IPv6: ADDRCONF(NETDEV_UP): batadv_slave_1: link is not ready
batman_adv: batadv0: Interface activated: batadv_slave_1
IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
==================================================================
BUG: KASAN: use-after-free in snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2381 [inline]
BUG: KASAN: use-after-free in snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2375 [inline]
BUG: KASAN: use-after-free in snd_pcm_oss_release+0x282/0x2f0 sound/core/oss/pcm_oss.c:2563
Read of size 8 at addr ffff88809fe50e00 by task syz-executor.5/8072

CPU: 0 PID: 8072 Comm: syz-executor.5 Not tainted 4.14.195-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
snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2381 [inline]
snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2375 [inline]
snd_pcm_oss_release+0x282/0x2f0 sound/core/oss/pcm_oss.c:2563
__fput+0x25f/0x7a0 fs/file_table.c:210
task_work_run+0x11f/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x416f01
RSP: 002b:00007fffb64ee950 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000416f01
RDX: 0000000000000000 RSI: 00000000011904b0 RDI: 0000000000000004
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 00007fffb64eea40 R11: 0000000000000293 R12: 00000000011904b0
R13: 000000000000b288 R14: ffffffffffffffff R15: 000000000118cfec

Allocated by task 8074:
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_pcm_oss_open_file sound/core/oss/pcm_oss.c:2403 [inline]
snd_pcm_oss_open.part.0+0x4b4/0x10b0 sound/core/oss/pcm_oss.c:2506
snd_pcm_oss_open+0x32/0x50 sound/core/oss/pcm_oss.c:2470
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 8074:
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_pcm_oss_release_file sound/core/oss/pcm_oss.c:2385 [inline]
snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2375 [inline]
snd_pcm_oss_release+0x173/0x2f0 sound/core/oss/pcm_oss.c:2563
__fput+0x25f/0x7a0 fs/file_table.c:210
task_work_run+0x11f/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff88809fe50e00
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
32-byte region [ffff88809fe50e00, ffff88809fe50e20)
The buggy address belongs to the page:
page:ffffea00027f9400 count:1 mapcount:0 mapping:ffff88809fe50000 index:0xffff88809fe50fc1
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88809fe50000 ffff88809fe50fc1 000000010000003f
raw: ffffea000281fde0 ffffea0002582f20 ffff88812fe521c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809fe50d00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff88809fe50d80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff88809fe50e00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
^
ffff88809fe50e80: 00 00 00 fc fc fc fc fc fb fb fb fb fc fc fc fc
ffff88809fe50f00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc

syzbot

unread,
Oct 2, 2020, 4:33:11 AM10/2/20
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit 37d933e8b41b83bb8278815e366aec5a542b7e31
Author: Al Viro <vi...@zeniv.linux.org.uk>
Date: Wed Sep 2 15:30:48 2020 +0000

fix regression in "epoll: Keep a reference on files added to the check list"

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13d459cb900000
start commit: f6d5cb9e Linux 4.19.142
git tree: linux-4.19.y
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=102dfcf5900000

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

#syz fix: fix regression in "epoll: Keep a reference on files added to the check list"

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Oct 2, 2020, 10:12:07 PM10/2/20
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit c5c6e00f6cc5d3ed0d6464b14e33f2f5c8505888
Author: Al Viro <vi...@zeniv.linux.org.uk>
Date: Wed Sep 2 15:30:48 2020 +0000

fix regression in "epoll: Keep a reference on files added to the check list"

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=12e24c5d900000
start commit: d7e78d08 Linux 4.14.195
git tree: linux-4.14.y
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1492ca85900000
Reply all
Reply to author
Forward
0 new messages