KASAN: slab-out-of-bounds Write in default_read_copy_kernel

5 views
Skip to first unread message

syzbot

unread,
Nov 16, 2019, 5:53:10 PM11/16/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: c555efaf Linux 4.19.84
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=153acb3ae00000
kernel config: https://syzkaller.appspot.com/x/.config?x=9140f2df4ddc6016
dashboard link: https://syzkaller.appspot.com/bug?extid=aef55ef95242f84e5b75
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1777abd6e00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+aef55e...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:348 [inline]
BUG: KASAN: slab-out-of-bounds in default_read_copy_kernel+0xdb/0x130
sound/core/pcm_lib.c:1988
Write of size 5120 at addr ffff888089bf4780 by task syz-executor.3/11155

CPU: 0 PID: 11155 Comm: syz-executor.3 Not tainted 4.19.84 #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+0x38/0x50 mm/kasan/kasan.c:303
memcpy include/linux/string.h:348 [inline]
default_read_copy_kernel+0xdb/0x130 sound/core/pcm_lib.c:1988
interleaved_copy+0xce/0x100 sound/core/pcm_lib.c:2007
__snd_pcm_lib_xfer+0x101d/0x1ce6 sound/core/pcm_lib.c:2220
snd_pcm_oss_read3+0x1ca/0x420 sound/core/oss/pcm_oss.c:1275
io_capture_transfer+0x26c/0x300 sound/core/oss/io.c:73
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:0x45a669
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f9eef677c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045a669
RDX: 0000000000001000 RSI: 0000000020001880 RDI: 0000000000000005
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9eef6786d4
R13: 00000000004c800c R14: 00000000004de068 R15: 00000000ffffffff

Allocated by task 11150:
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+0xbd/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+0x16d/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 9580:
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
kvfree+0x61/0x70 mm/util.c:452
snd_pcm_plugin_free+0xae/0xe0 sound/core/oss/pcm_plugin.c:194
snd_pcm_oss_plugin_clear sound/core/oss/pcm_oss.c:562 [inline]
snd_pcm_oss_release_substream+0x11a/0x1f0 sound/core/oss/pcm_oss.c:2335
snd_pcm_release_substream.part.0+0x209/0x330 sound/core/pcm_native.c:2409
snd_pcm_release_substream+0x61/0x80 sound/core/pcm_native.c:2395
snd_pcm_oss_release_file.part.0+0x75/0xa0 sound/core/oss/pcm_oss.c:2383
snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2378 [inline]
snd_pcm_oss_release+0x116/0x280 sound/core/oss/pcm_oss.c:2563
__fput+0x2dd/0x8b0 fs/file_table.c:278
____fput+0x16/0x20 fs/file_table.c:309
task_work_run+0x145/0x1c0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888089bf4780
which belongs to the cache kmalloc-8192 of size 8192
The buggy address is located 0 bytes inside of
8192-byte region [ffff888089bf4780, ffff888089bf6780)
The buggy address belongs to the page:
page:ffffea000226fd00 count:1 mapcount:0 mapping:ffff88812c3f2080 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffffea0002275008 ffffea000294ab08 ffff88812c3f2080
raw: 0000000000000000 ffff888089bf4780 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888089bf5980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888089bf5a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> ffff888089bf5a80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
^
ffff888089bf5b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888089bf5b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Aug 26, 2022, 1:20:24 PM8/26/22
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages