Hay
Date
June 5, 2025, 7:08 a.m.

Environment
qemu-arm64
qemu-x86_64

[   25.388556] ==================================================================
[   25.388635] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   25.388697] Read of size 1 at addr fff00000c3fa58e8 by task kunit_try_catch/184
[   25.388759] 
[   25.388799] CPU: 0 UID: 0 PID: 184 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250605 #1 PREEMPT 
[   25.388902] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.388936] Hardware name: linux,dummy-virt (DT)
[   25.388976] Call trace:
[   25.389003]  show_stack+0x20/0x38 (C)
[   25.389063]  dump_stack_lvl+0x8c/0xd0
[   25.389125]  print_report+0x118/0x608
[   25.389184]  kasan_report+0xdc/0x128
[   25.389242]  __asan_report_load1_noabort+0x20/0x30
[   25.389316]  kmalloc_uaf+0x300/0x338
[   25.389401]  kunit_try_run_case+0x170/0x3f0
[   25.389461]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.389531]  kthread+0x328/0x630
[   25.389582]  ret_from_fork+0x10/0x20
[   25.389639] 
[   25.389662] Allocated by task 184:
[   25.389697]  kasan_save_stack+0x3c/0x68
[   25.389749]  kasan_save_track+0x20/0x40
[   25.389799]  kasan_save_alloc_info+0x40/0x58
[   25.389848]  __kasan_kmalloc+0xd4/0xd8
[   25.389896]  __kmalloc_cache_noprof+0x16c/0x3c0
[   25.389943]  kmalloc_uaf+0xb8/0x338
[   25.389987]  kunit_try_run_case+0x170/0x3f0
[   25.390034]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.390090]  kthread+0x328/0x630
[   25.390131]  ret_from_fork+0x10/0x20
[   25.390177] 
[   25.390201] Freed by task 184:
[   25.390233]  kasan_save_stack+0x3c/0x68
[   25.390282]  kasan_save_track+0x20/0x40
[   25.390506]  kasan_save_free_info+0x4c/0x78
[   25.390630]  __kasan_slab_free+0x6c/0x98
[   25.390909]  kfree+0x214/0x3c8
[   25.391157]  kmalloc_uaf+0x11c/0x338
[   25.391288]  kunit_try_run_case+0x170/0x3f0
[   25.391402]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.391513]  kthread+0x328/0x630
[   25.391591]  ret_from_fork+0x10/0x20
[   25.391689] 
[   25.391810] The buggy address belongs to the object at fff00000c3fa58e0
[   25.391810]  which belongs to the cache kmalloc-16 of size 16
[   25.392020] The buggy address is located 8 bytes inside of
[   25.392020]  freed 16-byte region [fff00000c3fa58e0, fff00000c3fa58f0)
[   25.392267] 
[   25.392376] The buggy address belongs to the physical page:
[   25.392470] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x103fa5
[   25.392631] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   25.392843] page_type: f5(slab)
[   25.393083] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   25.393782] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   25.393994] page dumped because: kasan: bad access detected
[   25.394384] 
[   25.394506] Memory state around the buggy address:
[   25.394586]  fff00000c3fa5780: fa fb fc fc fa fb fc fc fa fb fc fc 00 02 fc fc
[   25.394850]  fff00000c3fa5800: 00 02 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   25.395490] >fff00000c3fa5880: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   25.395906]                                                           ^
[   25.396101]  fff00000c3fa5900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.396240]  fff00000c3fa5980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.396490] ==================================================================


