Hay
Date
July 15, 2025, 11:09 a.m.

Environment
qemu-arm64
qemu-x86_64

[   15.696307] ==================================================================
[   15.696421] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   15.696945] Write of size 33 at addr fff00000c594b000 by task kunit_try_catch/187
[   15.697228] 
[   15.697271] CPU: 1 UID: 0 PID: 187 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT 
[   15.697356] Tainted: [B]=BAD_PAGE, [N]=TEST
[   15.697382] Hardware name: linux,dummy-virt (DT)
[   15.697414] Call trace:
[   15.697436]  show_stack+0x20/0x38 (C)
[   15.697879]  dump_stack_lvl+0x8c/0xd0
[   15.697989]  print_report+0x118/0x5d0
[   15.698064]  kasan_report+0xdc/0x128
[   15.698239]  kasan_check_range+0x100/0x1a8
[   15.698453]  __asan_memset+0x34/0x78
[   15.698698]  kmalloc_uaf_memset+0x170/0x310
[   15.698749]  kunit_try_run_case+0x170/0x3f0
[   15.698799]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.699283]  kthread+0x328/0x630
[   15.699377]  ret_from_fork+0x10/0x20
[   15.699436] 
[   15.699455] Allocated by task 187:
[   15.699486]  kasan_save_stack+0x3c/0x68
[   15.699526]  kasan_save_track+0x20/0x40
[   15.699564]  kasan_save_alloc_info+0x40/0x58
[   15.699603]  __kasan_kmalloc+0xd4/0xd8
[   15.699639]  __kmalloc_cache_noprof+0x16c/0x3c0
[   15.700168]  kmalloc_uaf_memset+0xb8/0x310
[   15.700234]  kunit_try_run_case+0x170/0x3f0
[   15.700710]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.700768]  kthread+0x328/0x630
[   15.700800]  ret_from_fork+0x10/0x20
[   15.700956] 
[   15.701220] Freed by task 187:
[   15.701252]  kasan_save_stack+0x3c/0x68
[   15.701862]  kasan_save_track+0x20/0x40
[   15.702204]  kasan_save_free_info+0x4c/0x78
[   15.702298]  __kasan_slab_free+0x6c/0x98
[   15.702526]  kfree+0x214/0x3c8
[   15.702560]  kmalloc_uaf_memset+0x11c/0x310
[   15.702597]  kunit_try_run_case+0x170/0x3f0
[   15.702635]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.702677]  kthread+0x328/0x630
[   15.702710]  ret_from_fork+0x10/0x20
[   15.702744] 
[   15.702764] The buggy address belongs to the object at fff00000c594b000
[   15.702764]  which belongs to the cache kmalloc-64 of size 64
[   15.704400] The buggy address is located 0 bytes inside of
[   15.704400]  freed 64-byte region [fff00000c594b000, fff00000c594b040)
[   15.704581] 
[   15.704603] The buggy address belongs to the physical page:
[   15.704636] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10594b
[   15.704694] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   15.704746] page_type: f5(slab)
[   15.704785] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   15.704835] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   15.704878] page dumped because: kasan: bad access detected
[   15.704909] 
[   15.704928] Memory state around the buggy address:
[   15.706449]  fff00000c594af00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   15.707029]  fff00000c594af80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   15.707377] >fff00000c594b000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   15.707850]                    ^
[   15.708338]  fff00000c594b080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.708417]  fff00000c594b100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.708464] ==================================================================

