Hay
Date
June 24, 2025, 12:47 p.m.

Environment
qemu-arm64
qemu-x86_64

[   24.106991] ==================================================================
[   24.107109] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   24.107235] Write of size 33 at addr fff00000c5a25000 by task kunit_try_catch/188
[   24.107358] 
[   24.107536] CPU: 0 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.15.4-rc2 #1 PREEMPT 
[   24.108033] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.108151] Hardware name: linux,dummy-virt (DT)
[   24.108243] Call trace:
[   24.108433]  show_stack+0x20/0x38 (C)
[   24.108752]  dump_stack_lvl+0x8c/0xd0
[   24.108892]  print_report+0x118/0x608
[   24.109230]  kasan_report+0xdc/0x128
[   24.109526]  kasan_check_range+0x100/0x1a8
[   24.109728]  __asan_memset+0x34/0x78
[   24.109848]  kmalloc_uaf_memset+0x170/0x310
[   24.110199]  kunit_try_run_case+0x170/0x3f0
[   24.110395]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.110554]  kthread+0x328/0x630
[   24.110691]  ret_from_fork+0x10/0x20
[   24.110917] 
[   24.111056] Allocated by task 188:
[   24.111208]  kasan_save_stack+0x3c/0x68
[   24.111325]  kasan_save_track+0x20/0x40
[   24.111440]  kasan_save_alloc_info+0x40/0x58
[   24.111570]  __kasan_kmalloc+0xd4/0xd8
[   24.111807]  __kmalloc_cache_noprof+0x16c/0x3c0
[   24.112077]  kmalloc_uaf_memset+0xb8/0x310
[   24.112186]  kunit_try_run_case+0x170/0x3f0
[   24.112284]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.112410]  kthread+0x328/0x630
[   24.112532]  ret_from_fork+0x10/0x20
[   24.112767] 
[   24.112826] Freed by task 188:
[   24.112902]  kasan_save_stack+0x3c/0x68
[   24.113255]  kasan_save_track+0x20/0x40
[   24.113459]  kasan_save_free_info+0x4c/0x78
[   24.113727]  __kasan_slab_free+0x6c/0x98
[   24.113891]  kfree+0x214/0x3c8
[   24.113980]  kmalloc_uaf_memset+0x11c/0x310
[   24.114072]  kunit_try_run_case+0x170/0x3f0
[   24.114169]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.114291]  kthread+0x328/0x630
[   24.114404]  ret_from_fork+0x10/0x20
[   24.114495] 
[   24.114569] The buggy address belongs to the object at fff00000c5a25000
[   24.114569]  which belongs to the cache kmalloc-64 of size 64
[   24.114707] The buggy address is located 0 bytes inside of
[   24.114707]  freed 64-byte region [fff00000c5a25000, fff00000c5a25040)
[   24.114902] 
[   24.115018] The buggy address belongs to the physical page:
[   24.115132] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105a25
[   24.115420] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   24.115554] page_type: f5(slab)
[   24.115864] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   24.116012] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   24.116144] page dumped because: kasan: bad access detected
[   24.116270] 
[   24.116321] Memory state around the buggy address:
[   24.116423]  fff00000c5a24f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.116560]  fff00000c5a24f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.116677] >fff00000c5a25000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.116783]                    ^
[   24.117112]  fff00000c5a25080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.117267]  fff00000c5a25100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.117556] ==================================================================

