Hay
Date
Nov. 28, 2024, 2:36 a.m.

Environment
qemu-arm64
qemu-x86_64

[   30.939734] ==================================================================
[   30.940767] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   30.941566] Write of size 33 at addr fff00000c63ae900 by task kunit_try_catch/174
[   30.942422] 
[   30.942828] CPU: 1 UID: 0 PID: 174 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   30.944429] Tainted: [B]=BAD_PAGE, [N]=TEST
[   30.945088] Hardware name: linux,dummy-virt (DT)
[   30.945710] Call trace:
[   30.946264]  show_stack+0x20/0x38 (C)
[   30.946936]  dump_stack_lvl+0x8c/0xd0
[   30.947610]  print_report+0x118/0x5e0
[   30.948218]  kasan_report+0xc8/0x118
[   30.948758]  kasan_check_range+0x100/0x1a8
[   30.949694]  __asan_memset+0x34/0x78
[   30.950273]  kmalloc_uaf_memset+0x170/0x310
[   30.950920]  kunit_try_run_case+0x14c/0x3d0
[   30.951486]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   30.952161]  kthread+0x24c/0x2d0
[   30.952754]  ret_from_fork+0x10/0x20
[   30.953810] 
[   30.954270] Allocated by task 174:
[   30.954837]  kasan_save_stack+0x3c/0x68
[   30.955476]  kasan_save_track+0x20/0x40
[   30.956085]  kasan_save_alloc_info+0x40/0x58
[   30.956757]  __kasan_kmalloc+0xd4/0xd8
[   30.957376]  __kmalloc_cache_noprof+0x15c/0x3c0
[   30.958372]  kmalloc_uaf_memset+0xb8/0x310
[   30.959129]  kunit_try_run_case+0x14c/0x3d0
[   30.959676]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   30.960355]  kthread+0x24c/0x2d0
[   30.960896]  ret_from_fork+0x10/0x20
[   30.961956] 
[   30.962485] Freed by task 174:
[   30.963089]  kasan_save_stack+0x3c/0x68
[   30.963614]  kasan_save_track+0x20/0x40
[   30.964536]  kasan_save_free_info+0x4c/0x78
[   30.965052]  __kasan_slab_free+0x6c/0x98
[   30.965826]  kfree+0x114/0x3c8
[   30.966536]  kmalloc_uaf_memset+0x11c/0x310
[   30.967063]  kunit_try_run_case+0x14c/0x3d0
[   30.967881]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   30.968723]  kthread+0x24c/0x2d0
[   30.969715]  ret_from_fork+0x10/0x20
[   30.970423] 
[   30.970767] The buggy address belongs to the object at fff00000c63ae900
[   30.970767]  which belongs to the cache kmalloc-64 of size 64
[   30.972237] The buggy address is located 0 bytes inside of
[   30.972237]  freed 64-byte region [fff00000c63ae900, fff00000c63ae940)
[   30.973946] 
[   30.974311] The buggy address belongs to the physical page:
[   30.974903] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1063ae
[   30.975759] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   30.976816] page_type: f5(slab)
[   30.977647] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   30.978493] raw: 0000000000000000 0000000080200020 00000001f5000000 0000000000000000
[   30.979234] page dumped because: kasan: bad access detected
[   30.979905] 
[   30.980251] Memory state around the buggy address:
[   30.980886]  fff00000c63ae800: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   30.981705]  fff00000c63ae880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   30.982654] >fff00000c63ae900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   30.983643]                    ^
[   30.983879]  fff00000c63ae980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.984677]  fff00000c63aea00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.985811] ==================================================================

