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

Environment
qemu-arm64
qemu-x86_64

[   19.663899] ==================================================================
[   19.664029] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   19.664139] Write of size 33 at addr fff00000c59a1180 by task kunit_try_catch/187
[   19.664257] 
[   19.664327] CPU: 0 UID: 0 PID: 187 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT 
[   19.664504] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.664569] Hardware name: linux,dummy-virt (DT)
[   19.664652] Call trace:
[   19.664695]  show_stack+0x20/0x38 (C)
[   19.664800]  dump_stack_lvl+0x8c/0xd0
[   19.664920]  print_report+0x118/0x608
[   19.665238]  kasan_report+0xdc/0x128
[   19.665564]  kasan_check_range+0x100/0x1a8
[   19.665788]  __asan_memset+0x34/0x78
[   19.665887]  kmalloc_uaf_memset+0x170/0x310
[   19.665973]  kunit_try_run_case+0x170/0x3f0
[   19.666069]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.666331]  kthread+0x328/0x630
[   19.666421]  ret_from_fork+0x10/0x20
[   19.666536] 
[   19.666585] Allocated by task 187:
[   19.666656]  kasan_save_stack+0x3c/0x68
[   19.666747]  kasan_save_track+0x20/0x40
[   19.666845]  kasan_save_alloc_info+0x40/0x58
[   19.667292]  __kasan_kmalloc+0xd4/0xd8
[   19.667559]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.667934]  kmalloc_uaf_memset+0xb8/0x310
[   19.668064]  kunit_try_run_case+0x170/0x3f0
[   19.668159]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.668297]  kthread+0x328/0x630
[   19.668372]  ret_from_fork+0x10/0x20
[   19.668450] 
[   19.668492] Freed by task 187:
[   19.668552]  kasan_save_stack+0x3c/0x68
[   19.668636]  kasan_save_track+0x20/0x40
[   19.668748]  kasan_save_free_info+0x4c/0x78
[   19.668851]  __kasan_slab_free+0x6c/0x98
[   19.668926]  kfree+0x214/0x3c8
[   19.668993]  kmalloc_uaf_memset+0x11c/0x310
[   19.669166]  kunit_try_run_case+0x170/0x3f0
[   19.669256]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.669701]  kthread+0x328/0x630
[   19.669782]  ret_from_fork+0x10/0x20
[   19.670425] 
[   19.670553] The buggy address belongs to the object at fff00000c59a1180
[   19.670553]  which belongs to the cache kmalloc-64 of size 64
[   19.670742] The buggy address is located 0 bytes inside of
[   19.670742]  freed 64-byte region [fff00000c59a1180, fff00000c59a11c0)
[   19.670973] 
[   19.671021] The buggy address belongs to the physical page:
[   19.671105] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1059a1
[   19.671235] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.671340] page_type: f5(slab)
[   19.671652] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   19.671855] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   19.672329] page dumped because: kasan: bad access detected
[   19.672414] 
[   19.672847] Memory state around the buggy address:
[   19.673095]  fff00000c59a1080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.673201]  fff00000c59a1100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.673281] >fff00000c59a1180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.673362]                    ^
[   19.673421]  fff00000c59a1200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.674236]  fff00000c59a1280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.674408] ==================================================================

[   12.893063] ==================================================================
[   12.893499] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   12.893862] Write of size 33 at addr ffff888102658d80 by task kunit_try_catch/204
[   12.894191] 
[   12.894301] CPU: 1 UID: 0 PID: 204 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   12.894343] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.894354] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.894378] Call Trace:
[   12.894389]  <TASK>
[   12.894403]  dump_stack_lvl+0x73/0xb0
[   12.894431]  print_report+0xd1/0x650
[   12.894452]  ? __virt_addr_valid+0x1db/0x2d0
[   12.894474]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.894495]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.894517]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.894538]  kasan_report+0x141/0x180
[   12.894560]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.894585]  kasan_check_range+0x10c/0x1c0
[   12.894608]  __asan_memset+0x27/0x50
[   12.894627]  kmalloc_uaf_memset+0x1a3/0x360
[   12.894648]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.894670]  ? __schedule+0x10cc/0x2b60
[   12.894691]  ? __pfx_read_tsc+0x10/0x10
[   12.894711]  ? ktime_get_ts64+0x86/0x230
[   12.894734]  kunit_try_run_case+0x1a5/0x480
[   12.894770]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.894800]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.894823]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.894847]  ? __kthread_parkme+0x82/0x180
[   12.894874]  ? preempt_count_sub+0x50/0x80
[   12.894898]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.894921]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.894947]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.894971]  kthread+0x337/0x6f0
[   12.894990]  ? trace_preempt_on+0x20/0xc0
[   12.895012]  ? __pfx_kthread+0x10/0x10
[   12.895032]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.895053]  ? calculate_sigpending+0x7b/0xa0
[   12.895077]  ? __pfx_kthread+0x10/0x10
[   12.895098]  ret_from_fork+0x116/0x1d0
[   12.895116]  ? __pfx_kthread+0x10/0x10
[   12.895136]  ret_from_fork_asm+0x1a/0x30
[   12.895166]  </TASK>
[   12.895176] 
[   12.903613] Allocated by task 204:
[   12.904023]  kasan_save_stack+0x45/0x70
[   12.904224]  kasan_save_track+0x18/0x40
[   12.904416]  kasan_save_alloc_info+0x3b/0x50
[   12.904622]  __kasan_kmalloc+0xb7/0xc0
[   12.905115]  __kmalloc_cache_noprof+0x189/0x420
[   12.905297]  kmalloc_uaf_memset+0xa9/0x360
[   12.905672]  kunit_try_run_case+0x1a5/0x480
[   12.906078]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.906315]  kthread+0x337/0x6f0
[   12.906634]  ret_from_fork+0x116/0x1d0
[   12.906821]  ret_from_fork_asm+0x1a/0x30
[   12.907034] 
[   12.907104] Freed by task 204:
[   12.907389]  kasan_save_stack+0x45/0x70
[   12.907840]  kasan_save_track+0x18/0x40
[   12.908220]  kasan_save_free_info+0x3f/0x60
[   12.908401]  __kasan_slab_free+0x56/0x70
[   12.908600]  kfree+0x222/0x3f0
[   12.908881]  kmalloc_uaf_memset+0x12b/0x360
[   12.909196]  kunit_try_run_case+0x1a5/0x480
[   12.909557]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.910057]  kthread+0x337/0x6f0
[   12.910416]  ret_from_fork+0x116/0x1d0
[   12.910608]  ret_from_fork_asm+0x1a/0x30
[   12.910871] 
[   12.910988] The buggy address belongs to the object at ffff888102658d80
[   12.910988]  which belongs to the cache kmalloc-64 of size 64
[   12.911857] The buggy address is located 0 bytes inside of
[   12.911857]  freed 64-byte region [ffff888102658d80, ffff888102658dc0)
[   12.912534] 
[   12.912628] The buggy address belongs to the physical page:
[   12.912874] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102658
[   12.913333] flags: 0x200000000000000(node=0|zone=2)
[   12.913575] page_type: f5(slab)
[   12.914017] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.914302] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.914866] page dumped because: kasan: bad access detected
[   12.915088] 
[   12.915183] Memory state around the buggy address:
[   12.915380]  ffff888102658c80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.915693]  ffff888102658d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.916285] >ffff888102658d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.916653]                    ^
[   12.916845]  ffff888102658e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.917176]  ffff888102658e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.917618] ==================================================================