KASAN: invalid-free in vcs_release

4 views
Skip to first unread message

syzbot

unread,
Sep 1, 2020, 12:37:21 AM9/1/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: f6d5cb9e Linux 4.19.142
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12567656900000
kernel config: https://syzkaller.appspot.com/x/.config?x=30067df04d3254aa
dashboard link: https://syzkaller.appspot.com/bug?extid=9919b855cfcd909838b7
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16c7a279900000

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

batman_adv: batadv0: Interface activated: batadv_slave_1
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
Bluetooth: hci0: command 0x0409 tx timeout
Bluetooth: hci0: command 0x041b tx timeout
==================================================================
BUG: KASAN: double-free or invalid-free in vcs_poll_data_free drivers/tty/vt/vc_screen.c:117 [inline]
BUG: KASAN: double-free or invalid-free in vcs_release+0x49/0x60 drivers/tty/vt/vc_screen.c:672

CPU: 1 PID: 7729 Comm: syz-executor.0 Not tainted 4.19.142-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2fe lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_invalid_free+0x61/0xa0 mm/kasan/report.c:336
__kasan_slab_free+0x1d0/0x1f0 mm/kasan/kasan.c:501
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
vcs_poll_data_free drivers/tty/vt/vc_screen.c:117 [inline]
vcs_release+0x49/0x60 drivers/tty/vt/vc_screen.c:672
__fput+0x2ce/0x890 fs/file_table.c:278
task_work_run+0x148/0x1c0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45d5b9
Code: 5d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f86f54fcc78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e9
RAX: 0000000000000000 RBX: 0000000000002ac0 RCX: 000000000045d5b9
RDX: 0000000000000005 RSI: 0000000000000001 RDI: 0000000000000006
RBP: 000000000118cf88 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000020000040 R11: 0000000000000246 R12: 000000000118cf4c
R13: 00007ffd98115d4f R14: 00007f86f54fd9c0 R15: 000000000118cf4c

Allocated by task 7730:
kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kzalloc include/linux/slab.h:709 [inline]
vcs_poll_data_get.part.0+0x43/0x230 drivers/tty/vt/vc_screen.c:128
vcs_poll_data_get drivers/tty/vt/vc_screen.c:626 [inline]
vcs_poll+0x100/0x130 drivers/tty/vt/vc_screen.c:620
vfs_poll include/linux/poll.h:90 [inline]
ep_item_poll+0x14a/0x3e0 fs/eventpoll.c:892
ep_insert fs/eventpoll.c:1464 [inline]
__do_sys_epoll_ctl fs/eventpoll.c:2124 [inline]
__se_sys_epoll_ctl+0xc45/0x2d80 fs/eventpoll.c:2010
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 7728:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
vcs_poll_data_free drivers/tty/vt/vc_screen.c:117 [inline]
vcs_release+0x49/0x60 drivers/tty/vt/vc_screen.c:672
__fput+0x2ce/0x890 fs/file_table.c:278
task_work_run+0x148/0x1c0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809e494780
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 0 bytes inside of
128-byte region [ffff88809e494780, ffff88809e494800)
The buggy address belongs to the page:
page:ffffea0002792500 count:1 mapcount:0 mapping:ffff88812c39c640 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea0002a11648 ffffea00028f9508 ffff88812c39c640
raw: 0000000000000000 ffff88809e494000 0000000100000015 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809e494680: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
ffff88809e494700: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff88809e494780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88809e494800: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff88809e494880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Oct 1, 2020, 3:42:08 AM10/1/20
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit 37d933e8b41b83bb8278815e366aec5a542b7e31
Author: Al Viro <vi...@zeniv.linux.org.uk>
Date: Wed Sep 2 15:30:48 2020 +0000

fix regression in "epoll: Keep a reference on files added to the check list"

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=12786d83900000
start commit: f6d5cb9e Linux 4.19.142
git tree: linux-4.19.y
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16c7a279900000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: fix regression in "epoll: Keep a reference on files added to the check list"

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages