[moderation] [bluetooth?] KASAN: slab-use-after-free Read in skb_queue_purge_reason

4 views
Skip to first unread message

syzbot

unread,
Dec 31, 2023, 11:33:35 AM12/31/23
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 49fcf34ac908 Merge tag 'wireless-2023-12-19' of git://git...
git tree: net
console output: https://syzkaller.appspot.com/x/log.txt?x=110e67c9e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=314e9ad033a7d3a7
dashboard link: https://syzkaller.appspot.com/bug?extid=43e114defee460f7714b
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
CC: [johan....@gmail.com linux-b...@vger.kernel.org linux-...@vger.kernel.org luiz....@gmail.com mar...@holtmann.org net...@vger.kernel.org]

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7ab056952ffe/disk-49fcf34a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/af77013f207c/vmlinux-49fcf34a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/1ca1b57bdae8/bzImage-49fcf34a.xz

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

==================================================================
BUG: KASAN: slab-use-after-free in skb_queue_empty_lockless include/linux/skbuff.h:1810 [inline]
BUG: KASAN: slab-use-after-free in skb_queue_purge_reason+0x377/0x400 net/core/skbuff.c:3729
Read of size 8 at addr ffff888027f95858 by task syz-executor.5/17344

CPU: 0 PID: 17344 Comm: syz-executor.5 Not tainted 6.7.0-rc6-syzkaller-00166-g49fcf34ac908 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0xc4/0x620 mm/kasan/report.c:475
kasan_report+0xda/0x110 mm/kasan/report.c:588
skb_queue_empty_lockless include/linux/skbuff.h:1810 [inline]
skb_queue_purge_reason+0x377/0x400 net/core/skbuff.c:3729
vhci_flush+0x40/0x50 drivers/bluetooth/hci_vhci.c:65
hci_dev_do_reset net/bluetooth/hci_core.c:623 [inline]
hci_dev_reset+0x22e/0x530 net/bluetooth/hci_core.c:663
hci_sock_ioctl+0x3ce/0x8d0 net/bluetooth/hci_sock.c:1136
sock_do_ioctl+0x113/0x270 net/socket.c:1220
sock_ioctl+0x22e/0x6b0 net/socket.c:1339
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:871 [inline]
__se_sys_ioctl fs/ioctl.c:857 [inline]
__x64_sys_ioctl+0x18f/0x210 fs/ioctl.c:857
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f3d0227cce9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 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 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f3d02f080c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f3d0239bf80 RCX: 00007f3d0227cce9
RDX: 0000000000000000 RSI: 00000000400448cb RDI: 0000000000000006
RBP: 00007f3d022c947a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f3d0239bf80 R15: 00007ffffe627d58
</TASK>

Allocated by task 5097:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:600 [inline]
kzalloc include/linux/slab.h:721 [inline]
vhci_open+0x4c/0x430 drivers/bluetooth/hci_vhci.c:644
misc_open+0x3da/0x4c0 drivers/char/misc.c:165
chrdev_open+0x26d/0x6e0 fs/char_dev.c:414
do_dentry_open+0x8d6/0x18c0 fs/open.c:948
do_open fs/namei.c:3622 [inline]
path_openat+0x1e5a/0x2c50 fs/namei.c:3779
do_filp_open+0x1de/0x430 fs/namei.c:3809
do_sys_openat2+0x176/0x1e0 fs/open.c:1437
do_sys_open fs/open.c:1452 [inline]
__do_sys_openat fs/open.c:1468 [inline]
__se_sys_openat fs/open.c:1463 [inline]
__x64_sys_openat+0x175/0x210 fs/open.c:1463
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b

Freed by task 5097:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522
____kasan_slab_free mm/kasan/common.c:236 [inline]
____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200
kasan_slab_free include/linux/kasan.h:164 [inline]
slab_free_hook mm/slub.c:1800 [inline]
slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826
slab_free mm/slub.c:3809 [inline]
__kmem_cache_free+0xc0/0x180 mm/slub.c:3822
vhci_release+0xc4/0x100 drivers/bluetooth/hci_vhci.c:680
__fput+0x270/0xb70 fs/file_table.c:394
task_work_run+0x14d/0x240 kernel/task_work.c:180
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xa8a/0x2ad0 kernel/exit.c:869
do_group_exit+0xd4/0x2a0 kernel/exit.c:1018
__do_sys_exit_group kernel/exit.c:1029 [inline]
__se_sys_exit_group kernel/exit.c:1027 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1027
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b

