KASAN: use-after-free Read in remove_wait_queue

7 views
Skip to first unread message

syzbot

unread,
Aug 26, 2019, 12:10:08 PM8/26/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: b5260801 Linux 4.14.140
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10e5e1ca600000
kernel config: https://syzkaller.appspot.com/x/.config?x=a1845e2543d718e1
dashboard link: https://syzkaller.appspot.com/bug?extid=cc0f9b65929af2eb9100
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

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

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

audit: type=1804 audit(1566832162.810:140): pid=7857 uid=0 auid=4294967295
ses=4294967295 subj=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
op="invalid_pcr" cause="open_writers" comm="syz-executor.0"
name="/root/syzkaller-testdir524866147/syzkaller.mWGgcR/32/memory.events"
dev="sda1" ino=16665 res=1
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3098/0x4620
kernel/locking/lockdep.c:3365
Read of size 8 at addr ffff88805b3fb300 by task syz-executor.0/7852

CPU: 1 PID: 7852 Comm: syz-executor.0 Not tainted 4.14.140 #36
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+0x138/0x197 lib/dump_stack.c:53
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
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
__lock_acquire+0x3098/0x4620 kernel/locking/lockdep.c:3365
lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3991
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x95/0xcd kernel/locking/spinlock.c:160
remove_wait_queue+0x20/0x190 kernel/sched/wait.c:50
ep_remove_wait_queue fs/eventpoll.c:611 [inline]
ep_unregister_pollwait.isra.0+0xa5/0x360 fs/eventpoll.c:629
ep_remove+0x4e/0x490 fs/eventpoll.c:792
eventpoll_release_file+0xc6/0x140 fs/eventpoll.c:1020
eventpoll_release include/linux/eventpoll.h:66 [inline]
__fput+0x556/0x7a0 fs/file_table.c:201
____fput+0x16/0x20 fs/file_table.c:244
task_work_run+0x114/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1da/0x220 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x459879
RSP: 002b:00007f9e43859c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000459879
RDX: 0000000000000000 RSI: 000000004004743c RDI: 0000000000000003
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9e4385a6d4
R13: 00000000004c1ae1 R14: 00000000004d4e28 R15: 00000000ffffffff

Allocated by task 7845:
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]
alloc_netdev_mqs+0x7b/0xbc0 net/core/dev.c:8084
ppp_create_interface drivers/net/ppp/ppp_generic.c:3017 [inline]
ppp_unattached_ioctl drivers/net/ppp/ppp_generic.c:864 [inline]
ppp_ioctl+0x1401/0x23bc drivers/net/ppp/ppp_generic.c:600
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 7852:
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
kvfree+0x4d/0x60 mm/util.c:416
netdev_freemem+0x4c/0x60 net/core/dev.c:8036
netdev_release+0x72/0x90 net/core/net-sysfs.c:1497
device_release+0x163/0x1a0 drivers/base/core.c:824
kobject_cleanup lib/kobject.c:646 [inline]
kobject_release lib/kobject.c:675 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put.cold+0x269/0x2f9 lib/kobject.c:692
put_device+0x20/0x30 drivers/base/core.c:1954
free_netdev+0x271/0x360 net/core/dev.c:8206
ppp_destroy_interface drivers/net/ppp/ppp_generic.c:3099 [inline]
ppp_destroy_interface+0x2e3/0x3c0 drivers/net/ppp/ppp_generic.c:3062
ppp_release+0x131/0x1b0 drivers/net/ppp/ppp_generic.c:414
ppp_ioctl+0x546/0x23bc drivers/net/ppp/ppp_generic.c:626
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

The buggy address belongs to the object at ffff88805b3fa780
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 2944 bytes inside of
4096-byte region [ffff88805b3fa780, ffff88805b3fb780)
The buggy address belongs to the page:
page:ffffea00016cfe80 count:1 mapcount:0 mapping:ffff88805b3fa780 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff88805b3fa780 0000000000000000 0000000100000001
raw: ffffea00016cfda0 ffffea00016cffa0 ffff8880aa800dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88805b3fb200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805b3fb280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff88805b3fb300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
kobject: 'kvm' (ffff8880a70f4050): kobject_uevent_env
ffff88805b3fb380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805b3fb400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


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

unread,
Dec 24, 2019, 10:10:07 AM12/24/19
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages