syzbot


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

Status: upstream: reported on 2025/04/06 20:45
Reported-by: syzbot+7c75c478e22471f63ba2@syzkaller.appspotmail.com
First crash: 15d, last: 15d
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in __lock_sock 16 133d 198d 0/3 auto-obsoleted due to no activity on 2025/02/17 16:37
linux-4.19 KASAN: use-after-free Read in __lock_sock syz done 2 2003d 2003d 1/1 fixed on 2019/12/18 04:11
upstream KASAN: use-after-free Read in __lock_sock sctp syz done error 26 1532d 2347d 20/28 fixed on 2022/03/08 16:11
linux-4.19 KASAN: use-after-free Read in __lock_sock (2) 1 1905d 1905d 0/1 auto-closed as invalid on 2020/06/01 06:17
linux-4.14 KASAN: use-after-free Read in __lock_sock syz inconclusive 1 1776d 1896d 0/1 upstream: reported syz repro on 2020/02/11 04:34
upstream KASAN: slab-use-after-free Read in __lock_sock bluetooth C 1 516d 516d 0/28 auto-obsoleted due to no activity on 2024/03/01 14:18
upstream KASAN: slab-use-after-free Read in __lock_sock (2) bluetooth C 5 295d 309d 0/28 auto-obsoleted due to no activity on 2024/10/08 16:07
upstream BUG: sleeping function called from invalid context in lock_sock_nested (3) bluetooth C inconclusive 141 26d 343d 0/28 upstream: reported C repro on 2024/05/13 12:58

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x114/0x7638 kernel/locking/lockdep.c:4882
Read of size 8 at addr ffff0000c22480a0 by task kworker/u5:1/4025

CPU: 1 PID: 4025 Comm: kworker/u5:1 Not tainted 5.15.179-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: hci2 hci_rx_work
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x174/0x1e4 mm/kasan/report.c:451
 __asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
 __lock_acquire+0x114/0x7638 kernel/locking/lockdep.c:4882
 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
 _raw_spin_lock_bh+0x124/0x1c4 kernel/locking/spinlock.c:178
 spin_lock_bh include/linux/spinlock.h:368 [inline]
 __lock_sock+0x170/0x2d4 net/core/sock.c:2704
 lock_sock_nested+0x138/0x1ec net/core/sock.c:3258
 lock_sock include/net/sock.h:1684 [inline]
 l2cap_sock_recv_cb+0x5c/0x1c0 net/bluetooth/l2cap_sock.c:1499
 l2cap_conless_channel net/bluetooth/l2cap_core.c:7765 [inline]
 l2cap_recv_frame+0xeb4/0x6c28 net/bluetooth/l2cap_core.c:7819
 l2cap_recv_acldata+0x4f4/0x163c net/bluetooth/l2cap_core.c:8531
 hci_acldata_packet net/bluetooth/hci_core.c:4973 [inline]
 hci_rx_work+0x3a8/0x830 net/bluetooth/hci_core.c:5165
 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310
 worker_thread+0x910/0x1034 kernel/workqueue.c:2457
 kthread+0x37c/0x45c kernel/kthread.c:334
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

Allocated by task 6292:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513
 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 __kmalloc+0x29c/0x4c8 mm/slub.c:4407
 kmalloc include/linux/slab.h:596 [inline]
 sk_prot_alloc+0xc4/0x1f0 net/core/sock.c:1866
 sk_alloc+0x40/0x3dc net/core/sock.c:1919
 l2cap_sock_alloc net/bluetooth/l2cap_sock.c:1861 [inline]
 l2cap_sock_create+0x140/0x368 net/bluetooth/l2cap_sock.c:1909
 bt_sock_create+0x14c/0x248 net/bluetooth/af_bluetooth.c:130
 __sock_create+0x43c/0x8a0 net/socket.c:1486
 sock_create net/socket.c:1542 [inline]
 __sys_socket+0x168/0x310 net/socket.c:1584
 __do_sys_socket net/socket.c:1593 [inline]
 __se_sys_socket net/socket.c:1591 [inline]
 __arm64_sys_socket+0x7c/0x94 net/socket.c:1591
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 6292:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0x178/0x410 mm/slub.c:4559
 sk_prot_free net/core/sock.c:1902 [inline]
 __sk_destruct+0x41c/0x604 net/core/sock.c:1988
 sk_destruct net/core/sock.c:2003 [inline]
 __sk_free+0x388/0x4f4 net/core/sock.c:2014
 sk_free+0x68/0xdc net/core/sock.c:2025
 sock_put include/net/sock.h:1929 [inline]
 l2cap_sock_kill+0x114/0x228 net/bluetooth/l2cap_sock.c:1258
 l2cap_sock_release+0x138/0x1b4 net/bluetooth/l2cap_sock.c:1429
 __sock_release net/socket.c:649 [inline]
 sock_close+0xb8/0x1fc net/socket.c:1336
 __fput+0x1c4/0x800 fs/file_table.c:311
 ____fput+0x20/0x30 fs/file_table.c:339
 task_work_run+0x130/0x1e4 kernel/task_work.c:188
 get_signal+0x1450/0x1550 kernel/signal.c:2672
 do_signal arch/arm64/kernel/signal.c:890 [inline]
 do_notify_resume+0x3d0/0x32b8 arch/arm64/kernel/signal.c:943
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
 el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:609
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000c2248000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 160 bytes inside of
 2048-byte region [ffff0000c2248000, ffff0000c2248800)
The buggy address belongs to the page:
page:00000000cd5ba82b refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0000c2249000 pfn:0x102248
head:00000000cd5ba82b order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 fffffc00033f1e08 fffffc00036b1008 ffff0000c0002900
raw: ffff0000c2249000 0000000000080007 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000c2247f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff0000c2248000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000c2248080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff0000c2248100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000c2248180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/04/06 20:45 linux-5.15.y 0c935c049b5c 1c65791e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in __lock_sock
* Struck through repros no longer work on HEAD.