syzbot


KASAN: use-after-free Read in snd_pcm_oss_release

Status: fixed on 2020/09/25 01:17
Subsystems: sound
[Documentation on labels]
Reported-by: syzbot+12a3fcd1493ec6585007@syzkaller.appspotmail.com
Fix commit: 77f4689de17c fix regression in "epoll: Keep a reference on files added to the check list"
First crash: 1336d, last: 1336d
Discussions (2)
Title Replies (including bot) Last reply
Re: KASAN: use-after-free Read in snd_pcm_oss_release 1 (1) 2020/08/31 09:45
KASAN: use-after-free Read in snd_pcm_oss_release 0 (1) 2020/08/27 16:34
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 1330d 1330d 1/1 fixed on 2020/10/02 13:00
linux-4.14 KASAN: use-after-free Read in snd_pcm_oss_release syz done 1 1330d 1330d 1/1 fixed on 2020/10/03 03:40

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2367 [inline]
BUG: KASAN: use-after-free in snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2361 [inline]
BUG: KASAN: use-after-free in snd_pcm_oss_release+0x28d/0x300 sound/core/oss/pcm_oss.c:2548
Read of size 8 at addr ffff888026b66480 by task syz-executor.1/27751

CPU: 1 PID: 27751 Comm: syz-executor.1 Not tainted 5.9.0-rc2-next-20200826-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+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2367 [inline]
 snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2361 [inline]
 snd_pcm_oss_release+0x28d/0x300 sound/core/oss/pcm_oss.c:2548
 __fput+0x285/0x920 fs/file_table.c:281
 task_work_run+0xdd/0x190 kernel/task_work.c:141
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:140 [inline]
 exit_to_user_mode_prepare+0x195/0x1c0 kernel/entry/common.c:167
 syscall_exit_to_user_mode+0x59/0x2b0 kernel/entry/common.c:242
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
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:00007ffdd39a5e70 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000416f01
RDX: 0000000000000001 RSI: 0000000001190428 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ffdd39a5f60 R11: 0000000000000293 R12: 0000000001190428
R13: 0000000000268c54 R14: ffffffffffffffff R15: 000000000118cfec

Allocated by task 27754:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
 kmem_cache_alloc_trace+0x16e/0x2c0 mm/slab.c:3550
 kmalloc include/linux/slab.h:554 [inline]
 kzalloc include/linux/slab.h:666 [inline]
 snd_pcm_oss_open_file sound/core/oss/pcm_oss.c:2389 [inline]
 snd_pcm_oss_open.part.0+0x55e/0x1290 sound/core/oss/pcm_oss.c:2491
 snd_pcm_oss_open+0x3c/0x50 sound/core/oss/pcm_oss.c:2455
 soundcore_open+0x445/0x600 sound/sound_core.c:593
 chrdev_open+0x266/0x770 fs/char_dev.c:414
 do_dentry_open+0x4b9/0x11b0 fs/open.c:817
 do_open fs/namei.c:3251 [inline]
 path_openat+0x1b9a/0x2730 fs/namei.c:3368
 do_filp_open+0x17e/0x3c0 fs/namei.c:3395
 do_sys_openat2+0x16d/0x420 fs/open.c:1168
 do_sys_open fs/open.c:1184 [inline]
 __do_sys_openat fs/open.c:1200 [inline]
 __se_sys_openat fs/open.c:1195 [inline]
 __x64_sys_openat+0x13f/0x1f0 fs/open.c:1195
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 27754:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56
 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355
 __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:422
 __cache_free mm/slab.c:3418 [inline]
 kfree+0x103/0x2c0 mm/slab.c:3756
 snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2371 [inline]
 snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2361 [inline]
 snd_pcm_oss_release+0x17e/0x300 sound/core/oss/pcm_oss.c:2548
 __fput+0x285/0x920 fs/file_table.c:281
 task_work_run+0xdd/0x190 kernel/task_work.c:141
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:140 [inline]
 exit_to_user_mode_prepare+0x195/0x1c0 kernel/entry/common.c:167
 syscall_exit_to_user_mode+0x59/0x2b0 kernel/entry/common.c:242
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff888026b66480
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff888026b66480, ffff888026b664a0)
The buggy address belongs to the page:
page:0000000076bbbb49 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888026b66fc1 pfn:0x26b66
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea0002385208 ffffea0000782448 ffff8880aa040100
raw: ffff888026b66fc1 ffff888026b66000 000000010000002e 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888026b66380: fa fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff888026b66400: 00 fc fc fc fc fc fc fc 00 00 00 00 fc fc fc fc
>ffff888026b66480: fa fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                   ^
 ffff888026b66500: 00 fc fc fc fc fc fc fc 00 fc fc fc fc fc fc fc
 ffff888026b66580: fa fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/08/27 04:37 linux-next f37be72473a0 318430cb .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.