syzbot


KASAN: slab-out-of-bounds Read in hci_le_meta_evt (2)

Status: fixed on 2022/03/08 16:11
Subsystems: bluetooth
[Documentation on labels]
Reported-by: syzbot+e3fcb9c4f3c2a931dc40@syzkaller.appspotmail.com
Fix commit: 3a56ef719f0b Bluetooth: stop proccessing malicious adv data
First crash: 901d, last: 901d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: KASAN: slab-out-of-bounds Read in hci_le_meta_evt (log)
Repro: C syz .config
  
Discussions (10)
Title Replies (including bot) Last reply
[PATCH 5.10 000/563] 5.10.94-rc1 review 580 (580) 2022/02/09 07:59
[PATCH 4.19 000/239] 4.19.226-rc1 review 253 (253) 2022/02/03 14:51
[PATCH 5.16 0000/1039] 5.16.3-rc1 review 1058 (1058) 2022/02/03 14:49
[PATCH 5.15 000/846] 5.15.17-rc1 review 859 (859) 2022/01/27 16:04
[PATCH 4.4 000/114] 4.4.300-rc1 review 122 (122) 2022/01/27 07:45
[PATCH 5.4 000/320] 5.4.174-rc1 review 334 (334) 2022/01/25 15:51
[PATCH 4.9 000/157] 4.9.298-rc1 review 162 (162) 2022/01/25 14:34
[PATCH 4.14 000/186] 4.14.263-rc1 review 190 (190) 2022/01/25 12:40
[PATCH] Bluetooth: stop proccessing malicious adv data 3 (3) 2021/11/16 13:55
[syzbot] KASAN: slab-out-of-bounds Read in hci_le_meta_evt (2) 2 (5) 2021/11/01 00:10
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: slab-out-of-bounds Read in hci_le_meta_evt C done 15 1236d 1355d 1/1 fixed on 2020/12/30 13:33
linux-4.19 KASAN: slab-out-of-bounds Read in hci_le_meta_evt C done 12 1217d 1357d 1/1 fixed on 2021/01/18 14:01
linux-5.15 KASAN: slab-out-of-bounds Read in hci_le_meta_evt origin:lts-only C done 773 9h18m 403d 0/3 upstream: reported C repro on 2023/03/13 06:57
linux-4.19 KASAN: slab-out-of-bounds Read in hci_le_meta_evt (2) C error 239 414d 1070d 0/1 upstream: reported C repro on 2021/05/14 20:19
upstream KASAN: slab-out-of-bounds Read in hci_le_meta_evt bluetooth C error error 45 1233d 1354d 19/26 fixed on 2021/03/10 01:49
Last patch testing requests (2)
Created Duration User Patch Repo Result
2021/10/31 20:16 16m paskripkin@gmail.com patch upstream OK
2021/10/31 18:21 16m paskripkin@gmail.com patch upstream OK

Sample crash report:
Bluetooth: hci0: unknown advertising packet type: 0x90
Bluetooth: hci0: Dropping invalid advertising data
==================================================================
BUG: KASAN: slab-out-of-bounds in hci_le_adv_report_evt net/bluetooth/hci_event.c:5783 [inline]
BUG: KASAN: slab-out-of-bounds in hci_le_meta_evt+0x3e27/0x46d0 net/bluetooth/hci_event.c:6104
Read of size 1 at addr ffff888079314e03 by task kworker/u5:2/6459

CPU: 1 PID: 6459 Comm: kworker/u5:2 Not tainted 5.15.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: hci0 hci_rx_work
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0x6c/0x2d6 mm/kasan/report.c:256
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
 hci_le_adv_report_evt net/bluetooth/hci_event.c:5783 [inline]
 hci_le_meta_evt+0x3e27/0x46d0 net/bluetooth/hci_event.c:6104
 hci_event_packet+0x5d9/0x7cf0 net/bluetooth/hci_event.c:6445
 hci_rx_work+0x4fa/0xd30 net/bluetooth/hci_core.c:5136
 process_one_work+0x9bf/0x16b0 kernel/workqueue.c:2297
 worker_thread+0x658/0x11f0 kernel/workqueue.c:2444
 kthread+0x3e5/0x4d0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Allocated by task 6453:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 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 mm/kasan/common.c:472 [inline]
 __kasan_kmalloc+0xa1/0xd0 mm/kasan/common.c:522
 kmalloc_reserve net/core/skbuff.c:356 [inline]
 __alloc_skb+0xde/0x340 net/core/skbuff.c:427
 alloc_skb include/linux/skbuff.h:1116 [inline]
 bt_skb_alloc include/net/bluetooth/bluetooth.h:389 [inline]
 vhci_get_user drivers/bluetooth/hci_vhci.c:165 [inline]
 vhci_write+0xbd/0x450 drivers/bluetooth/hci_vhci.c:285
 call_write_iter include/linux/fs.h:2163 [inline]
 new_sync_write+0x429/0x660 fs/read_write.c:507
 vfs_write+0x7cf/0xae0 fs/read_write.c:594
 ksys_write+0x12d/0x250 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff888079314c00
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 3 bytes to the right of
 512-byte region [ffff888079314c00, ffff888079314e00)
The buggy address belongs to the page:
page:ffffea0001e4c500 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x79314
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00005ef948 ffffea0000768f08 ffff888010c40600
raw: 0000000000000000 ffff888079314000 0000000100000004 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 1, ts 20947704734, free_ts 20947079890
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4155
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5381
 __alloc_pages_node include/linux/gfp.h:570 [inline]
 kmem_getpages mm/slab.c:1377 [inline]
 cache_grow_begin+0x75/0x460 mm/slab.c:2593
 cache_alloc_refill+0x27f/0x380 mm/slab.c:2965
 ____cache_alloc mm/slab.c:3048 [inline]
 ____cache_alloc mm/slab.c:3031 [inline]
 __do_cache_alloc mm/slab.c:3275 [inline]
 slab_alloc mm/slab.c:3316 [inline]
 kmem_cache_alloc_trace+0x38c/0x480 mm/slab.c:3573
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 kernfs_fop_open+0x2c5/0xd40 fs/kernfs/file.c:628
 do_dentry_open+0x4c8/0x11d0 fs/open.c:822
 do_open fs/namei.c:3428 [inline]
 path_openat+0x1c9a/0x2740 fs/namei.c:3561
 do_filp_open+0x1aa/0x400 fs/namei.c:3588
 do_sys_openat2+0x16d/0x4d0 fs/open.c:1200
 do_sys_open fs/open.c:1216 [inline]
 __do_sys_open fs/open.c:1224 [inline]
 __se_sys_open fs/open.c:1220 [inline]
 __x64_sys_open+0x119/0x1c0 fs/open.c:1220
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare+0x2c5/0x780 mm/page_alloc.c:1391
 free_unref_page_prepare mm/page_alloc.c:3317 [inline]
 free_unref_page+0x19/0x690 mm/page_alloc.c:3396
 selinux_genfs_get_sid security/selinux/hooks.c:1378 [inline]
 inode_doinit_with_dentry+0x868/0x12e0 security/selinux/hooks.c:1573
 selinux_d_instantiate+0x23/0x30 security/selinux/hooks.c:6448
 security_d_instantiate+0x50/0xe0 security/security.c:2039
 d_splice_alias+0x8c/0xc60 fs/dcache.c:3064
 kernfs_iop_lookup+0x22d/0x2c0 fs/kernfs/dir.c:1137
 lookup_open.isra.0+0x69f/0x13d0 fs/namei.c:3260
 open_last_lookups fs/namei.c:3352 [inline]
 path_openat+0x9a5/0x2740 fs/namei.c:3558
 do_filp_open+0x1aa/0x400 fs/namei.c:3588
 do_sys_openat2+0x16d/0x4d0 fs/open.c:1200
 do_sys_open fs/open.c:1216 [inline]
 __do_sys_open fs/open.c:1224 [inline]
 __se_sys_open fs/open.c:1220 [inline]
 __x64_sys_open+0x119/0x1c0 fs/open.c:1220
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Memory state around the buggy address:
 ffff888079314d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888079314d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888079314e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff888079314e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888079314f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/10/31 08:29 upstream 119c85055d86 098b5d53 .config console log report syz C ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Read in hci_le_meta_evt
2021/10/31 08:05 upstream 119c85055d86 098b5d53 .config console log report info ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Read in hci_le_meta_evt
* Struck through repros no longer work on HEAD.