syzbot


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

Status: fixed on 2020/01/03 21:54
Reported-by: syzbot+55e7362a9674c6e2bd5e@syzkaller.appspotmail.com
Fix commit: c6bebccd3c62 ALSA: pcm: oss: Avoid potential buffer overflows
First crash: 1814d, last: 1814d
Fix bisection: fixed by (bisect log) :
commit c6bebccd3c6293e49a291a3339f1230b3e49630a
Author: Takashi Iwai <tiwai@suse.de>
Date: Wed Dec 4 14:48:24 2019 +0000

  ALSA: pcm: oss: Avoid potential buffer overflows

  
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in linear_transfer (3) sound C done 5 1813d 1814d 15/28 fixed on 2020/01/08 01:06
upstream KASAN: slab-out-of-bounds Read in linear_transfer sound C done 7 2076d 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 1807d 1814d 1/1 fixed on 2020/01/10 14:15
upstream KASAN: slab-out-of-bounds Read in linear_transfer (2) sound 1 2047d 2038d 12/28 fixed on 2019/06/24 23:41

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:348 [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/0x940 sound/core/oss/linear.c:88
Read of size 1 at addr ffff888087d97940 by task syz-executor518/8231

CPU: 0 PID: 8231 Comm: syz-executor518 Not tainted 4.19.87-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.cold+0x7c/0x20d mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
 memcpy+0x24/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:348 [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/0x940 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:1475
 snd_pcm_oss_read1 sound/core/oss/pcm_oss.c:1532 [inline]
 snd_pcm_oss_read+0x53a/0x6a0 sound/core/oss/pcm_oss.c:2753
 __vfs_read+0x114/0x800 fs/read_write.c:416
 vfs_read+0x194/0x3d0 fs/read_write.c:452
 ksys_read+0x14f/0x2d0 fs/read_write.c:579
 __do_sys_read fs/read_write.c:589 [inline]
 __se_sys_read fs/read_write.c:587 [inline]
 __x64_sys_read+0x73/0xb0 fs/read_write.c:587
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x44a6f9
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 7b cb fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f0fed3dedb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 000000000044a6f9
RDX: 0000000000000313 RSI: 0000000020000380 RDI: 0000000000000006
RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c
R13: 00007ffee744fbff R14: 00007f0fed3df9c0 R15: 0000000000000000

Allocated by task 8236:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
 __do_kmalloc_node mm/slab.c:3689 [inline]
 __kmalloc_node+0x51/0x80 mm/slab.c:3696
 kmalloc_node include/linux/slab.h:557 [inline]
 kvmalloc_node+0x68/0x100 mm/util.c:423
 kvmalloc include/linux/mm.h:577 [inline]
 kvzalloc include/linux/mm.h:585 [inline]
 snd_pcm_plugin_alloc+0x594/0x760 sound/core/oss/pcm_plugin.c:70
 snd_pcm_plug_alloc+0x146/0x2f0 sound/core/oss/pcm_plugin.c:129
 snd_pcm_oss_change_params_locked+0x210f/0x3750 sound/core/oss/pcm_oss.c:1039
 snd_pcm_oss_change_params+0x7b/0xd0 sound/core/oss/pcm_oss.c:1102
 snd_pcm_oss_get_active_substream+0x136/0x190 sound/core/oss/pcm_oss.c:1119
 snd_pcm_oss_get_rate sound/core/oss/pcm_oss.c:1769 [inline]
 snd_pcm_oss_set_rate sound/core/oss/pcm_oss.c:1761 [inline]
 snd_pcm_oss_ioctl+0x13df/0x3390 sound/core/oss/pcm_oss.c:2609
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:688
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:710
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 5395:
 save_stack+0x45/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:3503 [inline]
 kfree+0xcf/0x220 mm/slab.c:3822
 security_context_to_sid_core.isra.0+0x2e4/0x5b0 security/selinux/ss/services.c:1504
 security_context_to_sid_force+0x3c/0x50 security/selinux/ss/services.c:1566
 selinux_inode_post_setxattr+0x119/0x360 security/selinux/hooks.c:3387
 security_inode_post_setxattr+0xd1/0x150 security/security.c:760
 __vfs_setxattr_noperm+0x343/0x410 fs/xattr.c:183
 vfs_setxattr+0xda/0x100 fs/xattr.c:223
 setxattr+0x26f/0x380 fs/xattr.c:450
 path_setxattr+0x197/0x1b0 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+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888087d97900
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes to the right of
 64-byte region [ffff888087d97900, ffff888087d97940)
The buggy address belongs to the page:
page:ffffea00021f65c0 count:1 mapcount:0 mapping:ffff88812c31c340 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea00028467c8 ffffea00027d6188 ffff88812c31c340
raw: 0000000000000000 ffff888087d97000 0000000100000020 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888087d97800: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff888087d97880: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
>ffff888087d97900: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
                                           ^
 ffff888087d97980: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff888087d97a00: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/12/04 05:49 linux-4.19.y 174651bdf802 0ecb9746 .config console log report syz C ci2-linux-4-19
2019/12/04 01:34 linux-4.19.y 174651bdf802 0ecb9746 .config console log report syz C ci2-linux-4-19
* Struck through repros no longer work on HEAD.