Hay
Date
May 12, 2025, 6:12 p.m.

Environment
qemu-arm64
qemu-x86_64

[   18.960378] ==================================================================
[   18.960973] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   18.961783] Write of size 33 at addr fff00000c5a02d00 by task kunit_try_catch/175
[   18.962522] 
[   18.962963] CPU: 1 UID: 0 PID: 175 Comm: kunit_try_catch Tainted: G    B            N 6.14.7-rc1 #1
[   18.963215] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.963289] Hardware name: linux,dummy-virt (DT)
[   18.963390] Call trace:
[   18.963459]  show_stack+0x20/0x38 (C)
[   18.963576]  dump_stack_lvl+0x8c/0xd0
[   18.963686]  print_report+0x118/0x608
[   18.963802]  kasan_report+0xdc/0x128
[   18.963902]  kasan_check_range+0x100/0x1a8
[   18.964018]  __asan_memset+0x34/0x78
[   18.964123]  kmalloc_uaf_memset+0x170/0x310
[   18.964225]  kunit_try_run_case+0x170/0x3f0
[   18.964344]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.964501]  kthread+0x318/0x620
[   18.964624]  ret_from_fork+0x10/0x20
[   18.964728] 
[   18.969834] Allocated by task 175:
[   18.970384]  kasan_save_stack+0x3c/0x68
[   18.971012]  kasan_save_track+0x20/0x40
[   18.971455]  kasan_save_alloc_info+0x40/0x58
[   18.971965]  __kasan_kmalloc+0xd4/0xd8
[   18.972525]  __kmalloc_cache_noprof+0x15c/0x3c0
[   18.972773]  kmalloc_uaf_memset+0xb8/0x310
[   18.973326]  kunit_try_run_case+0x170/0x3f0
[   18.973877]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.974193]  kthread+0x318/0x620
[   18.974530]  ret_from_fork+0x10/0x20
[   18.974977] 
[   18.975307] Freed by task 175:
[   18.975763]  kasan_save_stack+0x3c/0x68
[   18.976227]  kasan_save_track+0x20/0x40
[   18.976682]  kasan_save_free_info+0x4c/0x78
[   18.977224]  __kasan_slab_free+0x6c/0x98
[   18.977680]  kfree+0x214/0x3c8
[   18.978027]  kmalloc_uaf_memset+0x11c/0x310
[   18.978649]  kunit_try_run_case+0x170/0x3f0
[   18.979132]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.979465]  kthread+0x318/0x620
[   18.979711]  ret_from_fork+0x10/0x20
[   18.980092] 
[   18.980346] The buggy address belongs to the object at fff00000c5a02d00
[   18.980346]  which belongs to the cache kmalloc-64 of size 64
[   18.981414] The buggy address is located 0 bytes inside of
[   18.981414]  freed 64-byte region [fff00000c5a02d00, fff00000c5a02d40)
[   18.982617] 
[   18.982927] The buggy address belongs to the physical page:
[   18.983325] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105a02
[   18.984098] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.984881] page_type: f5(slab)
[   18.985366] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   18.986022] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   18.986703] page dumped because: kasan: bad access detected
[   18.987326] 
[   18.987599] Memory state around the buggy address:
[   18.988130]  fff00000c5a02c00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.988606]  fff00000c5a02c80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.989335] >fff00000c5a02d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.989900]                    ^
[   18.990353]  fff00000c5a02d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.991110]  fff00000c5a02e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.991890] ==================================================================

