KASAN: use-after-free Read in kvm_irqfd

8 views
Skip to first unread message

syzbot

unread,
Sep 7, 2017, 2:50:05 PM9/7/17
to syzkaller-upst...@googlegroups.com
Hello,

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


CC: [bhakti...@gmail.com bornt...@de.ibm.com
cornel...@de.ibm.com da...@redhat.com h...@zytor.com k...@vger.kernel.org
linux-...@vger.kernel.org mi...@redhat.com pbon...@redhat.com
rkr...@redhat.com tg...@linutronix.de x...@kernel.org]

==================================================================
BUG: KASAN: use-after-free in kvm_irqfd_assign
arch/x86/kvm/../../../virt/kvm/eventfd.c:412 [inline]
BUG: KASAN: use-after-free in kvm_irqfd+0x1c48/0x1d50
arch/x86/kvm/../../../virt/kvm/eventfd.c:572
Read of size 8 at addr ffff880039a6c390 by task syz-executor5/6403

CPU: 1 PID: 6403 Comm: syz-executor5 Not tainted 4.13.0-rc7-next-20170901+
#13
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:16 [inline]
dump_stack+0x194/0x257 lib/dump_stack.c:52
print_address_description+0x73/0x250 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report+0x24e/0x340 mm/kasan/report.c:409
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
kvm_irqfd_assign arch/x86/kvm/../../../virt/kvm/eventfd.c:412 [inline]
kvm_irqfd+0x1c48/0x1d50 arch/x86/kvm/../../../virt/kvm/eventfd.c:572
kvm_vm_ioctl+0x1079/0x1c40 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3032
vfs_ioctl fs/ioctl.c:45 [inline]
do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
SYSC_ioctl fs/ioctl.c:700 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x447299
RSP: 002b:00007f2afe016c08 EFLAGS: 00000296 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000018 RCX: 0000000000447299
RDX: 000000002004ffe0 RSI: 000000004020ae76 RDI: 0000000000000018
RBP: 0000000000000082 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000296 R12: 00000000ffffffff
R13: 0000000000003c30 R14: 00000000006e6cf0 R15: 0000000020036000

Allocated by task 6403:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
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
kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3627
kmalloc include/linux/slab.h:493 [inline]
kzalloc include/linux/slab.h:666 [inline]
kvm_irqfd_assign arch/x86/kvm/../../../virt/kvm/eventfd.c:296 [inline]
kvm_irqfd+0x16c/0x1d50 arch/x86/kvm/../../../virt/kvm/eventfd.c:572
kvm_vm_ioctl+0x1079/0x1c40 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3032
vfs_ioctl fs/ioctl.c:45 [inline]
do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
SYSC_ioctl fs/ioctl.c:700 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
entry_SYSCALL_64_fastpath+0x1f/0xbe

Freed by task 801:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
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:3503 [inline]
kfree+0xca/0x250 mm/slab.c:3820
irqfd_shutdown+0x13c/0x1a0 arch/x86/kvm/../../../virt/kvm/eventfd.c:148
process_one_work+0xbfa/0x1bd0 kernel/workqueue.c:2119
worker_thread+0x223/0x1860 kernel/workqueue.c:2253
kthread+0x39c/0x470 kernel/kthread.c:231
ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431

The buggy address belongs to the object at ffff880039a6c280
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 272 bytes inside of
512-byte region [ffff880039a6c280, ffff880039a6c480)
The buggy address belongs to the page:
page:ffffea0000e69b00 count:1 mapcount:0 mapping:ffff880039a6c000
index:0xffff880039a6ca00
flags: 0x100000000000100(slab)
raw: 0100000000000100 ffff880039a6c000 ffff880039a6ca00 0000000100000005
raw: ffffea0000f40660 ffffea0000e4dc60 ffff88003e800940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff880039a6c280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff880039a6c300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff880039a6c380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff880039a6c400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff880039a6c480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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.

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.
To upstream this report, please reply with:
#syz upstream
config.txt
raw.log

Dmitry Vyukov

unread,
Nov 5, 2017, 3:49:48 AM11/5/17
to syzbot, 'Dmitry Vyukov' via syzkaller-upstream-moderation
This happened once in September, either was fixed or we need a fresh report

#syz invalid

On Thu, Sep 7, 2017 at 9:50 PM, syzbot
<bot+44d33a668fc0cd4843...@syzkaller.appspotmail.com>
wrote:
> --
> You received this message because you are subscribed to the Google Groups
> "syzkaller-upstream-moderation" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller-upstream-m...@googlegroups.com.
> To post to this group, send email to
> syzkaller-upst...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-upstream-moderation/001a113cf29684ef8c05589ded3f%40google.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages