syzbot


KASAN: slab-use-after-free Read in lookup_object_or_alloc

Status: auto-obsoleted due to no activity on 2024/01/01 19:54
Subsystems: bluetooth
[Documentation on labels]
Reported-by: syzbot+03ff29e19085ba44182e@syzkaller.appspotmail.com
First crash: 309d, last: 295d

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in timer_is_static_object+0x78/0x90 kernel/time/timer.c:680
Read of size 8 at addr ffff88801b7de398 by task syz-executor.2/18571

CPU: 3 PID: 18571 Comm: syz-executor.2 Not tainted 6.6.0-rc2-syzkaller-00018-g2cf0f7156238 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 timer_is_static_object+0x78/0x90 kernel/time/timer.c:680
 lookup_object_or_alloc.part.0+0x6b2/0xaf0 lib/debugobjects.c:581
 lookup_object_or_alloc lib/debugobjects.c:567 [inline]
 debug_object_assert_init+0x2be/0x370 lib/debugobjects.c:929
 debug_timer_assert_init kernel/time/timer.c:792 [inline]
 debug_assert_init kernel/time/timer.c:837 [inline]
 __timer_delete+0x81/0x1c0 kernel/time/timer.c:1321
 del_timer include/linux/timer.h:213 [inline]
 try_to_grab_pending+0x7e/0x850 kernel/workqueue.c:1564
 __cancel_work+0x85/0x340 kernel/workqueue.c:3582
 hci_conn_drop include/net/bluetooth/hci_core.h:1548 [inline]
 hci_conn_drop include/net/bluetooth/hci_core.h:1519 [inline]
 __sco_sock_close+0x34d/0x690 net/bluetooth/sco.c:444
 sco_sock_close net/bluetooth/sco.c:469 [inline]
 sco_sock_release+0x6f/0x2c0 net/bluetooth/sco.c:1246
 __sock_release+0xae/0x260 net/socket.c:659
 sock_close+0x1c/0x20 net/socket.c:1402
 __fput+0x3f7/0xa70 fs/file_table.c:384
 __fput_sync+0x47/0x50 fs/file_table.c:465
 __do_sys_close fs/open.c:1572 [inline]
 __se_sys_close fs/open.c:1557 [inline]
 __ia32_sys_close+0x87/0xf0 fs/open.c:1557
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82
RIP: 0023:0xf7f03579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000fff65480 EFLAGS: 00000293 ORIG_RAX: 0000000000000006
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000056f10400
RDX: 0000000000000000 RSI: 00000000f7353ff4 RDI: 000000000001e864
RBP: 00000000f737c0c0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 18572:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:599 [inline]
 kzalloc include/linux/slab.h:720 [inline]
 hci_conn_add+0xc2/0x1760 net/bluetooth/hci_conn.c:957
 hci_connect_sco+0x3a0/0xf80 net/bluetooth/hci_conn.c:1692
 sco_connect net/bluetooth/sco.c:266 [inline]
 sco_sock_connect+0x2c7/0xa50 net/bluetooth/sco.c:591
 __sys_connect_file+0x15b/0x1a0 net/socket.c:2033
 __sys_connect+0x145/0x170 net/socket.c:2050
 __do_sys_connect net/socket.c:2060 [inline]
 __se_sys_connect net/socket.c:2057 [inline]
 __ia32_sys_connect+0x71/0xb0 net/socket.c:2057
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82

Freed by task 5185:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522
 ____kasan_slab_free mm/kasan/common.c:236 [inline]
 ____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200
 kasan_slab_free include/linux/kasan.h:164 [inline]
 slab_free_hook mm/slub.c:1800 [inline]
 slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826
 slab_free mm/slub.c:3809 [inline]
 __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822
 device_release+0xa1/0x240 drivers/base/core.c:2484
 kobject_cleanup lib/kobject.c:682 [inline]
 kobject_release lib/kobject.c:716 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x1d0/0x440 lib/kobject.c:733
 put_device+0x1f/0x30 drivers/base/core.c:3732
 hci_abort_conn_sync+0xabf/0xe10 net/bluetooth/hci_sync.c:5435
 abort_conn_sync+0x187/0x390 net/bluetooth/hci_conn.c:2894
 hci_cmd_sync_work+0x1a4/0x3c0 net/bluetooth/hci_sync.c:306
 process_one_work+0x884/0x15c0 kernel/workqueue.c:2630
 process_scheduled_works kernel/workqueue.c:2703 [inline]
 worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784
 kthread+0x33c/0x440 kernel/kthread.c:388
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304

The buggy address belongs to the object at ffff88801b7de000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 920 bytes inside of
 freed 4096-byte region [ffff88801b7de000, ffff88801b7df000)

The buggy address belongs to the physical page:
page:ffffea00006df600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1b7d8
head:ffffea00006df600 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888012c43040 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000040004 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 7955976567, free_ts 0
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536
 prep_new_page mm/page_alloc.c:1543 [inline]
 get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170
 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426
 alloc_page_interleave+0x1e/0x250 mm/mempolicy.c:2131
 alloc_pages+0x22a/0x270 mm/mempolicy.c:2293
 alloc_slab_page mm/slub.c:1870 [inline]
 allocate_slab+0x251/0x380 mm/slub.c:2017
 new_slab mm/slub.c:2070 [inline]
 ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322
 __slab_alloc_node mm/slub.c:3375 [inline]
 slab_alloc_node mm/slub.c:3468 [inline]
 __kmem_cache_alloc_node+0x131/0x340 mm/slub.c:3517
 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1114
 kmalloc include/linux/slab.h:599 [inline]
 kzalloc include/linux/slab.h:720 [inline]
 kobject_uevent_env+0x24c/0x1800 lib/kobject_uevent.c:524
 disk_uevent+0x12b/0x4d0 block/genhd.c:335
 device_add_disk+0xded/0x11f0 block/genhd.c:517
 add_disk include/linux/blkdev.h:735 [inline]
 loop_add+0x87f/0xaf0 drivers/block/loop.c:2087
 loop_init+0x164/0x270 drivers/block/loop.c:2279
 do_one_initcall+0x117/0x630 init/main.c:1232
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88801b7de280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801b7de300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801b7de380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88801b7de400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801b7de480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
   0:	10 06                	adc    %al,(%rsi)
   2:	03 74 b4 01          	add    0x1(%rsp,%rsi,4),%esi
   6:	10 07                	adc    %al,(%rdi)
   8:	03 74 b0 01          	add    0x1(%rax,%rsi,4),%esi
   c:	10 08                	adc    %cl,(%rax)
   e:	03 74 d8 01          	add    0x1(%rax,%rbx,8),%esi
  1e:	00 51 52             	add    %dl,0x52(%rcx)
  21:	55                   	push   %rbp
  22:	89 e5                	mov    %esp,%ebp
  24:	0f 34                	sysenter
  26:	cd 80                	int    $0x80
* 28:	5d                   	pop    %rbp <-- trapping instruction
  29:	5a                   	pop    %rdx
  2a:	59                   	pop    %rcx
  2b:	c3                   	ret
  2c:	90                   	nop
  2d:	90                   	nop
  2e:	90                   	nop
  2f:	90                   	nop
  30:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi
  37:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/09/19 14:58 upstream 2cf0f7156238 0b6a67ac .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in lookup_object_or_alloc
2023/10/03 19:53 net-next 35766690d675 65faba36 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in lookup_object_or_alloc
* Struck through repros no longer work on HEAD.