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

Environment
qemu-armv7
qemu-x86_64

[  145.612653] ==================================================================
[  145.613779] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0xd0/0x1d0
[  145.614462] Read of size 1 at addr c4fcf908 by task kunit_try_catch/157
[  145.615203] 
[  145.615437] CPU: 0 PID: 157 Comm: kunit_try_catch Tainted: G    B            N 6.6.76-rc1 #1
[  145.616374] Hardware name: Generic DT based system
[  145.616935]  unwind_backtrace from show_stack+0x18/0x1c
[  145.617633]  show_stack from dump_stack_lvl+0x58/0x70
[  145.618366]  dump_stack_lvl from print_report+0x164/0x51c
[  145.619203]  print_report from kasan_report+0xc8/0x104
[  145.620040]  kasan_report from kmalloc_uaf+0xd0/0x1d0
[  145.620731]  kmalloc_uaf from kunit_try_run_case+0x11c/0x2e4
[  145.621456]  kunit_try_run_case from kunit_generic_run_threadfn_adapter+0x2c/0x48
[  145.622457]  kunit_generic_run_threadfn_adapter from kthread+0x184/0x1a8
[  145.623425]  kthread from ret_from_fork+0x14/0x30
[  145.624005] Exception stack(0xf9fe3fb0 to 0xf9fe3ff8)
[  145.624577] 3fa0:                                     00000000 00000000 00000000 00000000
[  145.625496] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  145.626963] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[  145.628304] 
[  145.628533] Allocated by task 157:
[  145.628921]  kasan_set_track+0x3c/0x5c
[  145.629473]  __kasan_kmalloc+0x8c/0x94
[  145.629996]  kmalloc_uaf+0xa0/0x1d0
[  145.630424]  kunit_try_run_case+0x11c/0x2e4
[  145.631112]  kunit_generic_run_threadfn_adapter+0x2c/0x48
[  145.632098]  kthread+0x184/0x1a8
[  145.632487]  ret_from_fork+0x14/0x30
[  145.633037] 
[  145.633274] Freed by task 157:
[  145.633760]  kasan_set_track+0x3c/0x5c
[  145.634331]  kasan_save_free_info+0x30/0x3c
[  145.635016]  __kasan_slab_free+0xdc/0x124
[  145.635560]  __kmem_cache_free+0x140/0x2a8
[  145.636132]  kmalloc_uaf+0xbc/0x1d0
[  145.636590]  kunit_try_run_case+0x11c/0x2e4
[  145.637187]  kunit_generic_run_threadfn_adapter+0x2c/0x48
[  145.638089]  kthread+0x184/0x1a8
[  145.638503]  ret_from_fork+0x14/0x30
[  145.639012] 
[  145.639283] The buggy address belongs to the object at c4fcf900
[  145.639283]  which belongs to the cache kmalloc-64 of size 64
[  145.640714] The buggy address is located 8 bytes inside of
[  145.640714]  freed 64-byte region [c4fcf900, c4fcf940)
[  145.642020] 
[  145.642299] The buggy address belongs to the physical page:
[  145.642825] page:8516b471 refcount:1 mapcount:0 mapping:00000000 index:0x0 pfn:0x44fcf
[  145.643751] flags: 0x800(slab|zone=0)
[  145.644288] page_type: 0xffffffff()
[  145.644817] raw: 00000800 c4801200 00000122 00000000 00000000 80200020 ffffffff 00000001
[  145.645709] raw: 00000000
[  145.646170] page dumped because: kasan: bad access detected
[  145.646658] 
[  145.647009] Memory state around the buggy address:
[  145.647559]  c4fcf800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[  145.648335]  c4fcf880: 00 00 07 fc fc fc fc fc fc fc fc fc fc fc fc fc
[  145.649137] >c4fcf900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[  145.649886]               ^
[  145.650256]  c4fcf980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  145.651170]  c4fcfa00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  145.651793] ==================================================================


