Hay
Date
May 23, 2025, 11:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   27.777961] ==================================================================
[   27.778153] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   27.778320] Read of size 1 at addr fff00000c5a2a6e8 by task kunit_try_catch/186
[   27.778486] 
[   27.778582] CPU: 0 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc7 #1 PREEMPT 
[   27.778827] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.778909] Hardware name: linux,dummy-virt (DT)
[   27.778998] Call trace:
[   27.779079]  show_stack+0x20/0x38 (C)
[   27.779221]  dump_stack_lvl+0x8c/0xd0
[   27.779368]  print_report+0x118/0x608
[   27.779515]  kasan_report+0xdc/0x128
[   27.779638]  __asan_report_load1_noabort+0x20/0x30
[   27.779846]  kmalloc_uaf+0x300/0x338
[   27.780438]  kunit_try_run_case+0x170/0x3f0
[   27.780604]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.780782]  kthread+0x328/0x630
[   27.780898]  ret_from_fork+0x10/0x20
[   27.781028] 
[   27.781087] Allocated by task 186:
[   27.781400]  kasan_save_stack+0x3c/0x68
[   27.781551]  kasan_save_track+0x20/0x40
[   27.781674]  kasan_save_alloc_info+0x40/0x58
[   27.781785]  __kasan_kmalloc+0xd4/0xd8
[   27.781902]  __kmalloc_cache_noprof+0x15c/0x3c0
[   27.782029]  kmalloc_uaf+0xb8/0x338
[   27.782184]  kunit_try_run_case+0x170/0x3f0
[   27.782307]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.782437]  kthread+0x328/0x630
[   27.782664]  ret_from_fork+0x10/0x20
[   27.782800] 
[   27.783042] Freed by task 186:
[   27.783415]  kasan_save_stack+0x3c/0x68
[   27.783762]  kasan_save_track+0x20/0x40
[   27.783979]  kasan_save_free_info+0x4c/0x78
[   27.784109]  __kasan_slab_free+0x6c/0x98
[   27.784200]  kfree+0x214/0x3c8
[   27.784320]  kmalloc_uaf+0x11c/0x338
[   27.784416]  kunit_try_run_case+0x170/0x3f0
[   27.784577]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.784756]  kthread+0x328/0x630
[   27.784916]  ret_from_fork+0x10/0x20
[   27.785019] 
[   27.785076] The buggy address belongs to the object at fff00000c5a2a6e0
[   27.785076]  which belongs to the cache kmalloc-16 of size 16
[   27.785273] The buggy address is located 8 bytes inside of
[   27.785273]  freed 16-byte region [fff00000c5a2a6e0, fff00000c5a2a6f0)
[   27.785544] 
[   27.785604] The buggy address belongs to the physical page:
[   27.785717] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105a2a
[   27.785889] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   27.786037] page_type: f5(slab)
[   27.786149] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   27.786344] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   27.786476] page dumped because: kasan: bad access detected
[   27.786564] 
[   27.786614] Memory state around the buggy address:
[   27.786703]  fff00000c5a2a580: fa fb fc fc fa fb fc fc fa fb fc fc 00 01 fc fc
[   27.786884]  fff00000c5a2a600: 00 01 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   27.787068] >fff00000c5a2a680: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   27.787208]                                                           ^
[   27.787327]  fff00000c5a2a700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.787485]  fff00000c5a2a780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.787631] ==================================================================

