Hay
Date
June 17, 2025, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   17.006213] ==================================================================
[   17.006331] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   17.006477] Write of size 33 at addr fff00000c505c600 by task kunit_try_catch/195
[   17.006550] 
[   17.006719] CPU: 1 UID: 0 PID: 195 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250617 #1 PREEMPT 
[   17.006817] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.007082] Hardware name: linux,dummy-virt (DT)
[   17.007483] Call trace:
[   17.007539]  show_stack+0x20/0x38 (C)
[   17.007638]  dump_stack_lvl+0x8c/0xd0
[   17.008047]  print_report+0x118/0x608
[   17.008127]  kasan_report+0xdc/0x128
[   17.008244]  kasan_check_range+0x100/0x1a8
[   17.008320]  __asan_memset+0x34/0x78
[   17.008512]  kmalloc_uaf_memset+0x170/0x310
[   17.008597]  kunit_try_run_case+0x170/0x3f0
[   17.008774]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.008863]  kthread+0x328/0x630
[   17.008909]  ret_from_fork+0x10/0x20
[   17.008970] 
[   17.008990] Allocated by task 195:
[   17.009019]  kasan_save_stack+0x3c/0x68
[   17.009072]  kasan_save_track+0x20/0x40
[   17.009109]  kasan_save_alloc_info+0x40/0x58
[   17.009147]  __kasan_kmalloc+0xd4/0xd8
[   17.009183]  __kmalloc_cache_noprof+0x16c/0x3c0
[   17.009226]  kmalloc_uaf_memset+0xb8/0x310
[   17.009271]  kunit_try_run_case+0x170/0x3f0
[   17.009310]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.009354]  kthread+0x328/0x630
[   17.009385]  ret_from_fork+0x10/0x20
[   17.009422] 
[   17.009446] Freed by task 195:
[   17.009480]  kasan_save_stack+0x3c/0x68
[   17.009523]  kasan_save_track+0x20/0x40
[   17.009576]  kasan_save_free_info+0x4c/0x78
[   17.009615]  __kasan_slab_free+0x6c/0x98
[   17.009652]  kfree+0x214/0x3c8
[   17.009685]  kmalloc_uaf_memset+0x11c/0x310
[   17.009723]  kunit_try_run_case+0x170/0x3f0
[   17.009761]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.009811]  kthread+0x328/0x630
[   17.009845]  ret_from_fork+0x10/0x20
[   17.009881] 
[   17.009902] The buggy address belongs to the object at fff00000c505c600
[   17.009902]  which belongs to the cache kmalloc-64 of size 64
[   17.009971] The buggy address is located 0 bytes inside of
[   17.009971]  freed 64-byte region [fff00000c505c600, fff00000c505c640)
[   17.010035] 
[   17.010506] The buggy address belongs to the physical page:
[   17.010553] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10505c
[   17.010616] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.011044] page_type: f5(slab)
[   17.011301] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   17.011445] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   17.011666] page dumped because: kasan: bad access detected
[   17.011874] 
[   17.012024] Memory state around the buggy address:
[   17.012182]  fff00000c505c500: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.012266]  fff00000c505c580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.012700] >fff00000c505c600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.012765]                    ^
[   17.012796]  fff00000c505c680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.013027]  fff00000c505c700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.013140] ==================================================================

