Hay
Date
Dec. 4, 2024, 3:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   33.499241] ==================================================================
[   33.500912] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x390/0x468
[   33.501754] Read of size 1 at addr fff00000c66a3000 by task kunit_try_catch/201
[   33.502932] 
[   33.503821] CPU: 1 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   33.505447] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.506444] Hardware name: linux,dummy-virt (DT)
[   33.507394] Call trace:
[   33.507821]  show_stack+0x20/0x38 (C)
[   33.508397]  dump_stack_lvl+0x8c/0xd0
[   33.509010]  print_report+0x118/0x5e0
[   33.509534]  kasan_report+0xc8/0x118
[   33.510864]  __asan_report_load1_noabort+0x20/0x30
[   33.511914]  kmem_cache_rcu_uaf+0x390/0x468
[   33.512344]  kunit_try_run_case+0x14c/0x3d0
[   33.513102]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.514130]  kthread+0x24c/0x2d0
[   33.515058]  ret_from_fork+0x10/0x20
[   33.515781] 
[   33.516117] Allocated by task 201:
[   33.516823]  kasan_save_stack+0x3c/0x68
[   33.517500]  kasan_save_track+0x20/0x40
[   33.518110]  kasan_save_alloc_info+0x40/0x58
[   33.519083]  __kasan_slab_alloc+0xa8/0xb0
[   33.520091]  kmem_cache_alloc_noprof+0x108/0x398
[   33.520589]  kmem_cache_rcu_uaf+0x12c/0x468
[   33.521041]  kunit_try_run_case+0x14c/0x3d0
[   33.522607]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.523658]  kthread+0x24c/0x2d0
[   33.524411]  ret_from_fork+0x10/0x20
[   33.525149] 
[   33.525725] Freed by task 0:
[   33.526514]  kasan_save_stack+0x3c/0x68
[   33.528038]  kasan_save_track+0x20/0x40
[   33.528783]  kasan_save_free_info+0x4c/0x78
[   33.529251]  __kasan_slab_free+0x6c/0x98
[   33.529558]  slab_free_after_rcu_debug+0xd4/0x2f8
[   33.530259]  rcu_core+0x9f4/0x1e20
[   33.531070]  rcu_core_si+0x18/0x30
[   33.532602]  handle_softirqs+0x374/0xb20
[   33.533319]  __do_softirq+0x1c/0x28
[   33.534328] 
[   33.534599] Last potentially related work creation:
[   33.535095]  kasan_save_stack+0x3c/0x68
[   33.535667]  kasan_record_aux_stack+0xb4/0xc8
[   33.536500]  kmem_cache_free+0x28c/0x470
[   33.537059]  kmem_cache_rcu_uaf+0x16c/0x468
[   33.537676]  kunit_try_run_case+0x14c/0x3d0
[   33.538884]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.539673]  kthread+0x24c/0x2d0
[   33.540258]  ret_from_fork+0x10/0x20
[   33.540813] 
[   33.541087] The buggy address belongs to the object at fff00000c66a3000
[   33.541087]  which belongs to the cache test_cache of size 200
[   33.543011] The buggy address is located 0 bytes inside of
[   33.543011]  freed 200-byte region [fff00000c66a3000, fff00000c66a30c8)
[   33.544579] 
[   33.544869] The buggy address belongs to the physical page:
[   33.546034] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1066a3
[   33.546938] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.548356] page_type: f5(slab)
[   33.548977] raw: 0bfffe0000000000 fff00000c105cb40 dead000000000122 0000000000000000
[   33.550333] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   33.551175] page dumped because: kasan: bad access detected
[   33.552028] 
[   33.552407] Memory state around the buggy address:
[   33.553049]  fff00000c66a2f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   33.554835]  fff00000c66a2f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   33.556145] >fff00000c66a3000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   33.557204]                    ^
[   33.557806]  fff00000c66a3080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   33.559399]  fff00000c66a3100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.560469] ==================================================================

