[v6.1] KASAN: use-after-free Read in skb_queue_purge (2)

1 view
Skip to first unread message

syzbot

unread,
Dec 3, 2024, 8:20:28 AMDec 3
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e4d90d63d385 Linux 6.1.119
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=146b75e8580000
kernel config: https://syzkaller.appspot.com/x/.config?x=5516a02be29a5649
dashboard link: https://syzkaller.appspot.com/bug?extid=40cbad34045cf6a80a4d
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/19f991f20183/disk-e4d90d63.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/61eb5f055f38/vmlinux-e4d90d63.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0ddd97416681/bzImage-e4d90d63.xz

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

==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x77/0x1f80 kernel/locking/lockdep.c:4919
Read of size 8 at addr ffff888073b19888 by task syz.8.1050/11416

CPU: 0 PID: 11416 Comm: syz.8.1050 Not tainted 6.1.119-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:395
kasan_report+0x136/0x160 mm/kasan/report.c:495
__lock_acquire+0x77/0x1f80 kernel/locking/lockdep.c:4919
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
skb_dequeue net/core/skbuff.c:3421 [inline]
skb_queue_purge+0x2e/0x1c0 net/core/skbuff.c:3459
vhci_flush+0x3b/0x40 drivers/bluetooth/hci_vhci.c:69
hci_dev_do_reset net/bluetooth/hci_core.c:579 [inline]
hci_dev_reset+0x418/0x5b0 net/bluetooth/hci_core.c:619
sock_do_ioctl+0x152/0x450 net/socket.c:1204
sock_ioctl+0x47f/0x770 net/socket.c:1321
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fe27bb7ff19
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe27b9de058 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fe27bd46080 RCX: 00007fe27bb7ff19
RDX: 0000000000000000 RSI: 00000000400448cb RDI: 0000000000000006
RBP: 00007fe27bbf3986 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fe27bd46080 R15: 00007ffdba2681c8
</TASK>

Allocated by task 11076:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:557 [inline]
kzalloc include/linux/slab.h:693 [inline]
vhci_open+0x53/0x360 drivers/bluetooth/hci_vhci.c:543
misc_open+0x304/0x380 drivers/char/misc.c:143
chrdev_open+0x54a/0x630 fs/char_dev.c:414
do_dentry_open+0x7f9/0x10f0 fs/open.c:882
do_open fs/namei.c:3626 [inline]
path_openat+0x2644/0x2e60 fs/namei.c:3783
do_filp_open+0x230/0x480 fs/namei.c:3810
do_sys_openat2+0x13b/0x4f0 fs/open.c:1318
do_sys_open fs/open.c:1334 [inline]
__do_sys_openat fs/open.c:1350 [inline]
__se_sys_openat fs/open.c:1345 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1345
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 11076:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
__kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
vhci_release+0xb6/0xd0 drivers/bluetooth/hci_vhci.c:579
__fput+0x3f6/0x8d0 fs/file_table.c:320
task_work_run+0x246/0x300 kernel/task_work.c:203
exit_task_work include/linux/task_work.h:39 [inline]
do_exit+0xa73/0x26a0 kernel/exit.c:871
do_group_exit+0x202/0x2b0 kernel/exit.c:1021
__do_sys_exit_group kernel/exit.c:1032 [inline]
__se_sys_exit_group kernel/exit.c:1030 [inline]
__x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1030
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
kvfree_call_rcu+0x116/0x8c0 kernel/rcu/tree.c:3401
batadv_hardif_release net/batman-adv/hard-interface.c:55 [inline]
kref_put include/linux/kref.h:65 [inline]
batadv_hardif_put net/batman-adv/hard-interface.h:95 [inline]
batadv_hard_if_event+0x774/0x1540 net/batman-adv/hard-interface.c:1014
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
call_netdevice_notifiers_info net/core/dev.c:1970 [inline]
call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
call_netdevice_notifiers net/core/dev.c:2022 [inline]
unregister_netdevice_many+0xebf/0x17a0 net/core/dev.c:10890
unregister_netdevice_queue+0x2e6/0x350 net/core/dev.c:10821
unregister_netdevice include/linux/netdevice.h:3045 [inline]
nsim_destroy+0x44/0x140 drivers/net/netdevsim/netdev.c:382
__nsim_dev_port_del+0x153/0x1b0 drivers/net/netdevsim/dev.c:1433
nsim_dev_port_del_all drivers/net/netdevsim/dev.c:1445 [inline]
nsim_dev_reload_destroy+0x286/0x490 drivers/net/netdevsim/dev.c:1662
nsim_dev_reload_down+0x94/0xc0 drivers/net/netdevsim/dev.c:968
devlink_reload+0x1eb/0x6a0 net/devlink/leftover.c:4472
devlink_pernet_pre_exit+0x150/0x2f0 net/devlink/leftover.c:12501
ops_pre_exit_list net/core/net_namespace.c:162 [inline]
cleanup_net+0x59c/0xb60 net/core/net_namespace.c:592
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff888073b19800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 136 bytes inside of
1024-byte region [ffff888073b19800, ffff888073b19c00)

