Hay
Date
Feb. 5, 2025, 2:09 p.m.

Environment
qemu-armv7
qemu-x86_64

[  145.711016] ==================================================================
[  145.712305] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x104/0x274
[  145.712998] Read of size 1 at addr c4fcfd28 by task kunit_try_catch/161
[  145.713844] 
[  145.714212] CPU: 0 PID: 161 Comm: kunit_try_catch Tainted: G    B            N 6.6.76-rc1 #1
[  145.715045] Hardware name: Generic DT based system
[  145.716231]  unwind_backtrace from show_stack+0x18/0x1c
[  145.716947]  show_stack from dump_stack_lvl+0x58/0x70
[  145.717619]  dump_stack_lvl from print_report+0x164/0x51c
[  145.718266]  print_report from kasan_report+0xc8/0x104
[  145.719034]  kasan_report from kmalloc_uaf2+0x104/0x274
[  145.719733]  kmalloc_uaf2 from kunit_try_run_case+0x11c/0x2e4
[  145.720444]  kunit_try_run_case from kunit_generic_run_threadfn_adapter+0x2c/0x48
[  145.721547]  kunit_generic_run_threadfn_adapter from kthread+0x184/0x1a8
[  145.722494]  kthread from ret_from_fork+0x14/0x30
[  145.723095] Exception stack(0xf9ffbfb0 to 0xf9ffbff8)
[  145.723682] bfa0:                                     00000000 00000000 00000000 00000000
[  145.724553] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  145.725474] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[  145.727034] 
[  145.727338] Allocated by task 161:
[  145.727914]  kasan_set_track+0x3c/0x5c
[  145.728532]  __kasan_kmalloc+0x8c/0x94
[  145.729157]  kmalloc_uaf2+0xac/0x274
[  145.729787]  kunit_try_run_case+0x11c/0x2e4
[  145.730431]  kunit_generic_run_threadfn_adapter+0x2c/0x48
[  145.731270]  kthread+0x184/0x1a8
[  145.731780]  ret_from_fork+0x14/0x30
[  145.732337] 
[  145.732666] Freed by task 161:
[  145.733076]  kasan_set_track+0x3c/0x5c
[  145.733757]  kasan_save_free_info+0x30/0x3c
[  145.734447]  __kasan_slab_free+0xdc/0x124
[  145.735008]  __kmem_cache_free+0x140/0x2a8
[  145.735537]  kmalloc_uaf2+0xc0/0x274
[  145.736710]  kunit_try_run_case+0x11c/0x2e4
[  145.737272]  kunit_generic_run_threadfn_adapter+0x2c/0x48
[  145.737975]  kthread+0x184/0x1a8
[  145.738473]  ret_from_fork+0x14/0x30
[  145.738947] 
[  145.739254] The buggy address belongs to the object at c4fcfd00
[  145.739254]  which belongs to the cache kmalloc-64 of size 64
[  145.740514] The buggy address is located 40 bytes inside of
[  145.740514]  freed 64-byte region [c4fcfd00, c4fcfd40)
[  145.741669] 
[  145.741986] The buggy address belongs to the physical page:
[  145.742665] page:8516b471 refcount:1 mapcount:0 mapping:00000000 index:0x0 pfn:0x44fcf
[  145.744069] flags: 0x800(slab|zone=0)
[  145.744532] page_type: 0xffffffff()
[  145.745024] raw: 00000800 c4801200 00000122 00000000 00000000 80200020 ffffffff 00000001
[  145.746952] raw: 00000000
[  145.747394] page dumped because: kasan: bad access detected
[  145.748081] 
[  145.748286] Memory state around the buggy address:
[  145.749194]  c4fcfc00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[  145.750175]  c4fcfc80: 00 00 07 fc fc fc fc fc fc fc fc fc fc fc fc fc
[  145.750837] >c4fcfd00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[  145.751615]                           ^
[  145.752094]  c4fcfd80: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[  145.752878]  c4fcfe00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  145.753574] ==================================================================


