Hay
Date
July 10, 2025, 6:10 p.m.

Environment
qemu-arm64
qemu-x86_64

[   17.055363] ==================================================================
[   17.055430] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x3f4/0x468
[   17.055486] Read of size 1 at addr fff00000c5a1df28 by task kunit_try_catch/188
[   17.055955] 
[   17.056008] CPU: 1 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT 
[   17.056168] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.056194] Hardware name: linux,dummy-virt (DT)
[   17.056311] Call trace:
[   17.056336]  show_stack+0x20/0x38 (C)
[   17.056749]  dump_stack_lvl+0x8c/0xd0
[   17.056824]  print_report+0x118/0x608
[   17.056927]  kasan_report+0xdc/0x128
[   17.057011]  __asan_report_load1_noabort+0x20/0x30
[   17.057248]  kmalloc_uaf2+0x3f4/0x468
[   17.057300]  kunit_try_run_case+0x170/0x3f0
[   17.057690]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.057920]  kthread+0x328/0x630
[   17.058254]  ret_from_fork+0x10/0x20
[   17.058316] 
[   17.058334] Allocated by task 188:
[   17.058372]  kasan_save_stack+0x3c/0x68
[   17.058613]  kasan_save_track+0x20/0x40
[   17.058850]  kasan_save_alloc_info+0x40/0x58
[   17.059058]  __kasan_kmalloc+0xd4/0xd8
[   17.059125]  __kmalloc_cache_noprof+0x16c/0x3c0
[   17.059335]  kmalloc_uaf2+0xc4/0x468
[   17.059397]  kunit_try_run_case+0x170/0x3f0
[   17.059787]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.060279]  kthread+0x328/0x630
[   17.060347]  ret_from_fork+0x10/0x20
[   17.060755] 
[   17.060864] Freed by task 188:
[   17.061089]  kasan_save_stack+0x3c/0x68
[   17.061417]  kasan_save_track+0x20/0x40
[   17.061567]  kasan_save_free_info+0x4c/0x78
[   17.061714]  __kasan_slab_free+0x6c/0x98
[   17.061807]  kfree+0x214/0x3c8
[   17.061845]  kmalloc_uaf2+0x134/0x468
[   17.062124]  kunit_try_run_case+0x170/0x3f0
[   17.062507]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.062720]  kthread+0x328/0x630
[   17.063087]  ret_from_fork+0x10/0x20
[   17.063157] 
[   17.063205] The buggy address belongs to the object at fff00000c5a1df00
[   17.063205]  which belongs to the cache kmalloc-64 of size 64
[   17.063487] The buggy address is located 40 bytes inside of
[   17.063487]  freed 64-byte region [fff00000c5a1df00, fff00000c5a1df40)
[   17.063714] 
[   17.063736] The buggy address belongs to the physical page:
[   17.063784] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105a1d
[   17.064110] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.064431] page_type: f5(slab)
[   17.064588] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   17.064643] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   17.065265] page dumped because: kasan: bad access detected
[   17.065495] 
[   17.065700] Memory state around the buggy address:
[   17.065988]  fff00000c5a1de00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.066120]  fff00000c5a1de80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.066279] >fff00000c5a1df00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.066409]                                   ^
[   17.066513]  fff00000c5a1df80: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   17.066558]  fff00000c5a1e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   17.067008] ==================================================================