The buggy address belongs to the object at ffff888027f95800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 88 bytes inside of
freed 1024-byte region [ffff888027f95800, ffff888027f95c00)

The buggy address belongs to the physical page:
page:ffffea00009fe400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x27f90
head:ffffea00009fe400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888013041dc0 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4845, tgid 4845 (dhcpcd), ts 47355799201, free_ts 47260929561
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1537
prep_new_page mm/page_alloc.c:1544 [inline]
get_page_from_freelist+0xa25/0x36d0 mm/page_alloc.c:3312
__alloc_pages+0x22e/0x2420 mm/page_alloc.c:4568
alloc_pages_mpol+0x258/0x5f0 mm/mempolicy.c:2133
alloc_slab_page mm/slub.c:1870 [inline]
allocate_slab mm/slub.c:2017 [inline]
new_slab+0x283/0x3c0 mm/slub.c:2070
___slab_alloc+0x979/0x1500 mm/slub.c:3223
__slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322
__slab_alloc_node mm/slub.c:3375 [inline]
slab_alloc_node mm/slub.c:3468 [inline]
__kmem_cache_alloc_node+0x131/0x310 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1006 [inline]
__kmalloc_node+0x4c/0x90 mm/slab_common.c:1014
kmalloc_node include/linux/slab.h:620 [inline]
kvmalloc_node+0x99/0x1a0 mm/util.c:617
kvmalloc include/linux/slab.h:738 [inline]
bpf_jit_binary_pack_alloc+0x118/0x330 kernel/bpf/core.c:1105
bpf_int_jit_compile+0x538/0x1450 arch/x86/net/bpf_jit_comp.c:2898
bpf_prog_select_runtime+0x2ed/0x480 kernel/bpf/core.c:2358
bpf_migrate_filter net/core/filter.c:1302 [inline]
bpf_prepare_filter+0xd35/0x1100 net/core/filter.c:1350
bpf_prog_create_from_user+0x1e4/0x2d0 net/core/filter.c:1444
seccomp_prepare_filter kernel/seccomp.c:680 [inline]
seccomp_prepare_user_filter kernel/seccomp.c:717 [inline]
seccomp_set_mode_filter kernel/seccomp.c:1935 [inline]
do_seccomp+0x7bc/0x25a0 kernel/seccomp.c:2055
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1137 [inline]
free_unref_page_prepare+0x4fa/0xaa0 mm/page_alloc.c:2347
free_unref_page+0x33/0x3b0 mm/page_alloc.c:2487
__unfreeze_partials+0x226/0x240 mm/slub.c:2655
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:188 [inline]
slab_post_alloc_hook mm/slab.h:763 [inline]
slab_alloc_node mm/slub.c:3478 [inline]
__kmem_cache_alloc_node+0x195/0x310 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1006 [inline]
__kmalloc+0x49/0x90 mm/slab_common.c:1020
kmalloc include/linux/slab.h:604 [inline]
load_elf_phdrs+0x103/0x210 fs/binfmt_elf.c:526
load_elf_binary+0x1fe/0x4e30 fs/binfmt_elf.c:855
search_binary_handler fs/exec.c:1737 [inline]
exec_binprm fs/exec.c:1779 [inline]
bprm_execve fs/exec.c:1854 [inline]
bprm_execve+0x7f9/0x1a90 fs/exec.c:1810
do_execveat_common.isra.0+0x5d3/0x740 fs/exec.c:1962
do_execve fs/exec.c:2036 [inline]
__do_sys_execve fs/exec.c:2112 [inline]
__se_sys_execve fs/exec.c:2107 [inline]
__x64_sys_execve+0x8c/0xb0 fs/exec.c:2107
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b

Memory state around the buggy address:
ffff888027f95700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888027f95780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888027f95800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888027f95880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888027f95900: 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.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Mar 26, 2024, 12:32:17 PMMar 26
to syzkaller-upst...@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