Hay
Date
Dec. 3, 2024, 11:38 p.m.

Environment
qemu-arm64
qemu-x86_64

[   30.848512] ==================================================================
[   30.849869] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   30.850914] Write of size 33 at addr fff00000c590c280 by task kunit_try_catch/175
[   30.853300] 
[   30.853626] CPU: 1 UID: 0 PID: 175 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   30.855656] Tainted: [B]=BAD_PAGE, [N]=TEST
[   30.856672] Hardware name: linux,dummy-virt (DT)
[   30.857432] Call trace:
[   30.857856]  show_stack+0x20/0x38 (C)
[   30.858555]  dump_stack_lvl+0x8c/0xd0
[   30.859164]  print_report+0x118/0x5e0
[   30.859827]  kasan_report+0xc8/0x118
[   30.860499]  kasan_check_range+0x100/0x1a8
[   30.861183]  __asan_memset+0x34/0x78
[   30.862159]  kmalloc_uaf_memset+0x170/0x310
[   30.862713]  kunit_try_run_case+0x14c/0x3d0
[   30.863778]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   30.865210]  kthread+0x24c/0x2d0
[   30.865899]  ret_from_fork+0x10/0x20
[   30.866466] 
[   30.866785] Allocated by task 175:
[   30.868211]  kasan_save_stack+0x3c/0x68
[   30.869133]  kasan_save_track+0x20/0x40
[   30.869943]  kasan_save_alloc_info+0x40/0x58
[   30.870650]  __kasan_kmalloc+0xd4/0xd8
[   30.871578]  __kmalloc_cache_noprof+0x15c/0x3c0
[   30.872650]  kmalloc_uaf_memset+0xb8/0x310
[   30.873271]  kunit_try_run_case+0x14c/0x3d0
[   30.874226]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   30.875212]  kthread+0x24c/0x2d0
[   30.875714]  ret_from_fork+0x10/0x20
[   30.877000] 
[   30.877562] Freed by task 175:
[   30.878044]  kasan_save_stack+0x3c/0x68
[   30.878615]  kasan_save_track+0x20/0x40
[   30.879863]  kasan_save_free_info+0x4c/0x78
[   30.880413]  __kasan_slab_free+0x6c/0x98
[   30.881244]  kfree+0x114/0x3c8
[   30.881911]  kmalloc_uaf_memset+0x11c/0x310
[   30.882690]  kunit_try_run_case+0x14c/0x3d0
[   30.883558]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   30.884555]  kthread+0x24c/0x2d0
[   30.885233]  ret_from_fork+0x10/0x20
[   30.885673] 
[   30.885925] The buggy address belongs to the object at fff00000c590c280
[   30.885925]  which belongs to the cache kmalloc-64 of size 64
[   30.886836] The buggy address is located 0 bytes inside of
[   30.886836]  freed 64-byte region [fff00000c590c280, fff00000c590c2c0)
[   30.889298] 
[   30.889713] The buggy address belongs to the physical page:
[   30.890404] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10590c
[   30.891812] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   30.893198] page_type: f5(slab)
[   30.894257] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   30.894930] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   30.896771] page dumped because: kasan: bad access detected
[   30.897552] 
[   30.897921] Memory state around the buggy address:
[   30.898727]  fff00000c590c180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   30.899744]  fff00000c590c200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   30.901381] >fff00000c590c280: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   30.902865]                    ^
[   30.903553]  fff00000c590c300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.904297]  fff00000c590c380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.905138] ==================================================================

