syzbot


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

Status: fixed on 2019/04/12 08:05
Subsystems: sound
[Documentation on labels]
Reported-by: syzbot+d4503ae45b65c5bc1194@syzkaller.appspotmail.com
Fix commit: ca0214ee2802 ALSA: pcm: Fix possible OOB access in PCM oss plugins
First crash: 2223d, last: 2100d
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 default_write_copy_kernel (log)
Repro: C syz .config
  
Duplicate bugs (1)
duplicates (1):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
KASAN: slab-out-of-bounds Read in linear_transfer sound C done 7 2111d 2112d 0/28 closed as dup on 2019/03/22 15:26
Discussions (8)
Title Replies (including bot) Last reply
[PATCH 3.16 000/157] 3.16.72-rc1 review 162 (162) 2019/08/11 15:25
[PATCH 4.4 000/131] 4.4.178-stable review 144 (144) 2019/04/03 13:40
[PATCH 5.0 000/146] 5.0.6-stable review 155 (155) 2019/04/03 08:56
[PATCH 3.18 00/50] 3.18.138-stable review 54 (54) 2019/04/03 00:05
[PATCH 4.9 00/56] 4.9.167-stable review 62 (62) 2019/04/02 23:54
[PATCH 4.14 000/107] 4.14.110-stable review 113 (113) 2019/04/02 23:45
[PATCH 4.19 000/134] 4.19.33-stable review 140 (140) 2019/04/02 23:34
KASAN: slab-out-of-bounds Read in default_write_copy_kernel 0 (2) 2019/03/20 04:16

Sample crash report:
RDX: 0000000056da83a0 RSI: 00000000200000c0 RDI: 0000000000000004
RBP: 00007ffee7354ef0 R08: 0000000000000001 R09: 00000000004009ce
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005
R13: ffffffffffffffff R14: 0000000000000000 R15: 0000000000000000
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:352 [inline]
BUG: KASAN: slab-out-of-bounds in default_write_copy_kernel+0xe1/0x140 sound/core/pcm_lib.c:1946
Read of size 64 at addr ffff8881d8fa2800 by task syz-executor182/6135

