syzbot


KASAN: use-after-free Read in snd_pcm_oss_release
Status: fixed on 2020/10/03 03:40
Reported-by: syzbot+fd52902b7e63cdcf0f6c@syzkaller.appspotmail.com
Fix commit: c5c6e00f6cc5 fix regression in "epoll: Keep a reference on files added to the check list"
First crash: 633d, last: 633d

Fix bisection: fixed by (bisect log) :
commit c5c6e00f6cc5d3ed0d6464b14e33f2f5c8505888
Author: Al Viro <viro@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"

similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in snd_pcm_oss_release syz done 1 634d 634d 1/1 fixed on 2020/10/02 13:00
upstream KASAN: use-after-free Read in snd_pcm_oss_release 1 640d 639d 17/22 fixed on 2020/09/25 01:17

Sample crash report:
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
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2020/09/02 09:25 linux-4.14.y d7e78d08fa77 abf9ba4f .config log report syz