syzbot


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

Status: fixed on 2020/01/10 14:15
Reported-by: syzbot+1a48ee880cb012baefb7@syzkaller.appspotmail.com
Fix commit: 2a76606d8a83 ALSA: pcm: oss: Avoid potential buffer overflows
First crash: 1816d, last: 1809d
Fix bisection: fixed by (bisect log) :
commit 2a76606d8a830a02ea3a7aef6f5362ceccb8749f
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
linux-4.19 KASAN: slab-out-of-bounds Read in linear_transfer C done 2 1816d 1816d 1/1 fixed on 2020/01/03 21:54
upstream KASAN: slab-out-of-bounds Read in linear_transfer (3) sound C done 5 1814d 1816d 15/28 fixed on 2020/01/08 01:06
upstream KASAN: slab-out-of-bounds Read in linear_transfer sound C done 7 2078d 2078d 0/28 closed as dup on 2019/03/22 15:26
upstream KASAN: slab-out-of-bounds Read in linear_transfer (2) sound 1 2049d 2040d 12/28 fixed on 2019/06/24 23:41

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:347 [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+0x5db/0x840 sound/core/oss/linear.c:88
Read of size 1 at addr ffff8880a5710c40 by task syz-executor619/7059

CPU: 1 PID: 7059 Comm: syz-executor619 Not tainted 4.14.157-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x142/0x197 lib/dump_stack.c:58
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 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:347 [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+0x5db/0x840 sound/core/oss/linear.c:88
 snd_pcm_plug_read_transfer+0x158/0x260 sound/core/oss/pcm_plugin.c:650
 snd_pcm_oss_read2+0x1c2/0x370 sound/core/oss/pcm_oss.c:1475
 snd_pcm_oss_read1 sound/core/oss/pcm_oss.c:1532 [inline]
 snd_pcm_oss_read+0x482/0x5d0 sound/core/oss/pcm_oss.c:2753
 __vfs_read+0x105/0x6a0 fs/read_write.c:411
 vfs_read+0x137/0x350 fs/read_write.c:447
 SYSC_read fs/read_write.c:574 [inline]
 SyS_read+0xfd/0x230 fs/read_write.c:567
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4467c9
RSP: 002b:00007f57faab7db8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 00000000004467c9
RDX: 0000000000001000 RSI: 0000000020000380 RDI: 0000000000000003
RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c
R13: 00007ffcf2e751cf R14: 00007f57faab89c0 R15: 000000000000002d

Allocated by task 7059:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node+0x51/0x80 mm/slab.c:3689
 kmalloc_node include/linux/slab.h:530 [inline]
 kvmalloc_node+0x4e/0xe0 mm/util.c:397
 kvmalloc include/linux/mm.h:531 [inline]
 kvzalloc include/linux/mm.h:539 [inline]
 snd_pcm_plugin_alloc+0x4da/0x740 sound/core/oss/pcm_plugin.c:70
 snd_pcm_plug_alloc+0x13f/0x300 sound/core/oss/pcm_plugin.c:129
 snd_pcm_oss_change_params_locked+0x1d6e/0x32f0 sound/core/oss/pcm_oss.c:1039
 snd_pcm_oss_change_params+0x63/0xb0 sound/core/oss/pcm_oss.c:1102
 snd_pcm_oss_get_active_substream+0x102/0x150 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+0xc2e/0x2e50 sound/core/oss/pcm_oss.c:2609
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 3688:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xcc/0x270 mm/slab.c:3815
 security_context_to_sid_core+0x2b9/0x410 security/selinux/ss/services.c:1460
 security_context_to_sid+0x31/0x40 security/selinux/ss/services.c:1480
 selinux_inode_setxattr+0x328/0x6a0 security/selinux/hooks.c:3214
 security_inode_setxattr+0xf9/0x1c0 security/security.c:732
 vfs_setxattr+0xa8/0xf0 fs/xattr.c:220
 setxattr+0x1de/0x350 fs/xattr.c:453
 path_setxattr+0x11f/0x140 fs/xattr.c:472
 SYSC_lsetxattr fs/xattr.c:494 [inline]
 SyS_lsetxattr+0x38/0x50 fs/xattr.c:490
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8880a5710c00
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes to the right of
 64-byte region [ffff8880a5710c00, ffff8880a5710c40)
The buggy address belongs to the page:
page:ffffea000295c400 count:1 mapcount:0 mapping:ffff8880a5710000 index:0xffff8880a5710e00
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff8880a5710000 ffff8880a5710e00 000000010000001e
raw: ffffea0002468f20 ffff8880aa801338 ffff8880aa800340 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a5710b00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880a5710b80: 00 00 00 00 00 00 00 06 fc fc fc fc fc fc fc fc
>ffff8880a5710c00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
                                           ^
 ffff8880a5710c80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880a5710d00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/12/04 07:06 linux-4.14.y fbc5fe7a54d0 0ecb9746 .config console log report syz C ci2-linux-4-14
2019/12/04 04:28 linux-4.14.y fbc5fe7a54d0 0ecb9746 .config console log report syz C ci2-linux-4-14
2019/12/11 08:50 linux-4.14.y a844dc4c5442 101194eb .config console log report ci2-linux-4-14
2019/12/04 02:43 linux-4.14.y fbc5fe7a54d0 0ecb9746 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.