KASAN: use-after-free Read in skb_dequeue

21 views
Skip to first unread message

syzbot

unread,
Aug 4, 2020, 12:52:21 AM8/4/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 13af6c74 Linux 4.19.136
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15bdbe0a900000
kernel config: https://syzkaller.appspot.com/x/.config?x=5b7578d3b5457a49
dashboard link: https://syzkaller.appspot.com/bug?extid=f086977f0ce58311420d
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=107b0f04900000

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

IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
Bluetooth: hci1: command 0x0409 tx timeout
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x2cb4/0x3ff0 kernel/locking/lockdep.c:3294
Read of size 8 at addr ffff8880940ab640 by task syz-executor.3/11210

CPU: 0 PID: 11210 Comm: syz-executor.3 Not tainted 4.19.136-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_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
kasan_report mm/kasan/report.c:412 [inline]
__asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
__lock_acquire+0x2cb4/0x3ff0 kernel/locking/lockdep.c:3294
lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3907
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:152
skb_dequeue+0x1c/0x170 net/core/skbuff.c:2819
skb_queue_purge+0x21/0x30 net/core/skbuff.c:2857
vhci_flush+0x37/0x50 drivers/bluetooth/hci_vhci.c:292
hci_dev_do_reset net/bluetooth/hci_core.c:1772 [inline]
hci_dev_reset+0x240/0x400 net/bluetooth/hci_core.c:1807
hci_sock_ioctl+0x4d8/0x7a0 net/bluetooth/hci_sock.c:1028
sock_do_ioctl+0xcb/0x2d0 net/socket.c:950
sock_ioctl+0x2ef/0x5d0 net/socket.c:1074
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:501 [inline]
do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
__do_sys_ioctl fs/ioctl.c:712 [inline]
__se_sys_ioctl fs/ioctl.c:710 [inline]
__x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45cc79
Code: 2d b6 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 fb b5 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fe940f51c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000001d300 RCX: 000000000045cc79
RDX: 0000000000000000 RSI: 00000000400448cb RDI: 0000000000000004
RBP: 000000000078bf40 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000078bf0c
R13: 00007ffeac8b2b2f R14: 00007fe940f529c0 R15: 000000000078bf0c

Allocated by task 6491:
kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kzalloc include/linux/slab.h:709 [inline]
vhci_open+0x48/0x310 drivers/bluetooth/hci_vhci.c:326
misc_open+0x372/0x4a0 drivers/char/misc.c:141
chrdev_open+0x266/0x770 fs/char_dev.c:423
do_dentry_open+0x4aa/0x1160 fs/open.c:796
do_last fs/namei.c:3421 [inline]
path_openat+0x793/0x2df0 fs/namei.c:3537
do_filp_open+0x18c/0x3f0 fs/namei.c:3567
do_sys_open+0x3b3/0x520 fs/open.c:1085
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6491:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
vhci_release+0xb0/0xe0 drivers/bluetooth/hci_vhci.c:360
__fput+0x2ce/0x890 fs/file_table.c:278
task_work_run+0x148/0x1c0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0xbb2/0x2b70 kernel/exit.c:887
do_group_exit+0x125/0x310 kernel/exit.c:990
__do_sys_exit_group kernel/exit.c:1001 [inline]
__se_sys_exit_group kernel/exit.c:999 [inline]
__x64_sys_exit_group+0x3a/0x50 kernel/exit.c:999
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880940ab5c0
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 128 bytes inside of
512-byte region [ffff8880940ab5c0, ffff8880940ab7c0)
The buggy address belongs to the page:
page:ffffea0002502ac0 count:1 mapcount:0 mapping:ffff88812c39c940 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea00025194c8 ffffea00025169c8 ffff88812c39c940
raw: 0000000000000000 ffff8880940ab0c0 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880940ab500: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8880940ab580: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8880940ab600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880940ab680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880940ab700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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,
Mar 26, 2021, 3:03:11 PM3/26/21
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit c1a77dbcaa2d7f45fc9cb9f0c525e1c11957bf2a
Author: David Sterba <dst...@suse.com>
Date: Wed Feb 19 14:17:20 2020 +0000

btrfs: raid56: simplify tracking of Q stripe presence

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=17d7b54ed00000
start commit: 13af6c74 Linux 4.19.136
git tree: linux-4.19.y
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=107b0f04900000

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

#syz fix: btrfs: raid56: simplify tracking of Q stripe presence

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