[   21.864172] ==================================================================
[   21.865328] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a4/0x360
[   21.866030] Write of size 33 at addr ffff888102a18d80 by task kunit_try_catch/194
[   21.866905] 
[   21.867303] CPU: 0 UID: 0 PID: 194 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   21.868687] Tainted: [B]=BAD_PAGE, [N]=TEST
[   21.869158] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   21.870138] Call Trace:
[   21.870493]  <TASK>
[   21.870869]  dump_stack_lvl+0x73/0xb0
[   21.871444]  print_report+0xd1/0x640
[   21.872031]  ? __virt_addr_valid+0x1db/0x2d0
[   21.872628]  ? kasan_complete_mode_report_info+0x64/0x200
[   21.873116]  kasan_report+0x102/0x140
[   21.873753]  ? kmalloc_uaf_memset+0x1a4/0x360
[   21.874089]  ? kmalloc_uaf_memset+0x1a4/0x360
[   21.874922]  kasan_check_range+0x10c/0x1c0
[   21.875297]  __asan_memset+0x27/0x50
[   21.876013]  kmalloc_uaf_memset+0x1a4/0x360
[   21.876756]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   21.877205]  ? __schedule+0xc3e/0x2790
[   21.877811]  ? __pfx_read_tsc+0x10/0x10
[   21.878500]  ? ktime_get_ts64+0x84/0x230
[   21.878833]  kunit_try_run_case+0x1b3/0x490
[   21.879410]  ? __pfx_kunit_try_run_case+0x10/0x10
[   21.879846]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   21.880398]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   21.880979]  ? __kthread_parkme+0x82/0x160
[   21.881484]  ? preempt_count_sub+0x50/0x80
[   21.881946]  ? __pfx_kunit_try_run_case+0x10/0x10
[   21.882424]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   21.883014]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   21.883662]  kthread+0x257/0x310
[   21.884051]  ? __pfx_kthread+0x10/0x10
[   21.884527]  ret_from_fork+0x41/0x80
[   21.884889]  ? __pfx_kthread+0x10/0x10
[   21.885234]  ret_from_fork_asm+0x1a/0x30
[   21.885661]  </TASK>
[   21.885972] 
[   21.886158] Allocated by task 194:
[   21.886589]  kasan_save_stack+0x3d/0x60
[   21.886883]  kasan_save_track+0x18/0x40
[   21.887213]  kasan_save_alloc_info+0x3b/0x50
[   21.887729]  __kasan_kmalloc+0xb7/0xc0
[   21.888269]  __kmalloc_cache_noprof+0x184/0x410
[   21.888863]  kmalloc_uaf_memset+0xaa/0x360
[   21.889290]  kunit_try_run_case+0x1b3/0x490
[   21.889698]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   21.890283]  kthread+0x257/0x310
[   21.890566]  ret_from_fork+0x41/0x80
[   21.890832]  ret_from_fork_asm+0x1a/0x30
[   21.891433] 
[   21.891727] Freed by task 194:
[   21.892217]  kasan_save_stack+0x3d/0x60
[   21.892561]  kasan_save_track+0x18/0x40
[   21.893120]  kasan_save_free_info+0x3f/0x60
[   21.893447]  __kasan_slab_free+0x56/0x70
[   21.894008]  kfree+0x123/0x3f0
[   21.894488]  kmalloc_uaf_memset+0x12c/0x360
[   21.894981]  kunit_try_run_case+0x1b3/0x490
[   21.895563]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   21.895968]  kthread+0x257/0x310
[   21.896556]  ret_from_fork+0x41/0x80
[   21.896971]  ret_from_fork_asm+0x1a/0x30
[   21.897724] 
[   21.897883] The buggy address belongs to the object at ffff888102a18d80
[   21.897883]  which belongs to the cache kmalloc-64 of size 64
[   21.899430] The buggy address is located 0 bytes inside of
[   21.899430]  freed 64-byte region [ffff888102a18d80, ffff888102a18dc0)
[   21.900557] 
[   21.901122] The buggy address belongs to the physical page:
[   21.901947] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a18
[   21.902958] flags: 0x200000000000000(node=0|zone=2)
[   21.903511] page_type: f5(slab)
[   21.903742] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   21.904469] raw: 0000000000000000 0000000080200020 00000001f5000000 0000000000000000
[   21.905183] page dumped because: kasan: bad access detected
[   21.905759] 
[   21.906013] Memory state around the buggy address:
[   21.906439]  ffff888102a18c80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.907051]  ffff888102a18d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.907831] >ffff888102a18d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.908540]                    ^
[   21.908960]  ffff888102a18e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.909683]  ffff888102a18e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.910478] ==================================================================