[   12.039903] ==================================================================
[   12.040422] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   12.041313] Write of size 33 at addr ffff8881039dbd00 by task kunit_try_catch/206
[   12.042322] 
[   12.042480] CPU: 0 UID: 0 PID: 206 Comm: kunit_try_catch Tainted: G    B            N  6.15.4-rc2 #1 PREEMPT(voluntary) 
[   12.042549] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.042568] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.042607] Call Trace:
[   12.042648]  <TASK>
[   12.042687]  dump_stack_lvl+0x73/0xb0
[   12.042743]  print_report+0xd1/0x650
[   12.042776]  ? __virt_addr_valid+0x1db/0x2d0
[   12.042809]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.042839]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.042896]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.042931]  kasan_report+0x141/0x180
[   12.042962]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.043006]  kasan_check_range+0x10c/0x1c0
[   12.043042]  __asan_memset+0x27/0x50
[   12.043078]  kmalloc_uaf_memset+0x1a3/0x360
[   12.043120]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.043165]  ? __schedule+0x10cc/0x2b60
[   12.043198]  ? __pfx_read_tsc+0x10/0x10
[   12.043219]  ? ktime_get_ts64+0x86/0x230
[   12.043246]  kunit_try_run_case+0x1a5/0x480
[   12.043273]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.043324]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.043373]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.043407]  ? __kthread_parkme+0x82/0x180
[   12.043431]  ? preempt_count_sub+0x50/0x80
[   12.043457]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.043480]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.043502]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.043524]  kthread+0x337/0x6f0
[   12.043558]  ? trace_preempt_on+0x20/0xc0
[   12.043586]  ? __pfx_kthread+0x10/0x10
[   12.043603]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.043639]  ? calculate_sigpending+0x7b/0xa0
[   12.043666]  ? __pfx_kthread+0x10/0x10
[   12.043683]  ret_from_fork+0x41/0x80
[   12.043704]  ? __pfx_kthread+0x10/0x10
[   12.043720]  ret_from_fork_asm+0x1a/0x30
[   12.043751]  </TASK>
[   12.043765] 
[   12.054091] Allocated by task 206:
[   12.054616]  kasan_save_stack+0x45/0x70
[   12.054916]  kasan_save_track+0x18/0x40
[   12.055130]  kasan_save_alloc_info+0x3b/0x50
[   12.055608]  __kasan_kmalloc+0xb7/0xc0
[   12.055930]  __kmalloc_cache_noprof+0x189/0x420
[   12.056258]  kmalloc_uaf_memset+0xa9/0x360
[   12.056853]  kunit_try_run_case+0x1a5/0x480
[   12.057117]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.057635]  kthread+0x337/0x6f0
[   12.057818]  ret_from_fork+0x41/0x80
[   12.058105]  ret_from_fork_asm+0x1a/0x30
[   12.058567] 
[   12.058740] Freed by task 206:
[   12.058988]  kasan_save_stack+0x45/0x70
[   12.059244]  kasan_save_track+0x18/0x40
[   12.059663]  kasan_save_free_info+0x3f/0x60
[   12.059923]  __kasan_slab_free+0x56/0x70
[   12.060156]  kfree+0x222/0x3f0
[   12.060447]  kmalloc_uaf_memset+0x12b/0x360
[   12.060729]  kunit_try_run_case+0x1a5/0x480
[   12.061044]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.061306]  kthread+0x337/0x6f0
[   12.061457]  ret_from_fork+0x41/0x80
[   12.061757]  ret_from_fork_asm+0x1a/0x30
[   12.062084] 
[   12.062248] The buggy address belongs to the object at ffff8881039dbd00
[   12.062248]  which belongs to the cache kmalloc-64 of size 64
[   12.063041] The buggy address is located 0 bytes inside of
[   12.063041]  freed 64-byte region [ffff8881039dbd00, ffff8881039dbd40)
[   12.063808] 
[   12.063973] The buggy address belongs to the physical page:
[   12.064262] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1039db
[   12.064953] flags: 0x200000000000000(node=0|zone=2)
[   12.065501] page_type: f5(slab)
[   12.065826] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.066154] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.066654] page dumped because: kasan: bad access detected
[   12.067095] 
[   12.067262] Memory state around the buggy address:
[   12.067757]  ffff8881039dbc00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.068211]  ffff8881039dbc80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.068816] >ffff8881039dbd00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.069109]                    ^
[   12.069390]  ffff8881039dbd80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.069850]  ffff8881039dbe00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.070099] ==================================================================