CPU: 0 PID: 6135 Comm: syz-executor182 Not tainted 4.20.0-rc3+ #127
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+0x244/0x39d lib/dump_stack.c:113
 print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
 memcpy+0x23/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:352 [inline]
 default_write_copy_kernel+0xe1/0x140 sound/core/pcm_lib.c:1946
 interleaved_copy+0xd1/0x110 sound/core/pcm_lib.c:2007
 __snd_pcm_lib_xfer+0x115f/0x1f23 sound/core/pcm_lib.c:2227
 snd_pcm_oss_write3+0xe9/0x220 sound/core/oss/pcm_oss.c:1237
 io_playback_transfer+0x27d/0x310 sound/core/oss/io.c:47
 snd_pcm_plug_write_transfer+0x374/0x490 sound/core/oss/pcm_plugin.c:620
 snd_pcm_oss_write2+0x25d/0x450 sound/core/oss/pcm_oss.c:1366
 snd_pcm_oss_write1 sound/core/oss/pcm_oss.c:1432 [inline]
 snd_pcm_oss_write+0x567/0xa60 sound/core/oss/pcm_oss.c:2775
 __vfs_write+0x119/0x9f0 fs/read_write.c:485
 vfs_write+0x1fc/0x560 fs/read_write.c:549
 ksys_write+0x101/0x260 fs/read_write.c:598
 __do_sys_write fs/read_write.c:610 [inline]
 __se_sys_write fs/read_write.c:607 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:607
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x444779
Code: 22 02 00 85 c0 b8 00 00 00 00 48 0f 44 c3 5b c3 90 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 1b d8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffee7354e48 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000444779
RDX: 0000000056da83a0 RSI: 00000000200000c0 RDI: 0000000000000004
RBP: 00007ffee7354ef0 R08: 0000000000000001 R09: 00000000004009ce
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005
R13: ffffffffffffffff R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6135:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc_node mm/slab.c:3684 [inline]
 __kmalloc_node+0x50/0x70 mm/slab.c:3691
 kmalloc_node include/linux/slab.h:589 [inline]
 kvmalloc_node+0x65/0xf0 mm/util.c:416
 kvmalloc include/linux/mm.h:577 [inline]
 kvzalloc include/linux/mm.h:585 [inline]
 snd_pcm_plugin_alloc+0x577/0x770 sound/core/oss/pcm_plugin.c:70
 snd_pcm_plug_alloc+0x218/0x340 sound/core/oss/pcm_plugin.c:117
 snd_pcm_oss_change_params_locked+0x2209/0x3c60 sound/core/oss/pcm_oss.c:1038
 snd_pcm_oss_make_ready_locked+0xbc/0x130 sound/core/oss/pcm_oss.c:1183
 snd_pcm_oss_write1 sound/core/oss/pcm_oss.c:1397 [inline]
 snd_pcm_oss_write+0x51e/0xa60 sound/core/oss/pcm_oss.c:2775
 __vfs_write+0x119/0x9f0 fs/read_write.c:485
 vfs_write+0x1fc/0x560 fs/read_write.c:549
 ksys_write+0x101/0x260 fs/read_write.c:598
 __do_sys_write fs/read_write.c:610 [inline]
 __se_sys_write fs/read_write.c:607 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:607
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4752:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3817
 simple_xattr_set+0x316/0x750 fs/xattr.c:913
 shmem_xattr_handler_set+0x42/0x50 mm/shmem.c:3108
 __vfs_setxattr+0x124/0x180 fs/xattr.c:149
 __vfs_setxattr_noperm+0x11d/0x410 fs/xattr.c:180
 vfs_setxattr+0xd8/0x100 fs/xattr.c:223
 setxattr+0x2ea/0x450 fs/xattr.c:450
 path_setxattr+0x1e3/0x230 fs/xattr.c:469
 __do_sys_lsetxattr fs/xattr.c:491 [inline]
 __se_sys_lsetxattr fs/xattr.c:487 [inline]
 __x64_sys_lsetxattr+0xc1/0x150 fs/xattr.c:487
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8881d8fa2800
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff8881d8fa2800, ffff8881d8fa2820)
The buggy address belongs to the page:
page:ffffea000763e880 count:1 mapcount:0 mapping:ffff8881da8001c0 index:0xffff8881d8fa2fc1
flags: 0x2fffc0000000200(slab)
raw: 02fffc0000000200 ffffea000763edc8 ffffea000763c408 ffff8881da8001c0
raw: ffff8881d8fa2fc1 ffff8881d8fa2000 000000010000003f 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d8fa2700: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8881d8fa2780: fb fb fb fb fc fc fc fc 00 00 01 fc fc fc fc fc
>ffff8881d8fa2800: 00 00 00 00 fc fc fc fc fb fb fb fb fc fc fc fc
                               ^
 ffff8881d8fa2880: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8881d8fa2900: fb fb fb fb fc fc fc fc 00 00 01 fc fc fc fc fc
==================================================================

