Hay
Date
July 8, 2025, 11:09 p.m.

Environment
qemu-arm64
qemu-x86_64

[   19.526147] ==================================================================
[   19.526223] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   19.526282] Write of size 33 at addr fff00000c771c180 by task kunit_try_catch/186
[   19.526333] 
[   19.526502] CPU: 1 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT 
[   19.526784] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.526816] Hardware name: linux,dummy-virt (DT)
[   19.526849] Call trace:
[   19.527114]  show_stack+0x20/0x38 (C)
[   19.527294]  dump_stack_lvl+0x8c/0xd0
[   19.527347]  print_report+0x118/0x608
[   19.527394]  kasan_report+0xdc/0x128
[   19.527441]  kasan_check_range+0x100/0x1a8
[   19.527541]  __asan_memset+0x34/0x78
[   19.527596]  kmalloc_uaf_memset+0x170/0x310
[   19.527677]  kunit_try_run_case+0x170/0x3f0
[   19.527727]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.527923]  kthread+0x328/0x630
[   19.527975]  ret_from_fork+0x10/0x20
[   19.528076] 
[   19.528150] Allocated by task 186:
[   19.528192]  kasan_save_stack+0x3c/0x68
[   19.528245]  kasan_save_track+0x20/0x40
[   19.528465]  kasan_save_alloc_info+0x40/0x58
[   19.528506]  __kasan_kmalloc+0xd4/0xd8
[   19.528583]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.528660]  kmalloc_uaf_memset+0xb8/0x310
[   19.528697]  kunit_try_run_case+0x170/0x3f0
[   19.528775]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.528954]  kthread+0x328/0x630
[   19.528991]  ret_from_fork+0x10/0x20
[   19.529076] 
[   19.529095] Freed by task 186:
[   19.529291]  kasan_save_stack+0x3c/0x68
[   19.529414]  kasan_save_track+0x20/0x40
[   19.529528]  kasan_save_free_info+0x4c/0x78
[   19.529586]  __kasan_slab_free+0x6c/0x98
[   19.529645]  kfree+0x214/0x3c8
[   19.529727]  kmalloc_uaf_memset+0x11c/0x310
[   19.529786]  kunit_try_run_case+0x170/0x3f0
[   19.529929]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.529993]  kthread+0x328/0x630
[   19.530167]  ret_from_fork+0x10/0x20
[   19.530203] 
[   19.530222] The buggy address belongs to the object at fff00000c771c180
[   19.530222]  which belongs to the cache kmalloc-64 of size 64
[   19.530329] The buggy address is located 0 bytes inside of
[   19.530329]  freed 64-byte region [fff00000c771c180, fff00000c771c1c0)
[   19.530877] 
[   19.530977] The buggy address belongs to the physical page:
[   19.531066] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10771c
[   19.531179] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.531331] page_type: f5(slab)
[   19.531423] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   19.531565] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   19.531609] page dumped because: kasan: bad access detected
[   19.531673] 
[   19.531691] Memory state around the buggy address:
[   19.531961]  fff00000c771c080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.532129]  fff00000c771c100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.532446] >fff00000c771c180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.532490]                    ^
[   19.532518]  fff00000c771c200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.532583]  fff00000c771c280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.532623] ==================================================================

[   12.778153] ==================================================================
[   12.779314] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   12.780013] Write of size 33 at addr ffff888102b88400 by task kunit_try_catch/204
[   12.780762] 
[   12.780927] CPU: 0 UID: 0 PID: 204 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   12.780989] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.781000] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.781022] Call Trace:
[   12.781036]  <TASK>
[   12.781081]  dump_stack_lvl+0x73/0xb0
[   12.781114]  print_report+0xd1/0x650
[   12.781148]  ? __virt_addr_valid+0x1db/0x2d0
[   12.781172]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.781192]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.781216]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.781237]  kasan_report+0x141/0x180
[   12.781258]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.781284]  kasan_check_range+0x10c/0x1c0
[   12.781307]  __asan_memset+0x27/0x50
[   12.781326]  kmalloc_uaf_memset+0x1a3/0x360
[   12.781347]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.781371]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.781397]  kunit_try_run_case+0x1a5/0x480
[   12.781421]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.781443]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.781467]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.781492]  ? __kthread_parkme+0x82/0x180
[   12.781519]  ? preempt_count_sub+0x50/0x80
[   12.781545]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.781569]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.781592]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.781626]  kthread+0x337/0x6f0
[   12.781644]  ? trace_preempt_on+0x20/0xc0
[   12.781668]  ? __pfx_kthread+0x10/0x10
[   12.781688]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.781713]  ? calculate_sigpending+0x7b/0xa0
[   12.781737]  ? __pfx_kthread+0x10/0x10
[   12.781758]  ret_from_fork+0x116/0x1d0
[   12.781778]  ? __pfx_kthread+0x10/0x10
[   12.781798]  ret_from_fork_asm+0x1a/0x30
[   12.781830]  </TASK>
[   12.781841] 
[   12.795000] Allocated by task 204:
[   12.795267]  kasan_save_stack+0x45/0x70
[   12.795427]  kasan_save_track+0x18/0x40
[   12.795667]  kasan_save_alloc_info+0x3b/0x50
[   12.796079]  __kasan_kmalloc+0xb7/0xc0
[   12.796491]  __kmalloc_cache_noprof+0x189/0x420
[   12.797045]  kmalloc_uaf_memset+0xa9/0x360
[   12.797503]  kunit_try_run_case+0x1a5/0x480
[   12.798068]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.798575]  kthread+0x337/0x6f0
[   12.798739]  ret_from_fork+0x116/0x1d0
[   12.798940]  ret_from_fork_asm+0x1a/0x30
[   12.799331] 
[   12.799518] Freed by task 204:
[   12.799829]  kasan_save_stack+0x45/0x70
[   12.800265]  kasan_save_track+0x18/0x40
[   12.800677]  kasan_save_free_info+0x3f/0x60
[   12.800955]  __kasan_slab_free+0x56/0x70
[   12.801325]  kfree+0x222/0x3f0
[   12.801442]  kmalloc_uaf_memset+0x12b/0x360
[   12.801855]  kunit_try_run_case+0x1a5/0x480
[   12.802300]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.802901]  kthread+0x337/0x6f0
[   12.803268]  ret_from_fork+0x116/0x1d0
[   12.803415]  ret_from_fork_asm+0x1a/0x30
[   12.803819] 
[   12.804007] The buggy address belongs to the object at ffff888102b88400
[   12.804007]  which belongs to the cache kmalloc-64 of size 64
[   12.804993] The buggy address is located 0 bytes inside of
[   12.804993]  freed 64-byte region [ffff888102b88400, ffff888102b88440)
[   12.806019] 
[   12.806186] The buggy address belongs to the physical page:
[   12.806724] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102b88
[   12.807333] flags: 0x200000000000000(node=0|zone=2)
[   12.807890] page_type: f5(slab)
[   12.808102] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.808817] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.809455] page dumped because: kasan: bad access detected
[   12.810082] 
[   12.810206] Memory state around the buggy address:
[   12.810584]  ffff888102b88300: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.811027]  ffff888102b88380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.811243] >ffff888102b88400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.811454]                    ^
[   12.811657]  ffff888102b88480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.812310]  ffff888102b88500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.813089] ==================================================================