[   12.809989] ==================================================================
[   12.810439] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   12.810746] Write of size 33 at addr ffff8881032c8780 by task kunit_try_catch/203
[   12.811087] 
[   12.811185] CPU: 0 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT(voluntary) 
[   12.811229] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.811240] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.811261] Call Trace:
[   12.811272]  <TASK>
[   12.811288]  dump_stack_lvl+0x73/0xb0
[   12.811317]  print_report+0xd1/0x610
[   12.811338]  ? __virt_addr_valid+0x1db/0x2d0
[   12.811359]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.811379]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.811400]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.811421]  kasan_report+0x141/0x180
[   12.811441]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.811466]  kasan_check_range+0x10c/0x1c0
[   12.811488]  __asan_memset+0x27/0x50
[   12.811946]  kmalloc_uaf_memset+0x1a3/0x360
[   12.811979]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.812003]  ? __schedule+0x10cc/0x2b60
[   12.812026]  ? __pfx_read_tsc+0x10/0x10
[   12.812047]  ? ktime_get_ts64+0x86/0x230
[   12.812072]  kunit_try_run_case+0x1a5/0x480
[   12.812097]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.812120]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.812144]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.812168]  ? __kthread_parkme+0x82/0x180
[   12.812188]  ? preempt_count_sub+0x50/0x80
[   12.812212]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.812236]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.812261]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.812286]  kthread+0x337/0x6f0
[   12.812305]  ? trace_preempt_on+0x20/0xc0
[   12.812397]  ? __pfx_kthread+0x10/0x10
[   12.812420]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.812454]  ? calculate_sigpending+0x7b/0xa0
[   12.812478]  ? __pfx_kthread+0x10/0x10
[   12.812500]  ret_from_fork+0x116/0x1d0
[   12.812518]  ? __pfx_kthread+0x10/0x10
[   12.812538]  ret_from_fork_asm+0x1a/0x30
[   12.812569]  </TASK>
[   12.812581] 
[   12.824146] Allocated by task 203:
[   12.824630]  kasan_save_stack+0x45/0x70
[   12.825009]  kasan_save_track+0x18/0x40
[   12.825153]  kasan_save_alloc_info+0x3b/0x50
[   12.825303]  __kasan_kmalloc+0xb7/0xc0
[   12.825904]  __kmalloc_cache_noprof+0x189/0x420
[   12.826378]  kmalloc_uaf_memset+0xa9/0x360
[   12.826803]  kunit_try_run_case+0x1a5/0x480
[   12.827177]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.827521]  kthread+0x337/0x6f0
[   12.827836]  ret_from_fork+0x116/0x1d0
[   12.828129]  ret_from_fork_asm+0x1a/0x30
[   12.828270] 
[   12.828459] Freed by task 203:
[   12.828764]  kasan_save_stack+0x45/0x70
[   12.829119]  kasan_save_track+0x18/0x40
[   12.829521]  kasan_save_free_info+0x3f/0x60
[   12.829677]  __kasan_slab_free+0x56/0x70
[   12.829943]  kfree+0x222/0x3f0
[   12.830236]  kmalloc_uaf_memset+0x12b/0x360
[   12.830917]  kunit_try_run_case+0x1a5/0x480
[   12.831294]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.831675]  kthread+0x337/0x6f0
[   12.831810]  ret_from_fork+0x116/0x1d0
[   12.831943]  ret_from_fork_asm+0x1a/0x30
[   12.832082] 
[   12.832153] The buggy address belongs to the object at ffff8881032c8780
[   12.832153]  which belongs to the cache kmalloc-64 of size 64
[   12.832996] The buggy address is located 0 bytes inside of
[   12.832996]  freed 64-byte region [ffff8881032c8780, ffff8881032c87c0)
[   12.834082] 
[   12.834243] The buggy address belongs to the physical page:
[   12.834805] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1032c8
[   12.835671] flags: 0x200000000000000(node=0|zone=2)
[   12.836023] page_type: f5(slab)
[   12.836148] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.836592] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.837240] page dumped because: kasan: bad access detected
[   12.837812] 
[   12.837983] Memory state around the buggy address:
[   12.838200]  ffff8881032c8680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.838431]  ffff8881032c8700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.838647] >ffff8881032c8780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.838869]                    ^
[   12.838986]  ffff8881032c8800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.839199]  ffff8881032c8880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.839409] ==================================================================