Crashes (366):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/11/24 19:09 upstream 7c98a4261827 ecc7c870 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2018/11/24 18:24 upstream 7c98a4261827 ecc7c870 .config console log report syz C ci-upstream-kasan-gce-root
2019/03/27 17:31 upstream 14c741de9386 4e668495 .config console log report ci-upstream-kasan-gce-root
2019/03/27 04:15 upstream 65ae689329c5 55684ce1 .config console log report ci-upstream-kasan-gce-root
2019/03/26 05:39 upstream 8c2ffd917477 55684ce1 .config console log report ci-upstream-kasan-gce
2019/03/26 02:09 upstream 8c2ffd917477 55684ce1 .config console log report ci-upstream-kasan-gce-smack-root
2019/03/24 21:38 upstream 1bdd3dbfff7a acbc5b7d .config console log report ci-upstream-kasan-gce-smack-root
2019/03/24 13:30 upstream 1bdd3dbfff7a acbc5b7d .config console log report ci-upstream-kasan-gce-root
2019/03/23 03:45 upstream fd1f297b794c 3361bde5 .config console log report ci-upstream-kasan-gce-smack-root
2019/03/22 15:14 upstream 0939221e6468 dce6e62f .config console log report ci-upstream-kasan-gce-root
2019/03/22 05:37 upstream 0939221e6468 dce6e62f .config console log report ci-upstream-kasan-gce-root
2019/03/20 20:39 upstream babf09c3837f a664c187 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/20 04:27 upstream b7a42146dca3 2458c1c6 .config console log report ci-upstream-kasan-gce
2019/03/19 13:34 upstream 9e98c678c2d6 e4549234 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/19 08:31 upstream 9e98c678c2d6 46264c32 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/19 06:56 upstream 9e98c678c2d6 46264c32 .config console log report ci-upstream-kasan-gce
2019/03/19 04:37 upstream 9e98c678c2d6 46264c32 .config console log report ci-upstream-kasan-gce-root
2019/03/18 19:04 upstream 9e98c678c2d6 4656beca .config console log report ci-upstream-kasan-gce-root
2019/03/17 14:47 upstream a9dce6679d73 ba18afea .config console log report ci-upstream-kasan-gce-smack-root
2019/03/17 07:18 upstream a9dce6679d73 bab43553 .config console log report ci-upstream-kasan-gce-root
2019/03/16 18:23 upstream 9c7dc824d9a4 bab43553 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/16 01:08 upstream 6c83d0d5eb62 bab43553 .config console log report ci-upstream-kasan-gce
2019/03/15 14:39 upstream f261c4e529da bab43553 .config console log report ci-upstream-kasan-gce-smack-root
2019/03/15 08:15 upstream 3b319ee220a8 d72db19b .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/15 06:49 upstream 3b319ee220a8 d72db19b .config console log report ci-upstream-kasan-gce-smack-root
2019/03/15 05:12 upstream 3b319ee220a8 d72db19b .config console log report ci-upstream-kasan-gce-root
2019/03/14 23:35 upstream 3b319ee220a8 d72db19b .config console log report ci-upstream-kasan-gce-root
2019/03/14 15:46 upstream fa3d493f7a57 d09a902e .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/14 13:49 upstream fa3d493f7a57 d09a902e .config console log report ci-upstream-kasan-gce-root
2019/03/14 12:38 upstream fa3d493f7a57 d09a902e .config console log report ci-upstream-kasan-gce
2019/03/14 10:27 upstream fa3d493f7a57 d09a902e .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/12 15:22 upstream ea295481b6e3 a71bfb62 .config console log report ci-upstream-kasan-gce
2019/03/12 10:02 upstream a089e4fed5c5 12365b99 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/11 10:21 upstream 12ad143e1b80 12365b99 .config console log report ci-upstream-kasan-gce
2019/03/11 05:06 upstream 065b6c4c913d 12365b99 .config console log report ci-upstream-kasan-gce-smack-root
2019/03/10 13:48 upstream 6cdc577a18a6 12365b99 .config console log report ci-upstream-kasan-gce-root
2019/03/10 08:52 upstream 6cdc577a18a6 12365b99 .config console log report ci-upstream-kasan-gce-root
2019/03/10 05:45 upstream 6cdc577a18a6 12365b99 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/09 15:52 upstream 38e7571c07be 12365b99 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/09 08:41 upstream 3601fe43e816 12365b99 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/08 18:20 upstream 610cd4eadec4 12365b99 .config console log report ci-upstream-kasan-gce-selinux-root
2018/11/24 18:11 upstream 7c98a4261827 ecc7c870 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/25 13:20 upstream 8c2ffd917477 2c86e0a5 .config console log report ci-upstream-kasan-gce-386
2019/03/24 00:27 upstream a5ed1e96cafd a2cef203 .config console log report ci-upstream-kasan-gce-386
2019/03/10 02:32 upstream 38e7571c07be 12365b99 .config console log report ci-upstream-kasan-gce-386
2019/03/25 04:10 linux-next e382d91f5f80 2c86e0a5 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/03/23 09:34 linux-next e382d91f5f80 3361bde5 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/03/22 09:05 linux-next 32a217bae32c dce6e62f .config console log report ci-upstream-linux-next-kasan-gce-root
2019/03/21 22:06 linux-next 32a217bae32c dce6e62f .config console log report ci-upstream-linux-next-kasan-gce-root
2019/03/21 14:10 linux-next 32a217bae32c 427ea487 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/03/18 20:59 linux-next b99981945914 4656beca .config console log report ci-upstream-linux-next-kasan-gce-root
2019/03/11 01:58 linux-next cf08baa29613 12365b99 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/03/11 00:12 linux-next cf08baa29613 12365b99 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.