[   12.724673] ==================================================================
[   12.725344] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a4/0x360
[   12.725631] Write of size 33 at addr ffff888101b2b400 by task kunit_try_catch/194
[   12.725989] 
[   12.726344] CPU: 1 UID: 0 PID: 194 Comm: kunit_try_catch Tainted: G    B            N 6.14.7-rc1 #1
[   12.726395] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.726407] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.726428] Call Trace:
[   12.726441]  <TASK>
[   12.726460]  dump_stack_lvl+0x73/0xb0
[   12.726489]  print_report+0xd1/0x650
[   12.726512]  ? __virt_addr_valid+0x1db/0x2d0
[   12.726534]  ? kmalloc_uaf_memset+0x1a4/0x360
[   12.726555]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.726580]  ? kmalloc_uaf_memset+0x1a4/0x360
[   12.726600]  kasan_report+0x140/0x180
[   12.726621]  ? kmalloc_uaf_memset+0x1a4/0x360
[   12.726645]  kasan_check_range+0x10c/0x1c0
[   12.726668]  __asan_memset+0x27/0x50
[   12.726690]  kmalloc_uaf_memset+0x1a4/0x360
[   12.726710]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.726731]  ? __schedule+0xce8/0x2840
[   12.726756]  ? __pfx_read_tsc+0x10/0x10
[   12.726778]  ? ktime_get_ts64+0x86/0x230
[   12.726805]  kunit_try_run_case+0x1a6/0x480
[   12.726829]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.726862]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   12.726883]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.726907]  ? __kthread_parkme+0x82/0x160
[   12.726930]  ? preempt_count_sub+0x50/0x80
[   12.726955]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.726977]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.727002]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.727027]  kthread+0x324/0x6e0
[   12.727048]  ? trace_preempt_on+0x20/0xc0
[   12.727071]  ? __pfx_kthread+0x10/0x10
[   12.727092]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.727115]  ? calculate_sigpending+0x7b/0xa0
[   12.727137]  ? __pfx_kthread+0x10/0x10
[   12.727159]  ret_from_fork+0x41/0x80
[   12.727194]  ? __pfx_kthread+0x10/0x10
[   12.727215]  ret_from_fork_asm+0x1a/0x30
[   12.727246]  </TASK>
[   12.727257] 
[   12.734118] Allocated by task 194:
[   12.734669]  kasan_save_stack+0x45/0x70
[   12.734910]  kasan_save_track+0x18/0x40
[   12.735319]  kasan_save_alloc_info+0x3b/0x50
[   12.735544]  __kasan_kmalloc+0xb7/0xc0
[   12.735734]  __kmalloc_cache_noprof+0x18a/0x420
[   12.735981]  kmalloc_uaf_memset+0xaa/0x360
[   12.736246]  kunit_try_run_case+0x1a6/0x480
[   12.736431]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.736608]  kthread+0x324/0x6e0
[   12.736777]  ret_from_fork+0x41/0x80
[   12.736966]  ret_from_fork_asm+0x1a/0x30
[   12.737224] 
[   12.737324] Freed by task 194:
[   12.737452]  kasan_save_stack+0x45/0x70
[   12.737644]  kasan_save_track+0x18/0x40
[   12.737806]  kasan_save_free_info+0x3f/0x60
[   12.737963]  __kasan_slab_free+0x56/0x70
[   12.738100]  kfree+0x224/0x3f0
[   12.738216]  kmalloc_uaf_memset+0x12c/0x360
[   12.738361]  kunit_try_run_case+0x1a6/0x480
[   12.738553]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.738935]  kthread+0x324/0x6e0
[   12.739109]  ret_from_fork+0x41/0x80
[   12.739294]  ret_from_fork_asm+0x1a/0x30
[   12.739780] 
[   12.739904] The buggy address belongs to the object at ffff888101b2b400
[   12.739904]  which belongs to the cache kmalloc-64 of size 64
[   12.740456] The buggy address is located 0 bytes inside of
[   12.740456]  freed 64-byte region [ffff888101b2b400, ffff888101b2b440)
[   12.740801] 
[   12.740888] The buggy address belongs to the physical page:
[   12.741092] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101b2b
[   12.741445] flags: 0x200000000000000(node=0|zone=2)
[   12.741679] page_type: f5(slab)
[   12.741926] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.742453] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.742739] page dumped because: kasan: bad access detected
[   12.742916] 
[   12.742993] Memory state around the buggy address:
[   12.743251]  ffff888101b2b300: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.744052]  ffff888101b2b380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.744330] >ffff888101b2b400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.744546]                    ^
[   12.744745]  ffff888101b2b480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.745225]  ffff888101b2b500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.745567] ==================================================================