KASAN: use-after-free Read in __kvm_set_memory_region

9 views
Skip to first unread message

syzbot

unread,
Nov 30, 2017, 8:27:04 AM11/30/17
to bornt...@de.ibm.com, da...@redhat.com, elf...@users.sourceforge.net, h...@zytor.com, k...@vger.kernel.org, linux-...@vger.kernel.org, mi...@redhat.com, pbon...@redhat.com, rkr...@redhat.com, syzkall...@googlegroups.com, tg...@linutronix.de, x...@kernel.org
Hello,

syzkaller hit the following crash on
844056fd74ebdd826bd23a7d989597e15f478acb
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.

Unfortunately, I don't have any reproducer for this bug yet.


==================================================================
BUG: KASAN: use-after-free in id_to_memslot include/linux/kvm_host.h:593
[inline]
BUG: KASAN: use-after-free in __kvm_set_memory_region+0x244a/0x24d0
arch/x86/kvm/../../../virt/kvm/kvm_main.c:924
Read of size 2 at addr ffff88018a5f6688 by task syz-executor3/17111

CPU: 0 PID: 17111 Comm: syz-executor3 Not tainted 4.14.0+ #194
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+0x194/0x257 lib/dump_stack.c:53
print_address_description+0x73/0x250 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report+0x25b/0x340 mm/kasan/report.c:409
__asan_report_load2_noabort+0x14/0x20 mm/kasan/report.c:428
id_to_memslot include/linux/kvm_host.h:593 [inline]
__kvm_set_memory_region+0x244a/0x24d0
arch/x86/kvm/../../../virt/kvm/kvm_main.c:924
kvm_set_memory_region+0x2e/0x50
arch/x86/kvm/../../../virt/kvm/kvm_main.c:1058
kvm_vm_ioctl_set_memory_region
arch/x86/kvm/../../../virt/kvm/kvm_main.c:1070 [inline]
kvm_vm_ioctl+0x10bc/0x1c40 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2950
vfs_ioctl fs/ioctl.c:46 [inline]
do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x452707
RSP: 002b:00007f5b13e53008 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 0000000000452707
RDX: 00007f5b13e53480 RSI: 000000004020ae46 RDI: 0000000000000016
RBP: 0000000000000086 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000016 R11: 0000000000000246 R12: 00000000006f5458
R13: 00000000ffffffff R14: 00007f5b13e556d4 R15: 0000000000000000

Allocated by task 17121:
save_stack+0x43/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
__do_kmalloc_node mm/slab.c:3675 [inline]
__kmalloc_node+0x47/0x70 mm/slab.c:3682
kmalloc_node include/linux/slab.h:541 [inline]
kvmalloc_node+0x64/0xd0 mm/util.c:397
kvmalloc include/linux/mm.h:540 [inline]
kvzalloc include/linux/mm.h:548 [inline]
kvm_alloc_memslots arch/x86/kvm/../../../virt/kvm/kvm_main.c:500 [inline]
kvm_create_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:634 [inline]
kvm_dev_ioctl_create_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:3153
[inline]
kvm_dev_ioctl+0xe1f/0x18a0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3204
vfs_ioctl fs/ioctl.c:46 [inline]
do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
entry_SYSCALL_64_fastpath+0x1f/0x96

Freed by task 17121:
save_stack+0x43/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3491 [inline]
kfree+0xca/0x250 mm/slab.c:3806
kvfree+0x36/0x60 mm/util.c:416
__kvm_set_memory_region+0x1758/0x24d0
arch/x86/kvm/../../../virt/kvm/kvm_main.c:1040
__x86_set_memory_region+0x37b/0x7a0 arch/x86/kvm/x86.c:8235
init_rmode_identity_map arch/x86/kvm/vmx.c:4814 [inline]
vmx_create_vcpu+0x255b/0x2f40 arch/x86/kvm/vmx.c:9642
kvm_arch_vcpu_create+0x12c/0x1a0 arch/x86/kvm/x86.c:7743
kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:2439
[inline]
kvm_vm_ioctl+0x469/0x1c40 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2940
vfs_ioctl fs/ioctl.c:46 [inline]
do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
entry_SYSCALL_64_fastpath+0x1f/0x96

The buggy address belongs to the object at ffff88018a5eb680
which belongs to the cache kmalloc-65536 of size 65536
The buggy address is located 45064 bytes inside of
65536-byte region [ffff88018a5eb680, ffff88018a5fb680)
The buggy address belongs to the page:
page:ffffea0006297800 count:1 mapcount:0 mapping:ffff88018a5eb680 index:0x0
compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff88018a5eb680 0000000000000000 0000000100000001
raw: ffffea0006297020 ffffea00061f7020 ffff8801db002500 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88018a5f6580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88018a5f6600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff88018a5f6680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88018a5f6700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88018a5f6780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzk...@googlegroups.com.
Please credit me with: Reported-by: syzbot <syzk...@googlegroups.com>

syzbot will keep track of this bug report.
Once a fix for this bug is committed, please reply to this email with:
#syz fix: exact-commit-title
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug
report.
Note: all commands must start from beginning of the line in the email body.
config.txt
raw.log

Dmitry Vyukov

unread,
Feb 13, 2018, 2:23:25 PM2/13/18
to syzbot, syzkall...@googlegroups.com
old bug bankruptcy

#syz invalid

On Thu, Nov 30, 2017 at 2:27 PM, syzbot
<bot+328205d7e0c7bd7568...@syzkaller.appspotmail.com>
wrote:
> --
> You received this message because you are subscribed to the Google Groups
> "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller-bug...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-bugs/001a113ebb5e0449b0055f333518%40google.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages