KASAN: use-after-free Read in remove_wait_queue (2)

13 views
Skip to first unread message

syzbot

unread,
Apr 7, 2020, 2:03:13 AM4/7/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 4520f06b Linux 4.14.175
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10d731cde00000
kernel config: https://syzkaller.appspot.com/x/.config?x=93cf891381c0c347
dashboard link: https://syzkaller.appspot.com/bug?extid=696b1bc8f5d2108298ec
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+696b1b...@syzkaller.appspotmail.com

PPPIOCDETACH file->f_count=2
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3098/0x4620 kernel/locking/lockdep.c:3365
Read of size 8 at addr ffff888042a04f40 by task syz-executor.3/16134

CPU: 1 PID: 16134 Comm: syz-executor.3 Not tainted 4.14.175-syzkaller #0
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+0x13e/0x194 lib/dump_stack.c:58
print_address_description.cold+0x7c/0x1e2 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/0x2ae mm/kasan/report.c:393
__lock_acquire+0x3098/0x4620 kernel/locking/lockdep.c:3365
lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x8c/0xbf kernel/locking/spinlock.c:160
remove_wait_queue+0x1d/0x180 kernel/sched/wait.c:50
ep_remove_wait_queue fs/eventpoll.c:611 [inline]
ep_unregister_pollwait.isra.0+0x9b/0x350 fs/eventpoll.c:629
ep_remove+0x48/0x450 fs/eventpoll.c:792
eventpoll_release_file+0xb9/0x130 fs/eventpoll.c:1020
eventpoll_release include/linux/eventpoll.h:66 [inline]
__fput+0x53e/0x790 fs/file_table.c:201
task_work_run+0x113/0x190 kernel/task_work.c:113
ip_tables: iptables: counters copy to user failed while replacing table
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1d6/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+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45c879
RSP: 002b:00007fd345fbac78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: 0000000000000000 RBX: 00007fd345fbb6d4 RCX: 000000000045c879
RDX: 0000000000000000 RSI: 000000004004743c RDI: 0000000000000003
RBP: 000000000076bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000002cd R14: 00000000004c5210 R15: 000000000076bf0c

Allocated by task 16134:
save_stack+0x32/0xa0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:529
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3689
kmalloc_node include/linux/slab.h:530 [inline]
kvmalloc_node+0x46/0xd0 mm/util.c:397
kvmalloc include/linux/mm.h:531 [inline]
kvzalloc include/linux/mm.h:539 [inline]
alloc_netdev_mqs+0x76/0xb70 net/core/dev.c:8097
ppp_create_interface drivers/net/ppp/ppp_generic.c:3019 [inline]
ppp_unattached_ioctl drivers/net/ppp/ppp_generic.c:864 [inline]
ppp_ioctl+0x1313/0x221a drivers/net/ppp/ppp_generic.c:600
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 16134:
save_stack+0x32/0xa0 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+0xcb/0x260 mm/slab.c:3815
kvfree+0x45/0x50 mm/util.c:416
device_release+0x15f/0x1a0 drivers/base/core.c:833
kobject_cleanup lib/kobject.c:646 [inline]
kobject_release lib/kobject.c:675 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x13e/0x1f0 lib/kobject.c:692
put_device+0x1c/0x30 drivers/base/core.c:2014
free_netdev+0x26f/0x360 net/core/dev.c:8219
ppp_destroy_interface drivers/net/ppp/ppp_generic.c:3101 [inline]
ppp_destroy_interface+0x2d7/0x3b0 drivers/net/ppp/ppp_generic.c:3064
ppp_release+0x122/0x1a0 drivers/net/ppp/ppp_generic.c:414
ppp_ioctl+0x52d/0x221a drivers/net/ppp/ppp_generic.c:626
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff888042a043c0
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 2944 bytes inside of
4096-byte region [ffff888042a043c0, ffff888042a053c0)
The buggy address belongs to the page:
page:ffffea00010a8100 count:1 mapcount:0 mapping:ffff888042a043c0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff888042a043c0 0000000000000000 0000000100000001
raw: ffffea00010a6520 ffffea000282bba0 ffff88812fe56dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888042a04e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888042a04e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888042a04f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888042a04f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888042a05000: 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,
Apr 7, 2020, 2:18:13 AM4/7/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: 4520f06b Linux 4.14.175
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14bd36c7e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=93cf891381c0c347
dashboard link: https://syzkaller.appspot.com/bug?extid=696b1bc8f5d2108298ec
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16991eb3e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=151d983be00000

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

==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3098/0x4620 kernel/locking/lockdep.c:3365
Read of size 8 at addr ffff8880985a5340 by task syz-executor686/6333

CPU: 1 PID: 6333 Comm: syz-executor686 Not tainted 4.14.175-syzkaller #0
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+0x13e/0x194 lib/dump_stack.c:58
print_address_description.cold+0x7c/0x1e2 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/0x2ae mm/kasan/report.c:393
__lock_acquire+0x3098/0x4620 kernel/locking/lockdep.c:3365
lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x8c/0xbf kernel/locking/spinlock.c:160
remove_wait_queue+0x1d/0x180 kernel/sched/wait.c:50
ep_remove_wait_queue fs/eventpoll.c:611 [inline]
ep_unregister_pollwait.isra.0+0x9b/0x350 fs/eventpoll.c:629
ep_remove+0x48/0x450 fs/eventpoll.c:792
eventpoll_release_file+0xb9/0x130 fs/eventpoll.c:1020
eventpoll_release include/linux/eventpoll.h:66 [inline]
__fput+0x53e/0x790 fs/file_table.c:201
task_work_run+0x113/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1d6/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+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4401d9
RSP: 002b:00007ffdcf3becd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000021
RAX: 0000000000000003 RBX: 00000000004002c8 RCX: 00000000004401d9
RDX: 00000000004401d9 RSI: 0000000000000003 RDI: 0000000000000004
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000401a60
R13: 0000000000401af0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6333:
save_stack+0x32/0xa0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:529
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3689
kmalloc_node include/linux/slab.h:530 [inline]
kvmalloc_node+0x46/0xd0 mm/util.c:397
kvmalloc include/linux/mm.h:531 [inline]
kvzalloc include/linux/mm.h:539 [inline]
alloc_netdev_mqs+0x76/0xb70 net/core/dev.c:8097
ppp_create_interface drivers/net/ppp/ppp_generic.c:3019 [inline]
ppp_unattached_ioctl drivers/net/ppp/ppp_generic.c:864 [inline]
ppp_ioctl+0x1313/0x221a drivers/net/ppp/ppp_generic.c:600
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 6333:
save_stack+0x32/0xa0 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+0xcb/0x260 mm/slab.c:3815
kvfree+0x45/0x50 mm/util.c:416
device_release+0x15f/0x1a0 drivers/base/core.c:833
kobject_cleanup lib/kobject.c:646 [inline]
kobject_release lib/kobject.c:675 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x13e/0x1f0 lib/kobject.c:692
put_device+0x1c/0x30 drivers/base/core.c:2014
free_netdev+0x26f/0x360 net/core/dev.c:8219
ppp_destroy_interface drivers/net/ppp/ppp_generic.c:3101 [inline]
ppp_destroy_interface+0x2d7/0x3b0 drivers/net/ppp/ppp_generic.c:3064
ppp_release+0x122/0x1a0 drivers/net/ppp/ppp_generic.c:414
ppp_ioctl+0x52d/0x221a drivers/net/ppp/ppp_generic.c:626
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8880985a47c0
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 2944 bytes inside of
4096-byte region [ffff8880985a47c0, ffff8880985a57c0)
The buggy address belongs to the page:
page:ffffea0002616900 count:1 mapcount:0 mapping:ffff8880985a47c0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff8880985a47c0 0000000000000000 0000000100000001
raw: ffffea00029be3a0 ffffea00026169a0 ffff88812fe56dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880985a5200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880985a5280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880985a5300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880985a5380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880985a5400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Reply all
Reply to author
Forward
0 new messages