[   48.605448] ==================================================================
[   48.606502] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x122/0x2b0
[   48.607879] Read of size 1 at addr ffff888102849128 by task kunit_try_catch/184
[   48.608559] 
[   48.608866] CPU: 0 PID: 184 Comm: kunit_try_catch Tainted: G    B            N 6.6.76-rc1 #1
[   48.609542] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   48.610505] Call Trace:
[   48.610876]  <TASK>
[   48.611208]  dump_stack_lvl+0x4e/0x90
[   48.611787]  print_report+0xd2/0x660
[   48.612340]  ? __virt_addr_valid+0x156/0x1e0
[   48.612994]  ? kasan_complete_mode_report_info+0x64/0x200
[   48.613774]  kasan_report+0xff/0x140
[   48.614268]  ? kmalloc_uaf2+0x122/0x2b0
[   48.614775]  ? kmalloc_uaf2+0x122/0x2b0
[   48.615363]  __asan_load1+0x66/0x70
[   48.615926]  kmalloc_uaf2+0x122/0x2b0
[   48.616361]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   48.616992]  ? sysvec_apic_timer_interrupt+0x94/0xa0
[   48.617541]  ? asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   48.618234]  ? ret_from_fork_asm+0x1b/0x30
[   48.618729]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   48.619274]  ? kunit_try_run_case+0x11b/0x290
[   48.619960]  kunit_try_run_case+0x126/0x290
[   48.620556]  ? __pfx_kunit_try_run_case+0x10/0x10
[   48.621119]  ? __kasan_check_write+0x18/0x20
[   48.621778]  ? trace_preempt_on+0x20/0xa0
[   48.622346]  ? __kthread_parkme+0x4f/0xd0
[   48.622956]  ? preempt_count_sub+0x50/0x80
[   48.623484]  ? __pfx_kunit_try_run_case+0x10/0x10
[   48.624074]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   48.624807]  kunit_generic_run_threadfn_adapter+0x33/0x50
[   48.625520]  kthread+0x19e/0x1e0
[   48.626088]  ? __pfx_kthread+0x10/0x10
[   48.626565]  ret_from_fork+0x41/0x70
[   48.627162]  ? __pfx_kthread+0x10/0x10
[   48.627778]  ret_from_fork_asm+0x1b/0x30
[   48.628258]  </TASK>
[   48.628607] 
[   48.628937] Allocated by task 184:
[   48.629377]  kasan_save_stack+0x3c/0x60
[   48.629880]  kasan_set_track+0x29/0x40
[   48.630395]  kasan_save_alloc_info+0x22/0x30
[   48.630956]  __kasan_kmalloc+0xb7/0xc0
[   48.631474]  kmalloc_trace+0x4c/0xb0
[   48.632065]  kmalloc_uaf2+0xb0/0x2b0
[   48.632546]  kunit_try_run_case+0x126/0x290
[   48.633103]  kunit_generic_run_threadfn_adapter+0x33/0x50
[   48.633869]  kthread+0x19e/0x1e0
[   48.634360]  ret_from_fork+0x41/0x70
[   48.634946]  ret_from_fork_asm+0x1b/0x30
[   48.635464] 
[   48.635777] Freed by task 184:
[   48.636186]  kasan_save_stack+0x3c/0x60
[   48.636764]  kasan_set_track+0x29/0x40
[   48.637227]  kasan_save_free_info+0x2f/0x50
[   48.637784]  ____kasan_slab_free+0x172/0x1d0
[   48.638317]  __kasan_slab_free+0x16/0x20
[   48.638886]  __kmem_cache_free+0x190/0x310
[   48.639470]  kfree+0x7c/0x120
[   48.639980]  kmalloc_uaf2+0xd0/0x2b0
[   48.640421]  kunit_try_run_case+0x126/0x290
[   48.640990]  kunit_generic_run_threadfn_adapter+0x33/0x50
[   48.641658]  kthread+0x19e/0x1e0
[   48.642136]  ret_from_fork+0x41/0x70
[   48.642625]  ret_from_fork_asm+0x1b/0x30
[   48.643227] 
[   48.643510] The buggy address belongs to the object at ffff888102849100
[   48.643510]  which belongs to the cache kmalloc-64 of size 64
[   48.644572] The buggy address is located 40 bytes inside of
[   48.644572]  freed 64-byte region [ffff888102849100, ffff888102849140)
[   48.645560] 
[   48.645882] The buggy address belongs to the physical page:
[   48.646494] page:(____ptrval____) refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102849
[   48.647475] flags: 0x200000000000800(slab|node=0|zone=2)
[   48.648066] page_type: 0xffffffff()
[   48.648555] raw: 0200000000000800 ffff888100041640 dead000000000122 0000000000000000
[   48.649360] raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
[   48.650134] page dumped because: kasan: bad access detected
[   48.650635] 
[   48.650962] Memory state around the buggy address:
[   48.651519]  ffff888102849000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   48.652215]  ffff888102849080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   48.652934] >ffff888102849100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   48.653647]                                   ^
[   48.654095]  ffff888102849180: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   48.654917]  ffff888102849200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.655544] ==================================================================