[   24.281798] ==================================================================
[   24.282788] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e5/0x510
[   24.284059] Read of size 1 at addr ffff888102997000 by task kunit_try_catch/221
[   24.284528] 
[   24.284738] CPU: 1 UID: 0 PID: 221 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   24.285566] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.285970] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.287658] Call Trace:
[   24.287969]  <TASK>
[   24.288270]  dump_stack_lvl+0x73/0xb0
[   24.288911]  print_report+0xd1/0x640
[   24.289621]  ? __virt_addr_valid+0x1db/0x2d0
[   24.290214]  ? kasan_complete_mode_report_info+0x64/0x200
[   24.290846]  kasan_report+0x102/0x140
[   24.291398]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   24.292344]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   24.292970]  __asan_report_load1_noabort+0x18/0x20
[   24.293598]  kmem_cache_rcu_uaf+0x3e5/0x510
[   24.294338]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   24.295104]  ? finish_task_switch.isra.0+0x153/0x700
[   24.295602]  ? __switch_to+0x5d9/0xf60
[   24.296537]  ? __pfx_read_tsc+0x10/0x10
[   24.297295]  ? ktime_get_ts64+0x86/0x230
[   24.298034]  kunit_try_run_case+0x1b3/0x490
[   24.298590]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.299606]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.300936]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.301739]  ? __kthread_parkme+0x82/0x160
[   24.302652]  ? preempt_count_sub+0x50/0x80
[   24.303230]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.304061]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.304797]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.305200]  kthread+0x257/0x310
[   24.305640]  ? __pfx_kthread+0x10/0x10
[   24.306213]  ret_from_fork+0x41/0x80
[   24.306922]  ? __pfx_kthread+0x10/0x10
[   24.307231]  ret_from_fork_asm+0x1a/0x30
[   24.307617]  </TASK>
[   24.308170] 
[   24.308925] Allocated by task 221:
[   24.309290]  kasan_save_stack+0x3d/0x60
[   24.309685]  kasan_save_track+0x18/0x40
[   24.310576]  kasan_save_alloc_info+0x3b/0x50
[   24.310987]  __kasan_slab_alloc+0x91/0xa0
[   24.312000]  kmem_cache_alloc_noprof+0x11e/0x3e0
[   24.312776]  kmem_cache_rcu_uaf+0x156/0x510
[   24.313281]  kunit_try_run_case+0x1b3/0x490
[   24.313885]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.314711]  kthread+0x257/0x310
[   24.315228]  ret_from_fork+0x41/0x80
[   24.315757]  ret_from_fork_asm+0x1a/0x30
[   24.316966] 
[   24.317189] Freed by task 0:
[   24.317528]  kasan_save_stack+0x3d/0x60
[   24.318261]  kasan_save_track+0x18/0x40
[   24.318797]  kasan_save_free_info+0x3f/0x60
[   24.319398]  __kasan_slab_free+0x56/0x70
[   24.320226]  slab_free_after_rcu_debug+0xe4/0x310
[   24.320670]  rcu_core+0x680/0x1d70
[   24.321470]  rcu_core_si+0x12/0x20
[   24.321705]  handle_softirqs+0x209/0x720
[   24.322059]  __irq_exit_rcu+0xc9/0x110
[   24.322881]  irq_exit_rcu+0x12/0x20
[   24.323234]  sysvec_apic_timer_interrupt+0x81/0x90
[   24.324252]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   24.325375] 
[   24.325629] Last potentially related work creation:
[   24.326188]  kasan_save_stack+0x3d/0x60
[   24.326636]  kasan_record_aux_stack+0xb2/0xc0
[   24.327911]  kmem_cache_free+0x284/0x420
[   24.328273]  kmem_cache_rcu_uaf+0x195/0x510
[   24.328802]  kunit_try_run_case+0x1b3/0x490
[   24.329300]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.329925]  kthread+0x257/0x310
[   24.331114]  ret_from_fork+0x41/0x80
[   24.331486]  ret_from_fork_asm+0x1a/0x30
[   24.331852] 
[   24.332341] The buggy address belongs to the object at ffff888102997000
[   24.332341]  which belongs to the cache test_cache of size 200
[   24.334248] The buggy address is located 0 bytes inside of
[   24.334248]  freed 200-byte region [ffff888102997000, ffff8881029970c8)
[   24.335792] 
[   24.335976] The buggy address belongs to the physical page:
[   24.336815] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102997
[   24.337415] flags: 0x200000000000000(node=0|zone=2)
[   24.338012] page_type: f5(slab)
[   24.338726] raw: 0200000000000000 ffff8881010c4dc0 dead000000000122 0000000000000000
[   24.339725] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   24.340653] page dumped because: kasan: bad access detected
[   24.341826] 
[   24.342282] Memory state around the buggy address:
[   24.342993]  ffff888102996f00: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
[   24.343708]  ffff888102996f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.344596] >ffff888102997000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   24.345543]                    ^
[   24.345861]  ffff888102997080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   24.346465]  ffff888102997100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.347512] ==================================================================