syzbot


KASAN: slab-out-of-bounds Read in linear_transfer (3)

Status: fixed on 2020/01/08 01:06
Subsystems: sound
[Documentation on labels]
Reported-by: syzbot+f153bde47a62e0b05f83@syzkaller.appspotmail.com
Fix commit: 4cc8d6505ab8 ALSA: pcm: oss: Avoid potential buffer overflows
First crash: 1815d, last: 1813d
Cause bisection: introduced by (bisect log) :
commit 65766ee0bf7fe8b3be80e2e1c3ef54ad59b29476
Author: Takashi Iwai <tiwai@suse.de>
Date: Fri Nov 9 10:59:45 2018 +0000

  ALSA: oss: Use kvzalloc() for local buffer allocations

Crash: KASAN: slab-out-of-bounds Read in linear_transfer (log)
Repro: C syz .config
  
Discussions (8)
Title Replies (including bot) Last reply
[PATCH 3.16 000/148] 3.16.82-rc1 review 151 (151) 2020/02/09 18:51
[PATCH 4.9 000/199] 4.9.207-stable review 204 (204) 2019/12/20 18:47
[PATCH 4.4 000/162] 4.4.207-stable review 167 (167) 2019/12/20 18:47
[PATCH 4.14 000/267] 4.14.159-stable review 280 (280) 2019/12/17 18:18
[PATCH 4.19 000/243] 4.19.89-stable review 277 (277) 2019/12/13 19:35
[PATCH 5.4 00/92] 5.4.3-stable review 106 (106) 2019/12/13 16:08
[PATCH 5.3 000/105] 5.3.16-stable review 125 (125) 2019/12/13 04:53
KASAN: slab-out-of-bounds Read in linear_transfer (3) 1 (2) 2019/12/04 14:50
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: slab-out-of-bounds Read in linear_transfer C done 2 1815d 1815d 1/1 fixed on 2020/01/03 21:54
upstream KASAN: slab-out-of-bounds Read in linear_transfer sound C done 7 2077d 2077d 0/28 closed as dup on 2019/03/22 15:26
linux-4.14 KASAN: slab-out-of-bounds Read in linear_transfer C done 4 1808d 1815d 1/1 fixed on 2020/01/10 14:15
upstream KASAN: slab-out-of-bounds Read in linear_transfer (2) sound 1 2048d 2039d 12/28 fixed on 2019/06/24 23:41

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:380 [inline]
BUG: KASAN: slab-out-of-bounds in do_convert sound/core/oss/linear.c:48 [inline]
BUG: KASAN: slab-out-of-bounds in convert sound/core/oss/linear.c:81 [inline]
BUG: KASAN: slab-out-of-bounds in linear_transfer sound/core/oss/linear.c:110 [inline]
BUG: KASAN: slab-out-of-bounds in linear_transfer+0x6de/0x970 sound/core/oss/linear.c:88
Read of size 1 at addr ffff88808e07c7c0 by task syz-executor675/9499

CPU: 1 PID: 9499 Comm: syz-executor675 Not tainted 5.4.0-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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:638
 check_memory_region_inline mm/kasan/generic.c:185 [inline]
 check_memory_region+0x134/0x1a0 mm/kasan/generic.c:192
 memcpy+0x24/0x50 mm/kasan/common.c:124
 memcpy include/linux/string.h:380 [inline]
 do_convert sound/core/oss/linear.c:48 [inline]
 convert sound/core/oss/linear.c:81 [inline]
 linear_transfer sound/core/oss/linear.c:110 [inline]
 linear_transfer+0x6de/0x970 sound/core/oss/linear.c:88
 snd_pcm_plug_read_transfer+0x197/0x2e0 sound/core/oss/pcm_plugin.c:651
 snd_pcm_oss_read2+0x1f0/0x3f0 sound/core/oss/pcm_oss.c:1460
 snd_pcm_oss_read1 sound/core/oss/pcm_oss.c:1517 [inline]
 snd_pcm_oss_read+0x548/0x6a0 sound/core/oss/pcm_oss.c:2741
 __vfs_read+0x8a/0x110 fs/read_write.c:425
 vfs_read+0x1f0/0x440 fs/read_write.c:461
 ksys_read+0x14f/0x290 fs/read_write.c:587
 __do_sys_read fs/read_write.c:597 [inline]
 __se_sys_read fs/read_write.c:595 [inline]
 __x64_sys_read+0x73/0xb0 fs/read_write.c:595
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x445829
Code: e8 bc b7 02 00 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 2b 12 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fadef3c4db8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00000000006dac28 RCX: 0000000000445829
RDX: 0000000000001000 RSI: 0000000020000380 RDI: 0000000000000003
RBP: 00000000006dac20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dac2c
R13: 00007fff4d55f95f R14: 00007fadef3c59c0 R15: 20c49ba5e353f7cf

Allocated by task 9499:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_kmalloc mm/kasan/common.c:512 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:485
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:526
 __do_kmalloc_node mm/slab.c:3616 [inline]
 __kmalloc_node+0x4e/0x70 mm/slab.c:3623
 kmalloc_node include/linux/slab.h:579 [inline]
 kvmalloc_node+0x68/0x100 mm/util.c:574
 kvmalloc include/linux/mm.h:655 [inline]
 kvzalloc include/linux/mm.h:663 [inline]
 snd_pcm_plugin_alloc+0x585/0x770 sound/core/oss/pcm_plugin.c:70
 snd_pcm_plug_alloc+0x146/0x330 sound/core/oss/pcm_plugin.c:129
 snd_pcm_oss_change_params_locked+0x210f/0x3750 sound/core/oss/pcm_oss.c:1024
 snd_pcm_oss_change_params+0x7b/0xd0 sound/core/oss/pcm_oss.c:1087
 snd_pcm_oss_get_active_substream+0x136/0x190 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+0x1794/0x33a0 sound/core/oss/pcm_oss.c:2593
 vfs_ioctl fs/ioctl.c:47 [inline]
 file_ioctl fs/ioctl.c:545 [inline]
 do_vfs_ioctl+0x977/0x14e0 fs/ioctl.c:732
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:749
 __do_sys_ioctl fs/ioctl.c:756 [inline]
 __se_sys_ioctl fs/ioctl.c:754 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:754
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff88808e07c780
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes to the right of
 64-byte region [ffff88808e07c780, ffff88808e07c7c0)
The buggy address belongs to the page:
page:ffffea0002381f00 refcount:1 mapcount:0 mapping:ffff8880aa400380 index:0x0
raw: 00fffe0000000200 ffffea00024a99c8 ffff8880aa401348 ffff8880aa400380
raw: 0000000000000000 ffff88808e07c000 0000000100000020 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808e07c680: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff88808e07c700: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff88808e07c780: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
                                           ^
 ffff88808e07c800: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
 ffff88808e07c880: 00 00 00 00 00 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
2019/12/05 13:25 upstream aedc0650f913 b2088328 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/12/05 11:34 upstream aedc0650f913 b2088328 .config console log report syz C ci-upstream-kasan-gce-root
2019/12/04 02:48 upstream 76bb8b05960c ae13a849 .config console log report syz C ci-upstream-kasan-gce
2019/12/05 00:04 upstream 63de37476ebd b2088328 .config console log report syz ci-upstream-kasan-gce-386
2019/12/04 19:54 upstream 63de37476ebd b2088328 .config console log report syz ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.