Hay
Date
June 18, 2025, 6:43 a.m.

Environment
qemu-arm64
qemu-x86_64

[   21.159769] ==================================================================
[   21.160036] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   21.160217] Read of size 1 at addr fff00000c6058168 by task kunit_try_catch/194
[   21.160367] 
[   21.160496] CPU: 0 UID: 0 PID: 194 Comm: kunit_try_catch Tainted: G    B   W        N  6.16.0-rc2-next-20250618 #1 PREEMPT 
[   21.160827] Tainted: [B]=BAD_PAGE, [W]=WARN, [N]=TEST
[   21.160908] Hardware name: linux,dummy-virt (DT)
[   21.160997] Call trace:
[   21.161064]  show_stack+0x20/0x38 (C)
[   21.161181]  dump_stack_lvl+0x8c/0xd0
[   21.161294]  print_report+0x118/0x608
[   21.161419]  kasan_report+0xdc/0x128
[   21.161541]  __asan_report_load1_noabort+0x20/0x30
[   21.161650]  kmalloc_uaf+0x300/0x338
[   21.161752]  kunit_try_run_case+0x170/0x3f0
[   21.161866]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.162006]  kthread+0x328/0x630
[   21.162180]  ret_from_fork+0x10/0x20
[   21.162319] 
[   21.162389] Allocated by task 194:
[   21.162526]  kasan_save_stack+0x3c/0x68
[   21.162667]  kasan_save_track+0x20/0x40
[   21.162794]  kasan_save_alloc_info+0x40/0x58
[   21.162893]  __kasan_kmalloc+0xd4/0xd8
[   21.162966]  __kmalloc_cache_noprof+0x16c/0x3c0
[   21.163055]  kmalloc_uaf+0xb8/0x338
[   21.163153]  kunit_try_run_case+0x170/0x3f0
[   21.163240]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.163328]  kthread+0x328/0x630
[   21.163397]  ret_from_fork+0x10/0x20
[   21.163484] 
[   21.163528] Freed by task 194:
[   21.163590]  kasan_save_stack+0x3c/0x68
[   21.163677]  kasan_save_track+0x20/0x40
[   21.163782]  kasan_save_free_info+0x4c/0x78
[   21.163886]  __kasan_slab_free+0x6c/0x98
[   21.163989]  kfree+0x214/0x3c8
[   21.164129]  kmalloc_uaf+0x11c/0x338
[   21.164220]  kunit_try_run_case+0x170/0x3f0
[   21.164315]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.164415]  kthread+0x328/0x630
[   21.164497]  ret_from_fork+0x10/0x20
[   21.164595] 
[   21.164651] The buggy address belongs to the object at fff00000c6058160
[   21.164651]  which belongs to the cache kmalloc-16 of size 16
[   21.164785] The buggy address is located 8 bytes inside of
[   21.164785]  freed 16-byte region [fff00000c6058160, fff00000c6058170)
[   21.164919] 
[   21.164972] The buggy address belongs to the physical page:
[   21.165089] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106058
[   21.165290] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   21.165457] page_type: f5(slab)
[   21.165549] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   21.165714] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   21.165861] page dumped because: kasan: bad access detected
[   21.165973] 
[   21.166029] Memory state around the buggy address:
[   21.166142]  fff00000c6058000: 00 00 fc fc 00 00 fc fc fa fb fc fc fa fb fc fc
[   21.166240]  fff00000c6058080: fa fb fc fc 00 04 fc fc fa fb fc fc fa fb fc fc
[   21.166330] >fff00000c6058100: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   21.166413]                                                           ^
[   21.166502]  fff00000c6058180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.166644]  fff00000c6058200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.166895] ==================================================================