[   11.639187] ==================================================================
[   11.639571] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   11.639883] Read of size 1 at addr ffff88810188eec8 by task kunit_try_catch/201
[   11.640608] 
[   11.640830] CPU: 1 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250605 #1 PREEMPT(voluntary) 
[   11.641035] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.641052] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.641072] Call Trace:
[   11.641089]  <TASK>
[   11.641103]  dump_stack_lvl+0x73/0xb0
[   11.641129]  print_report+0xd1/0x650
[   11.641150]  ? __virt_addr_valid+0x1db/0x2d0
[   11.641172]  ? kmalloc_uaf+0x320/0x380
[   11.641191]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.641213]  ? kmalloc_uaf+0x320/0x380
[   11.641233]  kasan_report+0x141/0x180
[   11.641254]  ? kmalloc_uaf+0x320/0x380
[   11.641278]  __asan_report_load1_noabort+0x18/0x20
[   11.641302]  kmalloc_uaf+0x320/0x380
[   11.641322]  ? __pfx_kmalloc_uaf+0x10/0x10
[   11.641344]  ? __pfx_kmalloc_uaf+0x10/0x10
[   11.641368]  kunit_try_run_case+0x1a5/0x480
[   11.641388]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.641407]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.641430]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.641454]  ? __kthread_parkme+0x82/0x180
[   11.641474]  ? preempt_count_sub+0x50/0x80
[   11.641496]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.641516]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.641540]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.641564]  kthread+0x337/0x6f0
[   11.641583]  ? trace_preempt_on+0x20/0xc0
[   11.641605]  ? __pfx_kthread+0x10/0x10
[   11.641625]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.641655]  ? calculate_sigpending+0x7b/0xa0
[   11.641678]  ? __pfx_kthread+0x10/0x10
[   11.641699]  ret_from_fork+0x116/0x1d0
[   11.641716]  ? __pfx_kthread+0x10/0x10
[   11.641736]  ret_from_fork_asm+0x1a/0x30
[   11.641765]  </TASK>
[   11.641775] 
[   11.653635] Allocated by task 201:
[   11.654129]  kasan_save_stack+0x45/0x70
[   11.654296]  kasan_save_track+0x18/0x40
[   11.654709]  kasan_save_alloc_info+0x3b/0x50
[   11.655171]  __kasan_kmalloc+0xb7/0xc0
[   11.655312]  __kmalloc_cache_noprof+0x189/0x420
[   11.655468]  kmalloc_uaf+0xaa/0x380
[   11.655593]  kunit_try_run_case+0x1a5/0x480
[   11.656010]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.656544]  kthread+0x337/0x6f0
[   11.656928]  ret_from_fork+0x116/0x1d0
[   11.657356]  ret_from_fork_asm+0x1a/0x30
[   11.657767] 
[   11.657933] Freed by task 201:
[   11.658363]  kasan_save_stack+0x45/0x70
[   11.658617]  kasan_save_track+0x18/0x40
[   11.658755]  kasan_save_free_info+0x3f/0x60
[   11.658912]  __kasan_slab_free+0x56/0x70
[   11.659299]  kfree+0x222/0x3f0
[   11.661015]  kmalloc_uaf+0x12c/0x380
[   11.661225]  kunit_try_run_case+0x1a5/0x480
[   11.661440]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.661682]  kthread+0x337/0x6f0
[   11.661846]  ret_from_fork+0x116/0x1d0
[   11.663276]  ret_from_fork_asm+0x1a/0x30
[   11.664381] 
[   11.665102] The buggy address belongs to the object at ffff88810188eec0
[   11.665102]  which belongs to the cache kmalloc-16 of size 16
[   11.667189] The buggy address is located 8 bytes inside of
[   11.667189]  freed 16-byte region [ffff88810188eec0, ffff88810188eed0)
[   11.668436] 
[   11.668519] The buggy address belongs to the physical page:
[   11.668698] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10188e
[   11.669483] flags: 0x200000000000000(node=0|zone=2)
[   11.670146] page_type: f5(slab)
[   11.670451] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   11.671255] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   11.671920] page dumped because: kasan: bad access detected
[   11.672509] 
[   11.672613] Memory state around the buggy address:
[   11.673046]  ffff88810188ed80: 00 00 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   11.673294]  ffff88810188ee00: 00 04 fc fc 00 04 fc fc fa fb fc fc fa fb fc fc
[   11.674068] >ffff88810188ee80: fa fb fc fc fa fb fc fc fa fb fc fc fc fc fc fc
[   11.674734]                                               ^
[   11.675321]  ffff88810188ef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.675542]  ffff88810188ef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.675983] ==================================================================