syzbot


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

Status: closed as dup on 2019/03/22 15:26
Reported-by: syzbot+a39b5d3c50e55e24fb4d@syzkaller.appspotmail.com
First crash: 1255d, last: 1242d

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
Duplicate of (1):
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: slab-out-of-bounds Read in default_write_copy_kernel C done 366 1231d 1354d
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 979d 979d 1/1 fixed on 2020/01/03 21:54
upstream KASAN: slab-out-of-bounds Read in linear_transfer (3) C done 5 978d 979d 16/23 fixed on 2020/01/08 01:06
linux-4.14 KASAN: slab-out-of-bounds Read in linear_transfer C done 4 972d 979d 1/1 fixed on 2020/01/10 14:15
upstream KASAN: slab-out-of-bounds Read in linear_transfer (2) 1 1213d 1204d 13/23 fixed on 2019/06/24 23:41

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:352 [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 ffff88808fbc6d78 by task syz-executor579/11602

CPU: 1 PID: 11602 Comm: syz-executor579 Not tainted 5.0.0+ #25
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+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 check_memory_region_inline mm/kasan/generic.c:185 [inline]
 check_memory_region+0x123/0x190 mm/kasan/generic.c:191
 memcpy+0x24/0x50 mm/kasan/common.c:132
 memcpy include/linux/string.h:352 [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+0x1a1/0x2f0 sound/core/oss/pcm_plugin.c:651
 snd_pcm_oss_read2+0x1f0/0x3f0 sound/core/oss/pcm_oss.c:1474
 snd_pcm_oss_read1 sound/core/oss/pcm_oss.c:1531 [inline]
 snd_pcm_oss_read+0x53a/0x6a0 sound/core/oss/pcm_oss.c:2751
 __vfs_read+0x8d/0x110 fs/read_write.c:416
 vfs_read+0x194/0x3e0 fs/read_write.c:452
 ksys_read+0xea/0x1f0 fs/read_write.c:578
 __do_sys_read fs/read_write.c:588 [inline]
 __se_sys_read fs/read_write.c:586 [inline]
 __x64_sys_read+0x73/0xb0 fs/read_write.c:586
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446839
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:00007f69bcf6ddb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00000000006dbc38 RCX: 0000000000446839
RDX: 0000000000001000 RSI: 00000000200012c0 RDI: 0000000000000003
RBP: 00000000006dbc30 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc3c
R13: 00007ffd6b6ee32f R14: 00007f69bcf6e9c0 R15: 0000000000000000

Allocated by task 11590:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_kmalloc mm/kasan/common.c:497 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:511
 __do_kmalloc_node mm/slab.c:3686 [inline]
 __kmalloc_node+0x4e/0x70 mm/slab.c:3693
 kmalloc_node include/linux/slab.h:588 [inline]
 kvmalloc_node+0x68/0x100 mm/util.c:430
 kvmalloc include/linux/mm.h:605 [inline]
 kvzalloc include/linux/mm.h:613 [inline]
 snd_pcm_plugin_alloc+0x585/0x770 sound/core/oss/pcm_plugin.c:70
 snd_pcm_plug_alloc+0x148/0x330 sound/core/oss/pcm_plugin.c:129
 snd_pcm_oss_change_params_locked+0x2118/0x3750 sound/core/oss/pcm_oss.c:1038
 snd_pcm_oss_change_params+0x7b/0xd0 sound/core/oss/pcm_oss.c:1101
 snd_pcm_oss_get_active_substream+0x136/0x190 sound/core/oss/pcm_oss.c:1118
 snd_pcm_oss_get_rate sound/core/oss/pcm_oss.c:1768 [inline]
 snd_pcm_oss_set_rate sound/core/oss/pcm_oss.c:1760 [inline]
 snd_pcm_oss_ioctl+0x8f7/0x3430 sound/core/oss/pcm_oss.c:2607
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:509 [inline]
 do_vfs_ioctl+0xd6e/0x1390 fs/ioctl.c:696
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
 __do_sys_ioctl fs/ioctl.c:720 [inline]
 __se_sys_ioctl fs/ioctl.c:718 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9487:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:459
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:467
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3821
 tomoyo_realpath_from_path+0x1d1/0x730 security/tomoyo/realpath.c:318
 tomoyo_realpath_nofollow+0xc8/0xdb security/tomoyo/realpath.c:336
 tomoyo_find_next_domain+0x28c/0x1f8a security/tomoyo/domain.c:725
 tomoyo_bprm_check_security security/tomoyo/tomoyo.c:107 [inline]
 tomoyo_bprm_check_security+0x12a/0x1b0 security/tomoyo/tomoyo.c:97
 security_bprm_check+0x69/0xb0 security/security.c:751
 search_binary_handler+0x77/0x570 fs/exec.c:1644
 exec_binprm fs/exec.c:1698 [inline]
 __do_execve_file.isra.0+0x1394/0x23f0 fs/exec.c:1818
 do_execveat_common fs/exec.c:1865 [inline]
 do_execve+0x33/0x40 fs/exec.c:1882
 call_usermodehelper_exec_async+0x5b5/0x740 kernel/umh.c:111
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff88808fbc61c0
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 3000 bytes inside of
 4096-byte region [ffff88808fbc61c0, ffff88808fbc71c0)
The buggy address belongs to the page:
page:ffffea00023ef180 count:1 mapcount:0 mapping:ffff88812c3f0dc0 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea0002348588 ffffea000233f188 ffff88812c3f0dc0
raw: 0000000000000000 ffff88808fbc61c0 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808fbc6c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88808fbc6c80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88808fbc6d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
                                                                ^
 ffff88808fbc6d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88808fbc6e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (7):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce 2019/03/16 16:13 upstream 9c7dc824d9a4 bab43553 .config log report syz C
ci-upstream-kasan-gce-root 2019/03/16 14:49 upstream 9c7dc824d9a4 bab43553 .config log report syz C
ci-upstream-kasan-gce-selinux-root 2019/03/16 11:51 upstream 6c83d0d5eb62 bab43553 .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2019/03/16 12:00 linux-next cf08baa29613 bab43553 .config log report syz C
ci-upstream-kasan-gce-386 2019/03/16 11:31 upstream 6c83d0d5eb62 bab43553 .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/03/03 17:37 upstream c027c7cf1577 1c0e457a .config log report
ci-upstream-kasan-gce-386 2019/03/16 11:08 upstream 6c83d0d5eb62 bab43553 .config log report