syzbot


KASAN: slab-out-of-bounds Read in resample_shrink

Status: fixed on 2020/04/15 17:19
Subsystems: sound
[Documentation on labels]
Reported-by: syzbot+e1fe9f44fb8ecf4fb5dd@syzkaller.appspotmail.com
Fix commit: f2ecf903ef06 ALSA: pcm: oss: Avoid plugin buffer overflow
First crash: 1525d, last: 1507d
Cause bisection: introduced by (bisect log) :
commit ca0214ee2802dd47239a4e39fb21c5b00ef61b22
Author: Takashi Iwai <tiwai@suse.de>
Date: Fri Mar 22 15:00:54 2019 +0000

  ALSA: pcm: Fix possible OOB access in PCM oss plugins

Crash: KASAN: slab-out-of-bounds Read in resample_shrink (log)
Repro: C syz .config
  
Discussions (13)
Title Replies (including bot) Last reply
[PATCH 4.9 000/102] 4.9.218-rc1 review 112 (112) 2020/04/07 06:05
[PATCH 4.14 000/148] 4.14.175-rc1 review 153 (153) 2020/04/02 22:47
[PATCH 4.4 00/91] 4.4.218-rc1 review 97 (97) 2020/04/02 14:13
[PATCH AUTOSEL 5.5 01/28] thunderbolt: Fix error code in tb_port_is_width_supported() 33 (33) 2020/03/27 06:28
[PATCH AUTOSEL 4.4 1/4] ALSA: hda/realtek: Fix pop noise on ALC225 4 (4) 2020/03/26 23:25
[PATCH AUTOSEL 4.9 1/7] ALSA: hda/realtek: Fix pop noise on ALC225 7 (7) 2020/03/26 23:25
[PATCH AUTOSEL 4.14 01/10] drm/bridge: dw-hdmi: fix AVI frame colorimetry 10 (10) 2020/03/26 23:25
[PATCH AUTOSEL 4.19 01/15] drm/bridge: dw-hdmi: fix AVI frame colorimetry 15 (15) 2020/03/26 23:24
[PATCH AUTOSEL 5.4 01/19] drm/bridge: dw-hdmi: fix AVI frame colorimetry 19 (19) 2020/03/26 23:24
[PATCH 5.5 000/119] 5.5.12-rc1 review 126 (126) 2020/03/25 17:54
[PATCH 5.4 000/102] 5.4.28-rc1 review 106 (106) 2020/03/25 05:15
[PATCH 4.19 00/65] 4.19.113-rc1 review 70 (70) 2020/03/25 04:50
KASAN: slab-out-of-bounds Read in resample_shrink 0 (2) 2020/03/08 07:34
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: slab-out-of-bounds Read in resample_shrink C inconclusive 1 1517d 1517d 0/1 upstream: reported C repro on 2020/03/14 18:45

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in resample_shrink+0x5eb/0x6f0 sound/core/oss/rate.c:160
Read of size 2 at addr ffff88808eed1a00 by task syz-executor480/12626

CPU: 0 PID: 12626 Comm: syz-executor480 Not tainted 5.6.0-rc5-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+0x188/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd3/0x315 mm/kasan/report.c:374
 __kasan_report.cold+0x1a/0x32 mm/kasan/report.c:506
 kasan_report+0xe/0x20 mm/kasan/common.c:641
 resample_shrink+0x5eb/0x6f0 sound/core/oss/rate.c:160
 rate_transfer sound/core/oss/rate.c:279 [inline]
 rate_transfer+0x21a/0x2c0 sound/core/oss/rate.c:249
 snd_pcm_plug_read_transfer+0x180/0x2a0 sound/core/oss/pcm_plugin.c:651
 snd_pcm_oss_read2+0x1d0/0x3e0 sound/core/oss/pcm_oss.c:1460
 snd_pcm_oss_read1 sound/core/oss/pcm_oss.c:1517 [inline]
 snd_pcm_oss_read+0x52b/0x6f0 sound/core/oss/pcm_oss.c:2741
 do_loop_readv_writev fs/read_write.c:714 [inline]
 do_loop_readv_writev fs/read_write.c:701 [inline]
 do_iter_read+0x47f/0x650 fs/read_write.c:935
 vfs_readv+0xf0/0x160 fs/read_write.c:1053
 do_readv+0x133/0x2f0 fs/read_write.c:1090
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4467e9
Code: e8 0c e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 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 0f 83 5b 07 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f9932d7cdb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000013
RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 00000000004467e9
RDX: 0000000000000001 RSI: 0000000020395000 RDI: 0000000000000003
RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c
R13: 00007ffce1e5238f R14: 00007f9932d7d9c0 R15: 000000000000002d

