syzbot


KASAN: use-after-free Read in settings_rsp

Status: upstream: reported on 2025/06/17 05:42
Reported-by: syzbot+0f65f282934f2f4a7031@syzkaller.appspotmail.com
First crash: 41d, last: 41d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0x34/0x150 lib/list_debug.c:46
Read of size 8 at addr ffff0000ca486008 by task syz.6.414/6229

CPU: 0 PID: 6229 Comm: syz.6.414 Not tainted 5.15.185-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call trace:
 dump_backtrace+0x0/0x43c arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack+0x30/0x40 lib/dump_stack.c:88
 dump_stack_lvl+0xf8/0x160 lib/dump_stack.c:106
 print_address_description+0x78/0x30c mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xec/0x15c mm/kasan/report.c:451
 __asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
 __list_del_entry_valid+0x34/0x150 lib/list_debug.c:46
 __list_del_entry include/linux/list.h:132 [inline]
 list_del include/linux/list.h:146 [inline]
 settings_rsp+0x10c/0x338 net/bluetooth/mgmt.c:1284
 mgmt_pending_foreach+0xd4/0x148 net/bluetooth/mgmt_util.c:226
 __mgmt_power_off+0xc4/0x2a8 net/bluetooth/mgmt.c:8624
 hci_dev_do_close+0x4a0/0x105c net/bluetooth/hci_core.c:1791
 hci_dev_close+0xc8/0x1b8 net/bluetooth/hci_core.c:1877
 hci_sock_ioctl+0x474/0x94c net/bluetooth/hci_sock.c:1067
 sock_do_ioctl+0xf8/0x240 net/socket.c:1140
 sock_ioctl+0x5c8/0x87c net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
 __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+0x78/0x1e0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 6134:
 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 mm/kasan/common.c:513 [inline]
 __kasan_kmalloc+0xb0/0xf0 mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x274/0x3fc mm/slub.c:3247
 kmalloc include/linux/slab.h:604 [inline]
 kzalloc include/linux/slab.h:735 [inline]
 mgmt_pending_add+0x70/0x2fc net/bluetooth/mgmt_util.c:236
 set_powered+0x244/0x628 net/bluetooth/mgmt.c:1230
 hci_mgmt_cmd+0x718/0xa98 net/bluetooth/hci_sock.c:1652
 hci_sock_sendmsg+0x2e8/0x864 net/bluetooth/hci_sock.c:1787
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 sock_write_iter+0x23c/0x31c net/socket.c:1079
 call_write_iter include/linux/fs.h:2172 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0x7c8/0xa2c fs/read_write.c:594
 ksys_write+0x120/0x210 fs/read_write.c:647
 __do_sys_write fs/read_write.c:659 [inline]
 __se_sys_write fs/read_write.c:656 [inline]
 __arm64_sys_write+0x7c/0x90 fs/read_write.c:656
 __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+0x78/0x1e0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 6230:
 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/0x1e8 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0x170/0x40c mm/slub.c:4559
 mgmt_pending_free+0xd0/0x12c net/bluetooth/mgmt_util.c:263
 mgmt_pending_remove+0xec/0x104 net/bluetooth/mgmt_util.c:269
 cmd_complete_rsp+0xcc/0x17c net/bluetooth/mgmt.c:-1
 mgmt_pending_foreach+0xd4/0x148 net/bluetooth/mgmt_util.c:226
 mgmt_index_removed+0x108/0x240 net/bluetooth/mgmt.c:8546
 hci_sock_bind+0x844/0xc24 net/bluetooth/hci_sock.c:1246
 __sys_bind+0x1dc/0x27c net/socket.c:1720
 __do_sys_bind net/socket.c:1731 [inline]
 __se_sys_bind net/socket.c:1729 [inline]
 __arm64_sys_bind+0x7c/0x94 net/socket.c:1729
 __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+0x78/0x1e0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0xcc/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 ffff0000ca486000
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 8 bytes inside of
 128-byte region [ffff0000ca486000, ffff0000ca486080)
The buggy address belongs to the page:
page:00000000ddec87b5 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10a486
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 0000000000000000 0000000300000001 ffff0000c0002300
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000ca485f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff0000ca485f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff0000ca486000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff0000ca486080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000ca486100: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
Unable to handle kernel paging request at virtual address fb9380908000030a
Mem abort info:
  ESR = 0x0000000096000004
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x04: level 0 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000004
  CM = 0, WnR = 0
[fb9380908000030a] address between user and kernel address ranges
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 6229 Comm: syz.6.414 Tainted: G    B             5.15.185-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __list_del_entry_valid+0x78/0x150 lib/list_debug.c:59
lr : __list_del_entry_valid+0x4c/0x150 lib/list_debug.c:47
sp : ffff8000201177b0
x29: ffff8000201177b0 x28: ffff8000201177e0 x27: 1fffe00019490c05
x26: 1ffff00004022efc x25: dfff800000000000 x24: ffff0000e5e740b0
x23: 0000000000000005 x22: ffff0000e8347000 x21: dfff800000000000
x20: dca0048400001856 x19: ffff0000ca486000 x18: 0000000000000002
x17: 0000000040000000 x16: ffff8000082d4c48 x15: 0000000000000002
x14: 00000000ffff8000 x13: 683f609d583bbf00 x12: 0000000000080000
x11: 000000000007ffff x10: ffff800027e0c000 x9 : ffff80001ae153d0
x8 : 1b9400908000030a x7 : 0000000000000000 x6 : ffff80000824419c
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000a77f5b4
x2 : dead000000000122 x1 : 0000000000000008 x0 : 0000000000000000
Call trace:
 __list_del_entry_valid+0x78/0x150 lib/list_debug.c:59
 __list_del_entry include/linux/list.h:132 [inline]
 list_del include/linux/list.h:146 [inline]
 settings_rsp+0x10c/0x338 net/bluetooth/mgmt.c:1284
 mgmt_pending_foreach+0xd4/0x148 net/bluetooth/mgmt_util.c:226
 __mgmt_power_off+0xc4/0x2a8 net/bluetooth/mgmt.c:8624
 hci_dev_do_close+0x4a0/0x105c net/bluetooth/hci_core.c:1791
 hci_dev_close+0xc8/0x1b8 net/bluetooth/hci_core.c:1877
 hci_sock_ioctl+0x474/0x94c net/bluetooth/hci_sock.c:1067
 sock_do_ioctl+0xf8/0x240 net/socket.c:1140
 sock_ioctl+0x5c8/0x87c net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
 __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+0x78/0x1e0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0xcc/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
Code: 91008902 eb02029f 54000520 d343fe88 (38756908) 
---[ end trace 6399ff2ab69d1ad5 ]---
----------------
Code disassembly (best guess):
   0:	91008902 	add	x2, x8, #0x22
   4:	eb02029f 	cmp	x20, x2
   8:	54000520 	b.eq	0xac  // b.none
   c:	d343fe88 	lsr	x8, x20, #3
* 10:	38756908 	ldrb	w8, [x8, x21] <-- trapping instruction

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