[   18.374095] ==================================================================
[   18.375034] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   18.375667] Write of size 33 at addr ffff888102aa7780 by task kunit_try_catch/213
[   18.376602] 
[   18.376811] CPU: 1 UID: 0 PID: 213 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250617 #1 PREEMPT(voluntary) 
[   18.376995] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.377035] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   18.377093] Call Trace:
[   18.377129]  <TASK>
[   18.377212]  dump_stack_lvl+0x73/0xb0
[   18.377309]  print_report+0xd1/0x650
[   18.377433]  ? __virt_addr_valid+0x1db/0x2d0
[   18.377517]  ? kmalloc_uaf_memset+0x1a3/0x360
[   18.377800]  ? kasan_complete_mode_report_info+0x64/0x200
[   18.377900]  ? kmalloc_uaf_memset+0x1a3/0x360
[   18.377971]  kasan_report+0x141/0x180
[   18.378041]  ? kmalloc_uaf_memset+0x1a3/0x360
[   18.378118]  kasan_check_range+0x10c/0x1c0
[   18.378190]  __asan_memset+0x27/0x50
[   18.378252]  kmalloc_uaf_memset+0x1a3/0x360
[   18.378327]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   18.378405]  ? __schedule+0x10cc/0x2b60
[   18.378452]  ? __pfx_read_tsc+0x10/0x10
[   18.378485]  ? ktime_get_ts64+0x86/0x230
[   18.378522]  kunit_try_run_case+0x1a5/0x480
[   18.378557]  ? __pfx_kunit_try_run_case+0x10/0x10
[   18.378589]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   18.378620]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   18.378658]  ? __kthread_parkme+0x82/0x180
[   18.378686]  ? preempt_count_sub+0x50/0x80
[   18.378719]  ? __pfx_kunit_try_run_case+0x10/0x10
[   18.378753]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.378784]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   18.378816]  kthread+0x337/0x6f0
[   18.378870]  ? trace_preempt_on+0x20/0xc0
[   18.378907]  ? __pfx_kthread+0x10/0x10
[   18.378936]  ? _raw_spin_unlock_irq+0x47/0x80
[   18.378971]  ? calculate_sigpending+0x7b/0xa0
[   18.379006]  ? __pfx_kthread+0x10/0x10
[   18.379035]  ret_from_fork+0x116/0x1d0
[   18.379060]  ? __pfx_kthread+0x10/0x10
[   18.379089]  ret_from_fork_asm+0x1a/0x30
[   18.379131]  </TASK>
[   18.379148] 
[   18.396973] Allocated by task 213:
[   18.397385]  kasan_save_stack+0x45/0x70
[   18.397794]  kasan_save_track+0x18/0x40
[   18.398145]  kasan_save_alloc_info+0x3b/0x50
[   18.398695]  __kasan_kmalloc+0xb7/0xc0
[   18.399053]  __kmalloc_cache_noprof+0x189/0x420
[   18.399519]  kmalloc_uaf_memset+0xa9/0x360
[   18.399888]  kunit_try_run_case+0x1a5/0x480
[   18.400291]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.400684]  kthread+0x337/0x6f0
[   18.401514]  ret_from_fork+0x116/0x1d0
[   18.401899]  ret_from_fork_asm+0x1a/0x30
[   18.402440] 
[   18.402598] Freed by task 213:
[   18.402865]  kasan_save_stack+0x45/0x70
[   18.403384]  kasan_save_track+0x18/0x40
[   18.403782]  kasan_save_free_info+0x3f/0x60
[   18.404199]  __kasan_slab_free+0x56/0x70
[   18.404922]  kfree+0x222/0x3f0
[   18.405370]  kmalloc_uaf_memset+0x12b/0x360
[   18.405802]  kunit_try_run_case+0x1a5/0x480
[   18.406200]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.406790]  kthread+0x337/0x6f0
[   18.407091]  ret_from_fork+0x116/0x1d0
[   18.407625]  ret_from_fork_asm+0x1a/0x30
[   18.408035] 
[   18.408593] The buggy address belongs to the object at ffff888102aa7780
[   18.408593]  which belongs to the cache kmalloc-64 of size 64
[   18.409572] The buggy address is located 0 bytes inside of
[   18.409572]  freed 64-byte region [ffff888102aa7780, ffff888102aa77c0)
[   18.410963] 
[   18.411161] The buggy address belongs to the physical page:
[   18.411661] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102aa7
[   18.412218] flags: 0x200000000000000(node=0|zone=2)
[   18.412663] page_type: f5(slab)
[   18.413527] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   18.414067] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   18.414828] page dumped because: kasan: bad access detected
[   18.415453] 
[   18.415658] Memory state around the buggy address:
[   18.416109]  ffff888102aa7680: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
[   18.417024]  ffff888102aa7700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.417800] >ffff888102aa7780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.418467]                    ^
[   18.418786]  ffff888102aa7800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.419561]  ffff888102aa7880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.420190] ==================================================================