Hay
Date
May 12, 2025, 11:48 a.m.

Environment
qemu-arm64
qemu-x86_64

[   16.887912] ==================================================================
[   16.888035] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   16.888160] Read of size 1 at addr fff00000c10cc848 by task kunit_try_catch/184
[   16.888266] 
[   16.888346] CPU: 1 UID: 0 PID: 184 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT 
[   16.888528] Tainted: [B]=BAD_PAGE, [N]=TEST
[   16.888613] Hardware name: linux,dummy-virt (DT)
[   16.889147] Call trace:
[   16.889214]  show_stack+0x20/0x38 (C)
[   16.889375]  dump_stack_lvl+0x8c/0xd0
[   16.889485]  print_report+0x118/0x608
[   16.889579]  kasan_report+0xdc/0x128
[   16.889675]  __asan_report_load1_noabort+0x20/0x30
[   16.889783]  kmalloc_uaf+0x300/0x338
[   16.889877]  kunit_try_run_case+0x170/0x3f0
[   16.890382]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.890505]  kthread+0x328/0x630
[   16.890614]  ret_from_fork+0x10/0x20
[   16.890718] 
[   16.890763] Allocated by task 184:
[   16.890823]  kasan_save_stack+0x3c/0x68
[   16.890911]  kasan_save_track+0x20/0x40
[   16.891603]  kasan_save_alloc_info+0x40/0x58
[   16.891956]  __kasan_kmalloc+0xd4/0xd8
[   16.892318]  __kmalloc_cache_noprof+0x15c/0x3c0
[   16.892686]  kmalloc_uaf+0xb8/0x338
[   16.893057]  kunit_try_run_case+0x170/0x3f0
[   16.893145]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.893253]  kthread+0x328/0x630
[   16.893385]  ret_from_fork+0x10/0x20
[   16.893504] 
[   16.893552] Freed by task 184:
[   16.893611]  kasan_save_stack+0x3c/0x68
[   16.893690]  kasan_save_track+0x20/0x40
[   16.893759]  kasan_save_free_info+0x4c/0x78
[   16.893840]  __kasan_slab_free+0x6c/0x98
[   16.893946]  kfree+0x214/0x3c8
[   16.894013]  kmalloc_uaf+0x11c/0x338
[   16.894102]  kunit_try_run_case+0x170/0x3f0
[   16.894202]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.894293]  kthread+0x328/0x630
[   16.894723]  ret_from_fork+0x10/0x20
[   16.894961] 
[   16.895003] The buggy address belongs to the object at fff00000c10cc840
[   16.895003]  which belongs to the cache kmalloc-16 of size 16
[   16.895122] The buggy address is located 8 bytes inside of
[   16.895122]  freed 16-byte region [fff00000c10cc840, fff00000c10cc850)
[   16.895237] 
[   16.895274] The buggy address belongs to the physical page:
[   16.895336] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1010cc
[   16.895441] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   16.896097] page_type: f5(slab)
[   16.897317] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   16.897518] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   16.897777] page dumped because: kasan: bad access detected
[   16.897884] 
[   16.897997] Memory state around the buggy address:
[   16.898093]  fff00000c10cc700: fa fb fc fc 00 07 fc fc fa fb fc fc fa fb fc fc
[   16.898170]  fff00000c10cc780: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   16.898256] >fff00000c10cc800: fa fb fc fc fa fb fc fc fa fb fc fc fc fc fc fc
[   16.898323]                                               ^
[   16.898393]  fff00000c10cc880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.898478]  fff00000c10cc900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.899218] ==================================================================

