Hay
Date
July 1, 2025, 3:08 p.m.

Environment
qemu-arm64
qemu-x86_64

[   17.113934] ==================================================================
[   17.114018] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   17.114085] Write of size 33 at addr fff00000c57c9e00 by task kunit_try_catch/187
[   17.114138] 
[   17.114179] CPU: 1 UID: 0 PID: 187 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   17.114268] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.114295] Hardware name: linux,dummy-virt (DT)
[   17.114329] Call trace:
[   17.114353]  show_stack+0x20/0x38 (C)
[   17.114405]  dump_stack_lvl+0x8c/0xd0
[   17.114455]  print_report+0x118/0x608
[   17.114502]  kasan_report+0xdc/0x128
[   17.114548]  kasan_check_range+0x100/0x1a8
[   17.121355]  __asan_memset+0x34/0x78
[   17.121417]  kmalloc_uaf_memset+0x170/0x310
[   17.122578]  kunit_try_run_case+0x170/0x3f0
[   17.123099]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.123171]  kthread+0x328/0x630
[   17.123215]  ret_from_fork+0x10/0x20
[   17.124160] 
[   17.124260] Allocated by task 187:
[   17.125163]  kasan_save_stack+0x3c/0x68
[   17.125362]  kasan_save_track+0x20/0x40
[   17.125400]  kasan_save_alloc_info+0x40/0x58
[   17.126025]  __kasan_kmalloc+0xd4/0xd8
[   17.126326]  __kmalloc_cache_noprof+0x16c/0x3c0
[   17.126425]  kmalloc_uaf_memset+0xb8/0x310
[   17.126463]  kunit_try_run_case+0x170/0x3f0
[   17.127054]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.127374]  kthread+0x328/0x630
[   17.127480]  ret_from_fork+0x10/0x20
[   17.127518] 
[   17.127538] Freed by task 187:
[   17.128476]  kasan_save_stack+0x3c/0x68
[   17.128770]  kasan_save_track+0x20/0x40
[   17.129056]  kasan_save_free_info+0x4c/0x78
[   17.129530]  __kasan_slab_free+0x6c/0x98
[   17.129633]  kfree+0x214/0x3c8
[   17.130227]  kmalloc_uaf_memset+0x11c/0x310
[   17.131189]  kunit_try_run_case+0x170/0x3f0
[   17.131380]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.131428]  kthread+0x328/0x630
[   17.131459]  ret_from_fork+0x10/0x20
[   17.132142] 
[   17.132212] The buggy address belongs to the object at fff00000c57c9e00
[   17.132212]  which belongs to the cache kmalloc-64 of size 64
[   17.132497] The buggy address is located 0 bytes inside of
[   17.132497]  freed 64-byte region [fff00000c57c9e00, fff00000c57c9e40)
[   17.133416] 
[   17.133446] The buggy address belongs to the physical page:
[   17.133480] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1057c9
[   17.133937] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.134561] page_type: f5(slab)
[   17.134627] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   17.135968] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   17.136095] page dumped because: kasan: bad access detected
[   17.136129] 
[   17.136147] Memory state around the buggy address:
[   17.136187]  fff00000c57c9d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.137085]  fff00000c57c9d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.137993] >fff00000c57c9e00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.138169]                    ^
[   17.138450]  fff00000c57c9e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.138531]  fff00000c57c9f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.139541] ==================================================================

