KASAN: use-after-free Read in mon_bin_vma_fault

30 views
Skip to first unread message

syzbot

unread,
Dec 28, 2017, 3:15:04 PM12/28/17
to ak...@linux-foundation.org, ar...@arndb.de, dave....@intel.com, gre...@linuxfoundation.org, kste...@linuxfoundation.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, mi...@kernel.org, syzkall...@googlegroups.com
Hello,

syzkaller hit the following crash on
beacbc68ac3e23821a681adb30b45dc55b17488d
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.


IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+9cd6f6...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.

==================================================================
BUG: KASAN: use-after-free in mon_bin_vma_fault+0x378/0x400
drivers/usb/mon/mon_bin.c:1238
Read of size 8 at addr ffff8801cd040080 by task syz-executor1/5424

CPU: 1 PID: 5424 Comm: syz-executor1 Not tainted 4.15.0-rc5+ #238
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_load8_noabort+0x14/0x20 mm/kasan/report.c:430
mon_bin_vma_fault+0x378/0x400 drivers/usb/mon/mon_bin.c:1238
__do_fault+0xeb/0x30f mm/memory.c:3196
do_read_fault mm/memory.c:3606 [inline]
do_fault mm/memory.c:3706 [inline]
handle_pte_fault mm/memory.c:3937 [inline]
__handle_mm_fault+0x1d8f/0x3ce0 mm/memory.c:4061
handle_mm_fault+0x334/0x8d0 mm/memory.c:4098
faultin_page mm/gup.c:502 [inline]
__get_user_pages+0x50c/0x15f0 mm/gup.c:699
populate_vma_page_range+0x20e/0x2f0 mm/gup.c:1216
__mm_populate+0x23a/0x450 mm/gup.c:1266
mm_populate include/linux/mm.h:2226 [inline]
vm_mmap_pgoff+0x241/0x280 mm/util.c:338
SYSC_mmap_pgoff mm/mmap.c:1533 [inline]
SyS_mmap_pgoff+0x462/0x5f0 mm/mmap.c:1491
SYSC_mmap arch/x86/kernel/sys_x86_64.c:100 [inline]
SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:91
entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x452ac9
RSP: 002b:00007f7721b03c58 EFLAGS: 00000212 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 000000000071bea0 RCX: 0000000000452ac9
RDX: 0000000001000004 RSI: 0000000000004000 RDI: 0000000020ac6000
RBP: 000000000000039b R08: 0000000000000014 R09: 0000000000000000
R10: 0000000000008011 R11: 0000000000000212 R12: 00000000006f2728
R13: 00000000ffffffff R14: 00007f7721b046d4 R15: 0000000000000000

Allocated by task 5424:
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:3610
kmalloc include/linux/slab.h:499 [inline]
kzalloc include/linux/slab.h:688 [inline]
mon_bin_open+0x1ae/0x4a0 drivers/usb/mon/mon_bin.c:703
chrdev_open+0x257/0x730 fs/char_dev.c:417
do_dentry_open+0x667/0xd40 fs/open.c:752
vfs_open+0x107/0x220 fs/open.c:866
do_last fs/namei.c:3379 [inline]
path_openat+0x1151/0x3530 fs/namei.c:3519
do_filp_open+0x25b/0x3b0 fs/namei.c:3554
do_sys_open+0x502/0x6d0 fs/open.c:1059
SYSC_open fs/open.c:1077 [inline]
SyS_open+0x2d/0x40 fs/open.c:1072
entry_SYSCALL_64_fastpath+0x1f/0x96

Freed by task 5433:
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:3488 [inline]
kfree+0xd6/0x260 mm/slab.c:3803
mon_bin_ioctl+0x68d/0xd40 drivers/usb/mon/mon_bin.c:1040
vfs_ioctl fs/ioctl.c:46 [inline]
do_vfs_ioctl+0x1b1/0x1520 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 ffff8801cd040080
which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 0 bytes inside of
2048-byte region [ffff8801cd040080, ffff8801cd040880)
The buggy address belongs to the page:
page:000000003d43a99d count:1 mapcount:0 mapping:0000000083654cb9 index:0x0
compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801cd040080 0000000000000000 0000000100000003
raw: ffffea00072a2e20 ffffea00071e6920 ffff8801db000c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801cd03ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801cd040000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8801cd040080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8801cd040100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801cd040180: 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.

syzbot will keep track of this bug report.
If you forgot to add the Reported-by tag, once the fix for this bug is
merged
into any tree, 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

Eric Biggers

unread,
Feb 2, 2018, 6:23:14 PM2/2/18
to syzbot, ak...@linux-foundation.org, ar...@arndb.de, dave....@intel.com, gre...@linuxfoundation.org, kste...@linuxfoundation.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, mi...@kernel.org, syzkall...@googlegroups.com, zai...@redhat.com
No reproducer, but this seems to have stopped happening; I'm guessing it was
fixed by commit 46eb14a6e158:

#syz fix: USB: fix usbmon BUG trigger

- Eric
Reply all
Reply to author
Forward
0 new messages