[   48.469711] ==================================================================
[   48.470631] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0xd5/0x1d0
[   48.471595] Read of size 1 at addr ffff88810273e0a8 by task kunit_try_catch/180
[   48.472344] 
[   48.472632] CPU: 1 PID: 180 Comm: kunit_try_catch Tainted: G    B            N 6.6.76-rc1 #1
[   48.474220] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   48.475084] Call Trace:
[   48.475530]  <TASK>
[   48.476004]  dump_stack_lvl+0x4e/0x90
[   48.476627]  print_report+0xd2/0x660
[   48.477241]  ? __virt_addr_valid+0x156/0x1e0
[   48.477824]  ? kasan_complete_mode_report_info+0x64/0x200
[   48.478430]  kasan_report+0xff/0x140
[   48.478895]  ? kmalloc_uaf+0xd5/0x1d0
[   48.479372]  ? kmalloc_uaf+0xd5/0x1d0
[   48.479847]  __asan_load1+0x66/0x70
[   48.480918]  kmalloc_uaf+0xd5/0x1d0
[   48.481372]  ? __pfx_kmalloc_uaf+0x10/0x10
[   48.482047]  ? __schedule+0x70b/0x1190
[   48.482599]  ? ktime_get_ts64+0x118/0x140
[   48.483339]  kunit_try_run_case+0x126/0x290
[   48.483930]  ? __pfx_kunit_try_run_case+0x10/0x10
[   48.484638]  ? __kasan_check_write+0x18/0x20
[   48.485354]  ? trace_preempt_on+0x20/0xa0
[   48.485784]  ? __kthread_parkme+0x4f/0xd0
[   48.486407]  ? preempt_count_sub+0x50/0x80
[   48.487059]  ? __pfx_kunit_try_run_case+0x10/0x10
[   48.487685]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   48.488748]  kunit_generic_run_threadfn_adapter+0x33/0x50
[   48.489338]  kthread+0x19e/0x1e0
[   48.489850]  ? __pfx_kthread+0x10/0x10
[   48.490454]  ret_from_fork+0x41/0x70
[   48.491101]  ? __pfx_kthread+0x10/0x10
[   48.491648]  ret_from_fork_asm+0x1b/0x30
[   48.492361]  </TASK>
[   48.492758] 
[   48.493039] Allocated by task 180:
[   48.493524]  kasan_save_stack+0x3c/0x60
[   48.494108]  kasan_set_track+0x29/0x40
[   48.494672]  kasan_save_alloc_info+0x22/0x30
[   48.495272]  __kasan_kmalloc+0xb7/0xc0
[   48.495885]  kmalloc_trace+0x4c/0xb0
[   48.496394]  kmalloc_uaf+0x9d/0x1d0
[   48.496949]  kunit_try_run_case+0x126/0x290
[   48.497491]  kunit_generic_run_threadfn_adapter+0x33/0x50
[   48.498215]  kthread+0x19e/0x1e0
[   48.498818]  ret_from_fork+0x41/0x70
[   48.499371]  ret_from_fork_asm+0x1b/0x30
[   48.499913] 
[   48.500099] Freed by task 180:
[   48.500350]  kasan_save_stack+0x3c/0x60
[   48.500779]  kasan_set_track+0x29/0x40
[   48.501141]  kasan_save_free_info+0x2f/0x50
[   48.501541]  ____kasan_slab_free+0x172/0x1d0
[   48.502072]  __kasan_slab_free+0x16/0x20
[   48.502627]  __kmem_cache_free+0x190/0x310
[   48.503321]  kfree+0x7c/0x120
[   48.503814]  kmalloc_uaf+0xbd/0x1d0
[   48.504365]  kunit_try_run_case+0x126/0x290
[   48.505093]  kunit_generic_run_threadfn_adapter+0x33/0x50
[   48.506043]  kthread+0x19e/0x1e0
[   48.506610]  ret_from_fork+0x41/0x70
[   48.508281]  ret_from_fork_asm+0x1b/0x30
[   48.509415] 
[   48.509841] The buggy address belongs to the object at ffff88810273e0a0
[   48.509841]  which belongs to the cache kmalloc-16 of size 16
[   48.511112] The buggy address is located 8 bytes inside of
[   48.511112]  freed 16-byte region [ffff88810273e0a0, ffff88810273e0b0)
[   48.511887] 
[   48.512173] The buggy address belongs to the physical page:
[   48.513611] page:(____ptrval____) refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10273e
[   48.514944] flags: 0x200000000000800(slab|node=0|zone=2)
[   48.515633] page_type: 0xffffffff()
[   48.516144] raw: 0200000000000800 ffff8881000413c0 dead000000000122 0000000000000000
[   48.516919] raw: 0000000000000000 0000000080800080 00000001ffffffff 0000000000000000
[   48.518198] page dumped because: kasan: bad access detected
[   48.519005] 
[   48.519338] Memory state around the buggy address:
[   48.519989]  ffff88810273df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.520953]  ffff88810273e000: 00 04 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   48.521582] >ffff88810273e080: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   48.522768]                                   ^
[   48.523467]  ffff88810273e100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.524167]  ffff88810273e180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.524996] ==================================================================