[   12.814059] ==================================================================
[   12.815023] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   12.815325] Read of size 1 at addr ffff8881020cbe68 by task kunit_try_catch/203
[   12.816067] 
[   12.816433] CPU: 0 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc7 #1 PREEMPT(voluntary) 
[   12.816487] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.816500] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.816555] Call Trace:
[   12.816569]  <TASK>
[   12.816585]  dump_stack_lvl+0x73/0xb0
[   12.816614]  print_report+0xd1/0x650
[   12.816635]  ? __virt_addr_valid+0x1db/0x2d0
[   12.816657]  ? kmalloc_uaf+0x320/0x380
[   12.816677]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.816699]  ? kmalloc_uaf+0x320/0x380
[   12.816719]  kasan_report+0x141/0x180
[   12.816741]  ? kmalloc_uaf+0x320/0x380
[   12.816766]  __asan_report_load1_noabort+0x18/0x20
[   12.816786]  kmalloc_uaf+0x320/0x380
[   12.816805]  ? __pfx_kmalloc_uaf+0x10/0x10
[   12.816826]  ? __schedule+0x10cc/0x2b30
[   12.816847]  ? __pfx_read_tsc+0x10/0x10
[   12.816866]  ? ktime_get_ts64+0x86/0x230
[   12.816889]  kunit_try_run_case+0x1a5/0x480
[   12.816912]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.816933]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.816955]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.816977]  ? __kthread_parkme+0x82/0x180
[   12.816998]  ? preempt_count_sub+0x50/0x80
[   12.817022]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.817045]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.817066]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.817088]  kthread+0x337/0x6f0
[   12.817104]  ? trace_preempt_on+0x20/0xc0
[   12.817126]  ? __pfx_kthread+0x10/0x10
[   12.817143]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.817163]  ? calculate_sigpending+0x7b/0xa0
[   12.817183]  ? __pfx_kthread+0x10/0x10
[   12.817201]  ret_from_fork+0x41/0x80
[   12.817220]  ? __pfx_kthread+0x10/0x10
[   12.817237]  ret_from_fork_asm+0x1a/0x30
[   12.817267]  </TASK>
[   12.817279] 
[   12.830106] Allocated by task 203:
[   12.830273]  kasan_save_stack+0x45/0x70
[   12.830782]  kasan_save_track+0x18/0x40
[   12.830938]  kasan_save_alloc_info+0x3b/0x50
[   12.831189]  __kasan_kmalloc+0xb7/0xc0
[   12.831369]  __kmalloc_cache_noprof+0x189/0x420
[   12.832063]  kmalloc_uaf+0xaa/0x380
[   12.832306]  kunit_try_run_case+0x1a5/0x480
[   12.832643]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.832944]  kthread+0x337/0x6f0
[   12.833112]  ret_from_fork+0x41/0x80
[   12.833280]  ret_from_fork_asm+0x1a/0x30
[   12.833788] 
[   12.833880] Freed by task 203:
[   12.834207]  kasan_save_stack+0x45/0x70
[   12.834402]  kasan_save_track+0x18/0x40
[   12.834897]  kasan_save_free_info+0x3f/0x60
[   12.835398]  __kasan_slab_free+0x56/0x70
[   12.835661]  kfree+0x222/0x3f0
[   12.835815]  kmalloc_uaf+0x12c/0x380
[   12.836339]  kunit_try_run_case+0x1a5/0x480
[   12.836802]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.837095]  kthread+0x337/0x6f0
[   12.837252]  ret_from_fork+0x41/0x80
[   12.837435]  ret_from_fork_asm+0x1a/0x30
[   12.837619] 
[   12.837709] The buggy address belongs to the object at ffff8881020cbe60
[   12.837709]  which belongs to the cache kmalloc-16 of size 16
[   12.838762] The buggy address is located 8 bytes inside of
[   12.838762]  freed 16-byte region [ffff8881020cbe60, ffff8881020cbe70)
[   12.839843] 
[   12.840018] The buggy address belongs to the physical page:
[   12.840251] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1020cb
[   12.840879] flags: 0x200000000000000(node=0|zone=2)
[   12.841326] page_type: f5(slab)
[   12.841758] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   12.842527] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   12.843213] page dumped because: kasan: bad access detected
[   12.843680] 
[   12.843782] Memory state around the buggy address:
[   12.844162]  ffff8881020cbd00: 00 02 fc fc 00 02 fc fc 00 02 fc fc 00 02 fc fc
[   12.844621]  ffff8881020cbd80: fa fb fc fc fa fb fc fc fa fb fc fc 00 05 fc fc
[   12.845283] >ffff8881020cbe00: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   12.845731]                                                           ^
[   12.846183]  ffff8881020cbe80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.846648]  ffff8881020cbf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.847147] ==================================================================