syzbot


KASAN: use-after-free Read in sk_filter_trim_cap

Status: auto-obsoleted due to no activity on 2024/10/27 21:54
Reported-by: syzbot+f2b6caf33553dbdd8be3@syzkaller.appspotmail.com
First crash: 137d, last: 137d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in sk_filter_trim_cap 1 1000d 1000d 0/1 auto-closed as invalid on 2022/07/07 20:56
upstream KASAN: slab-use-after-free Read in sk_filter_trim_cap bpf net 3 11h18m 91d 0/28 upstream: reported on 2024/09/04 12:35

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in sk_filter_trim_cap+0x2a8/0x9b4 net/core/filter.c:150
Read of size 8 at addr ffff0000c89eb240 by task kworker/u5:1/4231

CPU: 0 PID: 4231 Comm: kworker/u5:1 Not tainted 6.1.100-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Workqueue: hci1 hci_rx_work
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:395
 kasan_report+0xd4/0x130 mm/kasan/report.c:495
 __asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
 sk_filter_trim_cap+0x2a8/0x9b4 net/core/filter.c:150
 sk_filter include/linux/filter.h:874 [inline]
 l2cap_sock_recv_cb+0x100/0x440 net/bluetooth/l2cap_sock.c:1536
 l2cap_conless_channel net/bluetooth/l2cap_core.c:7811 [inline]
 l2cap_recv_frame+0xeb0/0x6ca8 net/bluetooth/l2cap_core.c:7864
 l2cap_recv_acldata+0x4f4/0x163c net/bluetooth/l2cap_core.c:8576
 hci_acldata_packet net/bluetooth/hci_core.c:3897 [inline]
 hci_rx_work+0x2b8/0xa68 net/bluetooth/hci_core.c:4134
 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
 kthread+0x250/0x2d8 kernel/kthread.c:376
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

Allocated by task 4957:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:955 [inline]
 __kmalloc+0xd8/0x1c4 mm/slab_common.c:968
 kmalloc include/linux/slab.h:561 [inline]
 sk_prot_alloc+0xc4/0x1f0 net/core/sock.c:2047
 sk_alloc+0x44/0x3e4 net/core/sock.c:2100
 bt_sock_alloc+0x4c/0x140 net/bluetooth/af_bluetooth.c:148
 l2cap_sock_alloc net/bluetooth/l2cap_sock.c:1903 [inline]
 l2cap_sock_create+0x140/0x2b8 net/bluetooth/l2cap_sock.c:1943
 bt_sock_create+0x14c/0x248 net/bluetooth/af_bluetooth.c:132
 __sock_create+0x43c/0x884 net/socket.c:1550
 sock_create net/socket.c:1601 [inline]
 __sys_socket_create net/socket.c:1638 [inline]
 __sys_socket+0x120/0x32c net/socket.c:1666
 __do_sys_socket net/socket.c:1679 [inline]
 __se_sys_socket net/socket.c:1677 [inline]
 __arm64_sys_socket+0x7c/0x94 net/socket.c:1677
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Freed by task 4953:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 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+0x2c0/0x4b4 mm/slub.c:3674
 kfree+0xcc/0x1b8 mm/slab_common.c:1007
 sk_prot_free net/core/sock.c:2083 [inline]
 __sk_destruct+0x4b8/0x75c net/core/sock.c:2169
 sk_destruct net/core/sock.c:2184 [inline]
 __sk_free+0x37c/0x4e8 net/core/sock.c:2195
 sk_free+0x60/0xc8 net/core/sock.c:2206
 sock_put include/net/sock.h:2028 [inline]
 l2cap_sock_kill+0x10c/0x214 net/bluetooth/l2cap_sock.c:1280
 l2cap_sock_release+0x138/0x1b4 net/bluetooth/l2cap_sock.c:1451
 __sock_release net/socket.c:654 [inline]
 sock_close+0xb8/0x1fc net/socket.c:1400
 __fput+0x1c8/0x7c8 fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x2148/0x3474 arch/arm64/kernel/signal.c:1132
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
 el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

The buggy address belongs to the object at ffff0000c89eb000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 576 bytes inside of
 2048-byte region [ffff0000c89eb000, ffff0000c89eb800)

The buggy address belongs to the physical page:
page:0000000026d6718b refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1089e8
head:0000000026d6718b order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 0000000000000000 dead000000000001 ffff0000c0002900
raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000c89eb100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000c89eb180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000c89eb200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff0000c89eb280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000c89eb300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Unable to handle kernel paging request at virtual address dfff800000000047
KASAN: null-ptr-deref in range [0x0000000000000238-0x000000000000023f]
Mem abort info:
  ESR = 0x0000000096000006
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x06: level 2 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000006
  CM = 0, WnR = 0
[dfff800000000047] address between user and kernel address ranges
Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 4231 Comm: kworker/u5:1 Tainted: G    B              6.1.100-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Workqueue: hci1 hci_rx_work
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : l2cap_publish_rx_avail net/bluetooth/l2cap_sock.c:1171 [inline]
pc : l2cap_sock_recv_cb+0x154/0x440 net/bluetooth/l2cap_sock.c:1543
lr : l2cap_sock_recv_cb+0x134/0x440 net/bluetooth/l2cap_sock.c:1541
sp : ffff80001e0777a0
x29: ffff80001e0777a0 x28: 1fffe0001b0ce500 x27: 1fffe0001913d407
x26: dfff800000000000 x25: 1fffe0001913d497 x24: 0000000000000000
x23: 0000000000000000 x22: ffff0000c89ea03e x21: ffff0000cdd3d640
x20: ffff0000c89ea000 x19: ffff0000c89eb000 x18: 0000000000000140
x17: 0000000000000000 x16: ffff80000825fc54 x15: 0000000000000002
x14: 00000000ffffffff x13: 1fffe0003686f176 x12: 0000000000040000
x11: 000000000003ffff x10: ffff800029f2b000 x9 : ffff8000103d1b38
x8 : 0000000000000047 x7 : 0000000000000000 x6 : ffff8000103d19cc
x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffff8000103d1af8
x2 : 0000000000000000 x1 : 0000000000000001 x0 : 0000000000000238
Call trace:
 l2cap_publish_rx_avail net/bluetooth/l2cap_sock.c:1171 [inline]
 l2cap_sock_recv_cb+0x154/0x440 net/bluetooth/l2cap_sock.c:1543
 l2cap_conless_channel net/bluetooth/l2cap_core.c:7811 [inline]
 l2cap_recv_frame+0xeb0/0x6ca8 net/bluetooth/l2cap_core.c:7864
 l2cap_recv_acldata+0x4f4/0x163c net/bluetooth/l2cap_core.c:8576
 hci_acldata_packet net/bluetooth/hci_core.c:3897 [inline]
 hci_rx_work+0x2b8/0xa68 net/bluetooth/hci_core.c:4134
 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
 kthread+0x250/0x2d8 kernel/kthread.c:376
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864
Code: 97ac3f42 f9400318 9108e300 d343fc08 (38fa6908) 
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
   0:	97ac3f42 	bl	0xfffffffffeb0fd08
   4:	f9400318 	ldr	x24, [x24]
   8:	9108e300 	add	x0, x24, #0x238
   c:	d343fc08 	lsr	x8, x0, #3
* 10:	38fa6908 	ldrsb	w8, [x8, x26] <-- trapping instruction

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/19 21:54 linux-6.1.y 9b3f9a5b12dc 890ce4f3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in sk_filter_trim_cap
* Struck through repros no longer work on HEAD.