Hay
Date
June 24, 2025, 12:47 p.m.

Environment
qemu-x86_64

[   12.077506] ==================================================================
[   12.078643] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   12.079112] Read of size 1 at addr ffff8881029e01a8 by task kunit_try_catch/208
[   12.079462] 
[   12.079601] CPU: 1 UID: 0 PID: 208 Comm: kunit_try_catch Tainted: G    B            N  6.15.4-rc2 #1 PREEMPT(voluntary) 
[   12.079701] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.079725] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.079766] Call Trace:
[   12.079795]  <TASK>
[   12.079832]  dump_stack_lvl+0x73/0xb0
[   12.079876]  print_report+0xd1/0x650
[   12.079900]  ? __virt_addr_valid+0x1db/0x2d0
[   12.079922]  ? kmalloc_uaf2+0x4a8/0x520
[   12.079940]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.079961]  ? kmalloc_uaf2+0x4a8/0x520
[   12.079980]  kasan_report+0x141/0x180
[   12.080004]  ? kmalloc_uaf2+0x4a8/0x520
[   12.080042]  __asan_report_load1_noabort+0x18/0x20
[   12.080061]  kmalloc_uaf2+0x4a8/0x520
[   12.080080]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   12.080097]  ? finish_task_switch.isra.0+0x153/0x700
[   12.080118]  ? __switch_to+0x5d9/0xf60
[   12.080138]  ? dequeue_task_fair+0x166/0x4e0
[   12.080161]  ? __schedule+0x10cc/0x2b60
[   12.080182]  ? __pfx_read_tsc+0x10/0x10
[   12.080201]  ? ktime_get_ts64+0x86/0x230
[   12.080224]  kunit_try_run_case+0x1a5/0x480
[   12.080248]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.080268]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.080291]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.080311]  ? __kthread_parkme+0x82/0x180
[   12.080331]  ? preempt_count_sub+0x50/0x80
[   12.080352]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.080373]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.080394]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.080414]  kthread+0x337/0x6f0
[   12.080429]  ? trace_preempt_on+0x20/0xc0
[   12.080450]  ? __pfx_kthread+0x10/0x10
[   12.080466]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.080486]  ? calculate_sigpending+0x7b/0xa0
[   12.080505]  ? __pfx_kthread+0x10/0x10
[   12.080521]  ret_from_fork+0x41/0x80
[   12.080539]  ? __pfx_kthread+0x10/0x10
[   12.080555]  ret_from_fork_asm+0x1a/0x30
[   12.080584]  </TASK>
[   12.080597] 
[   12.093922] Allocated by task 208:
[   12.094230]  kasan_save_stack+0x45/0x70
[   12.094512]  kasan_save_track+0x18/0x40
[   12.095288]  kasan_save_alloc_info+0x3b/0x50
[   12.095484]  __kasan_kmalloc+0xb7/0xc0
[   12.096108]  __kmalloc_cache_noprof+0x189/0x420
[   12.096386]  kmalloc_uaf2+0xc6/0x520
[   12.096683]  kunit_try_run_case+0x1a5/0x480
[   12.096907]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.097186]  kthread+0x337/0x6f0
[   12.097460]  ret_from_fork+0x41/0x80
[   12.097807]  ret_from_fork_asm+0x1a/0x30
[   12.098183] 
[   12.098465] Freed by task 208:
[   12.098746]  kasan_save_stack+0x45/0x70
[   12.099061]  kasan_save_track+0x18/0x40
[   12.100013]  kasan_save_free_info+0x3f/0x60
[   12.100265]  __kasan_slab_free+0x56/0x70
[   12.100431]  kfree+0x222/0x3f0
[   12.100659]  kmalloc_uaf2+0x14c/0x520
[   12.100864]  kunit_try_run_case+0x1a5/0x480
[   12.101035]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.101368]  kthread+0x337/0x6f0
[   12.101807]  ret_from_fork+0x41/0x80
[   12.102131]  ret_from_fork_asm+0x1a/0x30
[   12.102589] 
[   12.102782] The buggy address belongs to the object at ffff8881029e0180
[   12.102782]  which belongs to the cache kmalloc-64 of size 64
[   12.103717] The buggy address is located 40 bytes inside of
[   12.103717]  freed 64-byte region [ffff8881029e0180, ffff8881029e01c0)
[   12.104220] 
[   12.104521] The buggy address belongs to the physical page:
[   12.104914] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029e0
[   12.105201] flags: 0x200000000000000(node=0|zone=2)
[   12.106237] page_type: f5(slab)
[   12.106531] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.106928] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.107524] page dumped because: kasan: bad access detected
[   12.107728] 
[   12.107860] Memory state around the buggy address:
[   12.108175]  ffff8881029e0080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.108565]  ffff8881029e0100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.108924] >ffff8881029e0180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.109264]                                   ^
[   12.109549]  ffff8881029e0200: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   12.110037]  ffff8881029e0280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.110566] ==================================================================