[   11.376668] ==================================================================
[   11.377581] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   11.378140] Read of size 1 at addr ffff888102859688 by task kunit_try_catch/210
[   11.378410] 
[   11.378599] CPU: 1 UID: 0 PID: 210 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250618 #1 PREEMPT(voluntary) 
[   11.378825] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.378842] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.378865] Call Trace:
[   11.378879]  <TASK>
[   11.378910]  dump_stack_lvl+0x73/0xb0
[   11.378943]  print_report+0xd1/0x650
[   11.378975]  ? __virt_addr_valid+0x1db/0x2d0
[   11.378999]  ? kmalloc_uaf+0x320/0x380
[   11.379017]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.379041]  ? kmalloc_uaf+0x320/0x380
[   11.379059]  kasan_report+0x141/0x180
[   11.379079]  ? kmalloc_uaf+0x320/0x380
[   11.379102]  __asan_report_load1_noabort+0x18/0x20
[   11.379124]  kmalloc_uaf+0x320/0x380
[   11.379142]  ? __pfx_kmalloc_uaf+0x10/0x10
[   11.379161]  ? __schedule+0x10cc/0x2b60
[   11.379182]  ? __pfx_read_tsc+0x10/0x10
[   11.379215]  ? ktime_get_ts64+0x86/0x230
[   11.379240]  kunit_try_run_case+0x1a5/0x480
[   11.379264]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.379284]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.379306]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.379327]  ? __kthread_parkme+0x82/0x180
[   11.379347]  ? preempt_count_sub+0x50/0x80
[   11.379368]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.379390]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.379411]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.379432]  kthread+0x337/0x6f0
[   11.379450]  ? trace_preempt_on+0x20/0xc0
[   11.379473]  ? __pfx_kthread+0x10/0x10
[   11.379492]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.379511]  ? calculate_sigpending+0x7b/0xa0
[   11.379535]  ? __pfx_kthread+0x10/0x10
[   11.379555]  ret_from_fork+0x116/0x1d0
[   11.379573]  ? __pfx_kthread+0x10/0x10
[   11.379593]  ret_from_fork_asm+0x1a/0x30
[   11.379623]  </TASK>
[   11.379634] 
[   11.391972] Allocated by task 210:
[   11.392101]  kasan_save_stack+0x45/0x70
[   11.392352]  kasan_save_track+0x18/0x40
[   11.392895]  kasan_save_alloc_info+0x3b/0x50
[   11.393485]  __kasan_kmalloc+0xb7/0xc0
[   11.393873]  __kmalloc_cache_noprof+0x189/0x420
[   11.394029]  kmalloc_uaf+0xaa/0x380
[   11.394148]  kunit_try_run_case+0x1a5/0x480
[   11.394565]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.395102]  kthread+0x337/0x6f0
[   11.395342]  ret_from_fork+0x116/0x1d0
[   11.395603]  ret_from_fork_asm+0x1a/0x30
[   11.396025] 
[   11.396193] Freed by task 210:
[   11.396545]  kasan_save_stack+0x45/0x70
[   11.397088]  kasan_save_track+0x18/0x40
[   11.397540]  kasan_save_free_info+0x3f/0x60
[   11.397950]  __kasan_slab_free+0x56/0x70
[   11.398407]  kfree+0x222/0x3f0
[   11.398736]  kmalloc_uaf+0x12c/0x380
[   11.399080]  kunit_try_run_case+0x1a5/0x480
[   11.399249]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.399793]  kthread+0x337/0x6f0
[   11.400105]  ret_from_fork+0x116/0x1d0
[   11.400403]  ret_from_fork_asm+0x1a/0x30
[   11.400885] 
[   11.400960] The buggy address belongs to the object at ffff888102859680
[   11.400960]  which belongs to the cache kmalloc-16 of size 16
[   11.401581] The buggy address is located 8 bytes inside of
[   11.401581]  freed 16-byte region [ffff888102859680, ffff888102859690)
[   11.402700] 
[   11.402859] The buggy address belongs to the physical page:
[   11.403355] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102859
[   11.403958] flags: 0x200000000000000(node=0|zone=2)
[   11.404429] page_type: f5(slab)
[   11.404844] raw: 0200000000000000 ffff888100041640 dead000000000100 dead000000000122
[   11.405078] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   11.405635] page dumped because: kasan: bad access detected
[   11.406311] 
[   11.406563] Memory state around the buggy address:
[   11.407014]  ffff888102859580: 00 00 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   11.407580]  ffff888102859600: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   11.407795] >ffff888102859680: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.408003]                       ^
[   11.408119]  ffff888102859700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.408349]  ffff888102859780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.408825] ==================================================================