The buggy address belongs to the physical page:
page:ffffea0001cec600 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888073b1c800 pfn:0x73b18
head:ffffea0001cec600 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001674c08 ffffea0000c13c08 ffff888017c41dc0
raw: ffff888073b1c800 0000000000100005 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 0xd2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4281, tgid 4281 (kworker/u4:5), ts 73477027758, free_ts 73399954943
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517
prep_new_page mm/page_alloc.c:2524 [inline]
get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4313
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5590
alloc_slab_page+0x6a/0x150 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x84/0x2d0 mm/slub.c:1992
___slab_alloc+0xc20/0x1270 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:935 [inline]
__kmalloc_node_track_caller+0xa0/0x220 mm/slab_common.c:956
kmalloc_reserve net/core/skbuff.c:446 [inline]
__alloc_skb+0x135/0x670 net/core/skbuff.c:515
__netdev_alloc_skb+0xfb/0x500 net/core/skbuff.c:579
__netdev_alloc_skb_ip_align include/linux/skbuff.h:3226 [inline]
netdev_alloc_skb_ip_align include/linux/skbuff.h:3236 [inline]
batadv_iv_ogm_aggregate_new net/batman-adv/bat_iv_ogm.c:559 [inline]
batadv_iv_ogm_queue_add+0x6a0/0xbf0 net/batman-adv/bat_iv_ogm.c:671
batadv_iv_ogm_schedule_buff net/batman-adv/bat_iv_ogm.c:834 [inline]
batadv_iv_ogm_schedule+0x857/0x1090 net/batman-adv/bat_iv_ogm.c:869
batadv_iv_send_outstanding_bat_ogm_packet+0x6fa/0x800 net/batman-adv/bat_iv_ogm.c:1713
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
kthread+0x28d/0x320 kernel/kthread.c:376
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1444 [inline]
free_pcp_prepare mm/page_alloc.c:1494 [inline]
free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3369
free_unref_page+0x33/0x3e0 mm/page_alloc.c:3464
free_slab mm/slub.c:2031 [inline]
discard_slab mm/slub.c:2037 [inline]
__unfreeze_partials+0x1b7/0x210 mm/slub.c:2586
put_cpu_partial+0x17b/0x250 mm/slub.c:2662
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
kmem_cache_alloc_node+0x136/0x310 mm/slub.c:3443
__alloc_skb+0xde/0x670 net/core/skbuff.c:505
alloc_skb include/linux/skbuff.h:1271 [inline]
nlmsg_new include/net/netlink.h:991 [inline]
devlink_nl_region_notify_build+0xbd/0x6b0 net/devlink/leftover.c:5757
devlink_nl_region_notify net/devlink/leftover.c:5816 [inline]
devlink_notify_register net/devlink/leftover.c:9696 [inline]
devlink_register+0x363/0x550 net/devlink/leftover.c:9753
nsim_drv_probe+0x9cc/0xb20 drivers/net/netdevsim/dev.c:1615
really_probe+0x2ab/0xcb0 drivers/base/dd.c:639
__driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:785
driver_probe_device+0x50/0x420 drivers/base/dd.c:815

Memory state around the buggy address:
ffff888073b19780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888073b19800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888073b19880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888073b19900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888073b19980: 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
Reply all
Reply to author
Forward
0 new messages