[   26.413418] ==================================================================
[   26.414464] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a4/0x360
[   26.414992] Write of size 33 at addr ffff888102a12480 by task kunit_try_catch/195
[   26.415946] 
[   26.416218] CPU: 1 UID: 0 PID: 195 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   26.417293] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.418035] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.419133] Call Trace:
[   26.419322]  <TASK>
[   26.419486]  dump_stack_lvl+0x73/0xb0
[   26.419778]  print_report+0xd1/0x640
[   26.420720]  ? __virt_addr_valid+0x1db/0x2d0
[   26.421024]  ? kasan_complete_mode_report_info+0x64/0x200
[   26.421690]  kasan_report+0x102/0x140
[   26.422391]  ? kmalloc_uaf_memset+0x1a4/0x360
[   26.422667]  ? kmalloc_uaf_memset+0x1a4/0x360
[   26.423121]  kasan_check_range+0x10c/0x1c0
[   26.423426]  __asan_memset+0x27/0x50
[   26.423811]  kmalloc_uaf_memset+0x1a4/0x360
[   26.424173]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   26.424756]  ? __schedule+0xc3e/0x2790
[   26.425115]  ? __pfx_read_tsc+0x10/0x10
[   26.425381]  ? ktime_get_ts64+0x86/0x230
[   26.425899]  kunit_try_run_case+0x1b3/0x490
[   26.426337]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.426916]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   26.427372]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   26.427793]  ? __kthread_parkme+0x82/0x160
[   26.428286]  ? preempt_count_sub+0x50/0x80
[   26.428686]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.429124]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   26.429505]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.430018]  kthread+0x257/0x310
[   26.430367]  ? __pfx_kthread+0x10/0x10
[   26.430773]  ret_from_fork+0x41/0x80
[   26.431032]  ? __pfx_kthread+0x10/0x10
[   26.431932]  ret_from_fork_asm+0x1a/0x30
[   26.432860]  </TASK>
[   26.433142] 
[   26.433346] Allocated by task 195:
[   26.434251]  kasan_save_stack+0x3d/0x60
[   26.434815]  kasan_save_track+0x18/0x40
[   26.435211]  kasan_save_alloc_info+0x3b/0x50
[   26.435526]  __kasan_kmalloc+0xb7/0xc0
[   26.435941]  __kmalloc_cache_noprof+0x184/0x410
[   26.436382]  kmalloc_uaf_memset+0xaa/0x360
[   26.436966]  kunit_try_run_case+0x1b3/0x490
[   26.437391]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.438034]  kthread+0x257/0x310
[   26.438341]  ret_from_fork+0x41/0x80
[   26.439358]  ret_from_fork_asm+0x1a/0x30
[   26.439708] 
[   26.439884] Freed by task 195:
[   26.440288]  kasan_save_stack+0x3d/0x60
[   26.440882]  kasan_save_track+0x18/0x40
[   26.441248]  kasan_save_free_info+0x3f/0x60
[   26.441568]  __kasan_slab_free+0x56/0x70
[   26.442102]  kfree+0x123/0x3f0
[   26.442473]  kmalloc_uaf_memset+0x12c/0x360
[   26.443017]  kunit_try_run_case+0x1b3/0x490
[   26.443478]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.444710]  kthread+0x257/0x310
[   26.444963]  ret_from_fork+0x41/0x80
[   26.445260]  ret_from_fork_asm+0x1a/0x30
[   26.445649] 
[   26.445843] The buggy address belongs to the object at ffff888102a12480
[   26.445843]  which belongs to the cache kmalloc-64 of size 64
[   26.447030] The buggy address is located 0 bytes inside of
[   26.447030]  freed 64-byte region [ffff888102a12480, ffff888102a124c0)
[   26.447946] 
[   26.448117] The buggy address belongs to the physical page:
[   26.448735] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a12
[   26.449389] flags: 0x200000000000000(node=0|zone=2)
[   26.450468] page_type: f5(slab)
[   26.450705] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   26.451472] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   26.452266] page dumped because: kasan: bad access detected
[   26.452850] 
[   26.453069] Memory state around the buggy address:
[   26.453343]  ffff888102a12380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   26.453994]  ffff888102a12400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   26.455313] >ffff888102a12480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   26.455915]                    ^
[   26.456194]  ffff888102a12500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.456766]  ffff888102a12580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.457349] ==================================================================