[   11.883809] ==================================================================
[   11.884652] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   11.884899] Write of size 33 at addr ffff8881027cbf00 by task kunit_try_catch/203
[   11.885140] 
[   11.885239] CPU: 1 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   11.885287] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.885299] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.885322] Call Trace:
[   11.885335]  <TASK>
[   11.885356]  dump_stack_lvl+0x73/0xb0
[   11.885386]  print_report+0xd1/0x650
[   11.885408]  ? __virt_addr_valid+0x1db/0x2d0
[   11.885432]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.885452]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.885472]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.885492]  kasan_report+0x141/0x180
[   11.885513]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.885537]  kasan_check_range+0x10c/0x1c0
[   11.885559]  __asan_memset+0x27/0x50
[   11.885577]  kmalloc_uaf_memset+0x1a3/0x360
[   11.885597]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   11.885618]  ? __schedule+0x10cc/0x2b60
[   11.885639]  ? __pfx_read_tsc+0x10/0x10
[   11.885660]  ? ktime_get_ts64+0x86/0x230
[   11.885684]  kunit_try_run_case+0x1a5/0x480
[   11.885708]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.885728]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.885750]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.885771]  ? __kthread_parkme+0x82/0x180
[   11.885792]  ? preempt_count_sub+0x50/0x80
[   11.885815]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.885838]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.885860]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.885882]  kthread+0x337/0x6f0
[   11.885900]  ? trace_preempt_on+0x20/0xc0
[   11.885924]  ? __pfx_kthread+0x10/0x10
[   11.885943]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.885962]  ? calculate_sigpending+0x7b/0xa0
[   11.885985]  ? __pfx_kthread+0x10/0x10
[   11.886006]  ret_from_fork+0x116/0x1d0
[   11.886049]  ? __pfx_kthread+0x10/0x10
[   11.886080]  ret_from_fork_asm+0x1a/0x30
[   11.886110]  </TASK>
[   11.886121] 
[   11.900431] Allocated by task 203:
[   11.900811]  kasan_save_stack+0x45/0x70
[   11.901250]  kasan_save_track+0x18/0x40
[   11.901663]  kasan_save_alloc_info+0x3b/0x50
[   11.902162]  __kasan_kmalloc+0xb7/0xc0
[   11.902542]  __kmalloc_cache_noprof+0x189/0x420
[   11.903084]  kmalloc_uaf_memset+0xa9/0x360
[   11.903592]  kunit_try_run_case+0x1a5/0x480
[   11.904073]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.904612]  kthread+0x337/0x6f0
[   11.905011]  ret_from_fork+0x116/0x1d0
[   11.905469]  ret_from_fork_asm+0x1a/0x30
[   11.906013] 
[   11.906203] Freed by task 203:
[   11.906534]  kasan_save_stack+0x45/0x70
[   11.906995]  kasan_save_track+0x18/0x40
[   11.907431]  kasan_save_free_info+0x3f/0x60
[   11.907896]  __kasan_slab_free+0x56/0x70
[   11.908290]  kfree+0x222/0x3f0
[   11.908554]  kmalloc_uaf_memset+0x12b/0x360
[   11.908707]  kunit_try_run_case+0x1a5/0x480
[   11.908856]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.909040]  kthread+0x337/0x6f0
[   11.909164]  ret_from_fork+0x116/0x1d0
[   11.909418]  ret_from_fork_asm+0x1a/0x30
[   11.909561] 
[   11.909689] The buggy address belongs to the object at ffff8881027cbf00
[   11.909689]  which belongs to the cache kmalloc-64 of size 64
[   11.910926] The buggy address is located 0 bytes inside of
[   11.910926]  freed 64-byte region [ffff8881027cbf00, ffff8881027cbf40)
[   11.911321] 
[   11.911398] The buggy address belongs to the physical page:
[   11.911571] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1027cb
[   11.912398] flags: 0x200000000000000(node=0|zone=2)
[   11.912947] page_type: f5(slab)
[   11.913278] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   11.914004] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   11.914722] page dumped because: kasan: bad access detected
[   11.914992] 
[   11.915076] Memory state around the buggy address:
[   11.915235]  ffff8881027cbe00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.915448]  ffff8881027cbe80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.915896] >ffff8881027cbf00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.916519]                    ^
[   11.916944]  ffff8881027cbf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.917570]  ffff8881027cc000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   11.918264] ==================================================================