Allocated by task 12626:
 save_stack+0x1b/0x80 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:515 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:488
 kmalloc_node include/linux/slab.h:578 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:574
 kvmalloc include/linux/mm.h:645 [inline]
 kvzalloc include/linux/mm.h:653 [inline]
 snd_pcm_plugin_alloc+0x56c/0x770 sound/core/oss/pcm_plugin.c:70
 snd_pcm_plug_alloc+0x145/0x330 sound/core/oss/pcm_plugin.c:129
 snd_pcm_oss_change_params_locked+0x1f8b/0x34d0 sound/core/oss/pcm_oss.c:1024
 snd_pcm_oss_change_params+0x76/0xd0 sound/core/oss/pcm_oss.c:1087
 snd_pcm_oss_get_active_substream+0x129/0x180 sound/core/oss/pcm_oss.c:1104
 snd_pcm_oss_get_rate sound/core/oss/pcm_oss.c:1754 [inline]
 snd_pcm_oss_set_rate sound/core/oss/pcm_oss.c:1746 [inline]
 snd_pcm_oss_ioctl+0xebe/0x31c0 sound/core/oss/pcm_oss.c:2593
 vfs_ioctl fs/ioctl.c:47 [inline]
 ksys_ioctl+0x11a/0x180 fs/ioctl.c:763
 __do_sys_ioctl fs/ioctl.c:772 [inline]
 __se_sys_ioctl fs/ioctl.c:770 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:770
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 10223:
 save_stack+0x1b/0x80 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:337 [inline]
 __kasan_slab_free+0xf7/0x140 mm/kasan/common.c:476
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x109/0x2b0 mm/slab.c:3757
 tomoyo_supervisor+0x34d/0xee0 security/tomoyo/common.c:2149
 tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline]
 tomoyo_path_number_perm+0x3e9/0x4d0 security/tomoyo/file.c:734
 security_file_ioctl+0x6c/0xb0 security/security.c:1441
 ksys_ioctl+0x50/0x180 fs/ioctl.c:757
 __do_sys_ioctl fs/ioctl.c:772 [inline]
 __se_sys_ioctl fs/ioctl.c:770 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:770
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88808eed1800
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 0 bytes to the right of
 512-byte region [ffff88808eed1800, ffff88808eed1a00)
The buggy address belongs to the page:
page:ffffea00023bb440 refcount:1 mapcount:0 mapping:ffff8880aa000a80 index:0xffff88808eed1c00
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea000260ae48 ffffea0002a1b888 ffff8880aa000a80
raw: ffff88808eed1c00 ffff88808eed1000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808eed1900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88808eed1980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88808eed1a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff88808eed1a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88808eed1b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/15 19:04 upstream d3dca69085e9 749688d2 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2020/03/06 08:54 upstream 63623fd44972 c88c7b75 .config console log report syz C ci-upstream-kasan-gce-smack-root
2020/03/07 06:37 upstream fb279f4e2386 fd2a5f28 .config console log report syz C ci-upstream-kasan-gce-386
2020/03/24 15:48 linux-next 770fbb32d34e 33e14df3 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/03/06 08:06 upstream 63623fd44972 c88c7b75 .config console log report ci-upstream-kasan-gce-smack-root
* Struck through repros no longer work on HEAD.