[   12.805466] ==================================================================
[   12.806436] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   12.806671] Read of size 1 at addr ffff8881039ff728 by task kunit_try_catch/205
[   12.806904] 
[   12.806995] CPU: 0 UID: 0 PID: 205 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   12.807057] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.807069] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.807090] Call Trace:
[   12.807103]  <TASK>
[   12.807122]  dump_stack_lvl+0x73/0xb0
[   12.807174]  print_report+0xd1/0x650
[   12.807198]  ? __virt_addr_valid+0x1db/0x2d0
[   12.807221]  ? kmalloc_uaf2+0x4a8/0x520
[   12.807240]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.807263]  ? kmalloc_uaf2+0x4a8/0x520
[   12.807282]  kasan_report+0x141/0x180
[   12.807303]  ? kmalloc_uaf2+0x4a8/0x520
[   12.807343]  __asan_report_load1_noabort+0x18/0x20
[   12.807368]  kmalloc_uaf2+0x4a8/0x520
[   12.807399]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   12.807419]  ? finish_task_switch.isra.0+0x153/0x700
[   12.807443]  ? __switch_to+0x47/0xf50
[   12.807469]  ? __schedule+0x10cc/0x2b60
[   12.807491]  ? __pfx_read_tsc+0x10/0x10
[   12.807511]  ? ktime_get_ts64+0x86/0x230
[   12.807897]  kunit_try_run_case+0x1a5/0x480
[   12.807928]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.807959]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.807983]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.808007]  ? __kthread_parkme+0x82/0x180
[   12.808028]  ? preempt_count_sub+0x50/0x80
[   12.808061]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.808085]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.808109]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.808134]  kthread+0x337/0x6f0
[   12.808152]  ? trace_preempt_on+0x20/0xc0
[   12.808175]  ? __pfx_kthread+0x10/0x10
[   12.808196]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.808217]  ? calculate_sigpending+0x7b/0xa0
[   12.808241]  ? __pfx_kthread+0x10/0x10
[   12.808262]  ret_from_fork+0x116/0x1d0
[   12.808280]  ? __pfx_kthread+0x10/0x10
[   12.808302]  ret_from_fork_asm+0x1a/0x30
[   12.808332]  </TASK>
[   12.808343] 
[   12.820911] Allocated by task 205:
[   12.821054]  kasan_save_stack+0x45/0x70
[   12.821284]  kasan_save_track+0x18/0x40
[   12.821473]  kasan_save_alloc_info+0x3b/0x50
[   12.821681]  __kasan_kmalloc+0xb7/0xc0
[   12.821854]  __kmalloc_cache_noprof+0x189/0x420
[   12.822146]  kmalloc_uaf2+0xc6/0x520
[   12.822313]  kunit_try_run_case+0x1a5/0x480
[   12.822458]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.822713]  kthread+0x337/0x6f0
[   12.822915]  ret_from_fork+0x116/0x1d0
[   12.823147]  ret_from_fork_asm+0x1a/0x30
[   12.823316] 
[   12.823412] Freed by task 205:
[   12.823545]  kasan_save_stack+0x45/0x70
[   12.823706]  kasan_save_track+0x18/0x40
[   12.823839]  kasan_save_free_info+0x3f/0x60
[   12.823993]  __kasan_slab_free+0x56/0x70
[   12.824183]  kfree+0x222/0x3f0
[   12.824342]  kmalloc_uaf2+0x14c/0x520
[   12.824522]  kunit_try_run_case+0x1a5/0x480
[   12.824777]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.825011]  kthread+0x337/0x6f0
[   12.825140]  ret_from_fork+0x116/0x1d0
[   12.825272]  ret_from_fork_asm+0x1a/0x30
[   12.825522] 
[   12.825618] The buggy address belongs to the object at ffff8881039ff700
[   12.825618]  which belongs to the cache kmalloc-64 of size 64
[   12.826265] The buggy address is located 40 bytes inside of
[   12.826265]  freed 64-byte region [ffff8881039ff700, ffff8881039ff740)
[   12.826735] 
[   12.826820] The buggy address belongs to the physical page:
[   12.827000] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1039ff
[   12.827364] flags: 0x200000000000000(node=0|zone=2)
[   12.827607] page_type: f5(slab)
[   12.827728] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.827962] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.828371] page dumped because: kasan: bad access detected
[   12.828621] 
[   12.828711] Memory state around the buggy address:
[   12.828927]  ffff8881039ff600: 00 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc
[   12.829346]  ffff8881039ff680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.829566] >ffff8881039ff700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.829844]                                   ^
[   12.830229]  ffff8881039ff780: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   12.830549]  ffff8881039ff800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.830788] ==================================================================