[   16.911494] ==================================================================
[   16.912226] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   16.912879] Read of size 1 at addr ffff88810229d6a8 by task kunit_try_catch/201
[   16.913220] 
[   16.913595] CPU: 0 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT(voluntary) 
[   16.913700] Tainted: [B]=BAD_PAGE, [N]=TEST
[   16.913726] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   16.913771] Call Trace:
[   16.913796]  <TASK>
[   16.913828]  dump_stack_lvl+0x73/0xb0
[   16.913889]  print_report+0xd1/0x650
[   16.913930]  ? __virt_addr_valid+0x1db/0x2d0
[   16.913972]  ? kmalloc_uaf+0x320/0x380
[   16.914011]  ? kasan_complete_mode_report_info+0x64/0x200
[   16.914050]  ? kmalloc_uaf+0x320/0x380
[   16.914088]  kasan_report+0x141/0x180
[   16.914132]  ? kmalloc_uaf+0x320/0x380
[   16.914178]  __asan_report_load1_noabort+0x18/0x20
[   16.914215]  kmalloc_uaf+0x320/0x380
[   16.914250]  ? __pfx_kmalloc_uaf+0x10/0x10
[   16.914307]  ? __schedule+0x10cc/0x2b60
[   16.914354]  ? __pfx_read_tsc+0x10/0x10
[   16.914398]  ? ktime_get_ts64+0x86/0x230
[   16.914597]  kunit_try_run_case+0x1a5/0x480
[   16.914653]  ? __pfx_kunit_try_run_case+0x10/0x10
[   16.914698]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   16.914755]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   16.914779]  ? __kthread_parkme+0x82/0x180
[   16.914801]  ? preempt_count_sub+0x50/0x80
[   16.914826]  ? __pfx_kunit_try_run_case+0x10/0x10
[   16.914850]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   16.914874]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   16.914898]  kthread+0x337/0x6f0
[   16.914918]  ? trace_preempt_on+0x20/0xc0
[   16.914944]  ? __pfx_kthread+0x10/0x10
[   16.914965]  ? _raw_spin_unlock_irq+0x47/0x80
[   16.914987]  ? calculate_sigpending+0x7b/0xa0
[   16.915025]  ? __pfx_kthread+0x10/0x10
[   16.915065]  ret_from_fork+0x116/0x1d0
[   16.915123]  ? __pfx_kthread+0x10/0x10
[   16.915161]  ret_from_fork_asm+0x1a/0x30
[   16.915211]  </TASK>
[   16.915233] 
[   16.928991] Allocated by task 201:
[   16.929387]  kasan_save_stack+0x45/0x70
[   16.929943]  kasan_save_track+0x18/0x40
[   16.930297]  kasan_save_alloc_info+0x3b/0x50
[   16.930786]  __kasan_kmalloc+0xb7/0xc0
[   16.931188]  __kmalloc_cache_noprof+0x189/0x420
[   16.931624]  kmalloc_uaf+0xaa/0x380
[   16.932082]  kunit_try_run_case+0x1a5/0x480
[   16.932532]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   16.933025]  kthread+0x337/0x6f0
[   16.933738]  ret_from_fork+0x116/0x1d0
[   16.934000]  ret_from_fork_asm+0x1a/0x30
[   16.934354] 
[   16.934539] Freed by task 201:
[   16.934870]  kasan_save_stack+0x45/0x70
[   16.935106]  kasan_save_track+0x18/0x40
[   16.935697]  kasan_save_free_info+0x3f/0x60
[   16.935975]  __kasan_slab_free+0x56/0x70
[   16.936347]  kfree+0x222/0x3f0
[   16.936508]  kmalloc_uaf+0x12c/0x380
[   16.936685]  kunit_try_run_case+0x1a5/0x480
[   16.937425]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   16.937953]  kthread+0x337/0x6f0
[   16.938472]  ret_from_fork+0x116/0x1d0
[   16.938870]  ret_from_fork_asm+0x1a/0x30
[   16.939241] 
[   16.939464] The buggy address belongs to the object at ffff88810229d6a0
[   16.939464]  which belongs to the cache kmalloc-16 of size 16
[   16.940394] The buggy address is located 8 bytes inside of
[   16.940394]  freed 16-byte region [ffff88810229d6a0, ffff88810229d6b0)
[   16.940807] 
[   16.940945] The buggy address belongs to the physical page:
[   16.941779] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10229d
[   16.942426] flags: 0x200000000000000(node=0|zone=2)
[   16.942727] page_type: f5(slab)
[   16.942972] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   16.943691] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   16.944019] page dumped because: kasan: bad access detected
[   16.944556] 
[   16.944745] Memory state around the buggy address:
[   16.945053]  ffff88810229d580: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   16.945340]  ffff88810229d600: fa fb fc fc fa fb fc fc 00 05 fc fc fa fb fc fc
[   16.945811] >ffff88810229d680: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   16.946102]                                   ^
[   16.946913]  ffff88810229d700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.947524]  ffff88810229d780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.948199] ==================================================================