Hay
Date
Dec. 5, 2024, 2:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   31.472502] ==================================================================
[   31.473737] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x390/0x468
[   31.474521] Read of size 1 at addr fff00000c638b000 by task kunit_try_catch/202
[   31.475578] 
[   31.476106] CPU: 0 UID: 0 PID: 202 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241205 #1
[   31.477554] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.478099] Hardware name: linux,dummy-virt (DT)
[   31.478820] Call trace:
[   31.479455]  show_stack+0x20/0x38 (C)
[   31.480182]  dump_stack_lvl+0x8c/0xd0
[   31.480775]  print_report+0x118/0x5e0
[   31.481472]  kasan_report+0xc8/0x118
[   31.482135]  __asan_report_load1_noabort+0x20/0x30
[   31.482918]  kmem_cache_rcu_uaf+0x390/0x468
[   31.483715]  kunit_try_run_case+0x14c/0x3d0
[   31.484537]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.485550]  kthread+0x24c/0x2d0
[   31.486187]  ret_from_fork+0x10/0x20
[   31.486928] 
[   31.487449] Allocated by task 202:
[   31.488085]  kasan_save_stack+0x3c/0x68
[   31.488655]  kasan_save_track+0x20/0x40
[   31.489305]  kasan_save_alloc_info+0x40/0x58
[   31.489859]  __kasan_slab_alloc+0xa8/0xb0
[   31.490575]  kmem_cache_alloc_noprof+0x108/0x398
[   31.491452]  kmem_cache_rcu_uaf+0x12c/0x468
[   31.492023]  kunit_try_run_case+0x14c/0x3d0
[   31.492619]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.493600]  kthread+0x24c/0x2d0
[   31.494217]  ret_from_fork+0x10/0x20
[   31.494776] 
[   31.495162] Freed by task 0:
[   31.495770]  kasan_save_stack+0x3c/0x68
[   31.496616]  kasan_save_track+0x20/0x40
[   31.497131]  kasan_save_free_info+0x4c/0x78
[   31.497713]  __kasan_slab_free+0x6c/0x98
[   31.498192]  slab_free_after_rcu_debug+0xd4/0x2f8
[   31.498950]  rcu_core+0x9f4/0x1e20
[   31.499745]  rcu_core_si+0x18/0x30
[   31.500631]  handle_softirqs+0x374/0xb20
[   31.501383]  __do_softirq+0x1c/0x28
[   31.502094] 
[   31.502558] Last potentially related work creation:
[   31.503347]  kasan_save_stack+0x3c/0x68
[   31.503944]  kasan_record_aux_stack+0xb4/0xc8
[   31.504701]  kmem_cache_free+0x28c/0x470
[   31.505283]  kmem_cache_rcu_uaf+0x16c/0x468
[   31.506142]  kunit_try_run_case+0x14c/0x3d0
[   31.506830]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.507668]  kthread+0x24c/0x2d0
[   31.508262]  ret_from_fork+0x10/0x20
[   31.508949] 
[   31.509319] The buggy address belongs to the object at fff00000c638b000
[   31.509319]  which belongs to the cache test_cache of size 200
[   31.510811] The buggy address is located 0 bytes inside of
[   31.510811]  freed 200-byte region [fff00000c638b000, fff00000c638b0c8)
[   31.513180] 
[   31.513658] The buggy address belongs to the physical page:
[   31.514592] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10638b
[   31.515802] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.516941] page_type: f5(slab)
[   31.517476] raw: 0bfffe0000000000 fff00000c56a0c80 dead000000000122 0000000000000000
[   31.518496] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   31.519584] page dumped because: kasan: bad access detected
[   31.520495] 
[   31.520994] Memory state around the buggy address:
[   31.521712]  fff00000c638af00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   31.522760]  fff00000c638af80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   31.524050] >fff00000c638b000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   31.525413]                    ^
[   31.525666]  fff00000c638b080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   31.526598]  fff00000c638b100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.527735] ==================================================================

[   29.268341] ==================================================================
[   29.269400] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e5/0x510
[   29.270116] Read of size 1 at addr ffff888101abc000 by task kunit_try_catch/220
[   29.271075] 
[   29.271292] CPU: 0 UID: 0 PID: 220 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241205 #1
[   29.272530] Tainted: [B]=BAD_PAGE, [N]=TEST
[   29.272929] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   29.273756] Call Trace:
[   29.274228]  <TASK>
[   29.274450]  dump_stack_lvl+0x73/0xb0
[   29.274936]  print_report+0xd1/0x640
[   29.275203]  ? __virt_addr_valid+0x1db/0x2d0
[   29.275501]  ? kasan_complete_mode_report_info+0x64/0x200
[   29.275910]  kasan_report+0x102/0x140
[   29.276183]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   29.276483]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   29.276988]  __asan_report_load1_noabort+0x18/0x20
[   29.277395]  kmem_cache_rcu_uaf+0x3e5/0x510
[   29.277854]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   29.278476]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   29.279207]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   29.279840]  kunit_try_run_case+0x1b3/0x490
[   29.280385]  ? __pfx_kunit_try_run_case+0x10/0x10
[   29.280910]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   29.281243]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   29.281953]  ? __kthread_parkme+0x82/0x160
[   29.282564]  ? preempt_count_sub+0x50/0x80
[   29.283215]  ? __pfx_kunit_try_run_case+0x10/0x10
[   29.283994]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   29.284703]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   29.285273]  kthread+0x257/0x310
[   29.285963]  ? __pfx_kthread+0x10/0x10
[   29.286319]  ret_from_fork+0x41/0x80
[   29.286740]  ? __pfx_kthread+0x10/0x10
[   29.287173]  ret_from_fork_asm+0x1a/0x30
[   29.287615]  </TASK>
[   29.288084] 
[   29.288246] Allocated by task 220:
[   29.288497]  kasan_save_stack+0x3d/0x60
[   29.289028]  kasan_save_track+0x18/0x40
[   29.289405]  kasan_save_alloc_info+0x3b/0x50
[   29.290115]  __kasan_slab_alloc+0x91/0xa0
[   29.290615]  kmem_cache_alloc_noprof+0x11e/0x3e0
[   29.291317]  kmem_cache_rcu_uaf+0x156/0x510
[   29.291722]  kunit_try_run_case+0x1b3/0x490
[   29.292224]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   29.293002]  kthread+0x257/0x310
[   29.293512]  ret_from_fork+0x41/0x80
[   29.294107]  ret_from_fork_asm+0x1a/0x30
[   29.294393] 
[   29.294549] Freed by task 0:
[   29.295102]  kasan_save_stack+0x3d/0x60
[   29.295945]  kasan_save_track+0x18/0x40
[   29.296440]  kasan_save_free_info+0x3f/0x60
[   29.297132]  __kasan_slab_free+0x56/0x70
[   29.297500]  slab_free_after_rcu_debug+0xe4/0x310
[   29.298305]  rcu_core+0x680/0x1d70
[   29.298673]  rcu_core_si+0x12/0x20
[   29.299296]  handle_softirqs+0x209/0x720
[   29.299835]  __irq_exit_rcu+0xc9/0x110
[   29.300244]  irq_exit_rcu+0x12/0x20
[   29.300606]  sysvec_apic_timer_interrupt+0x81/0x90
[   29.301116]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   29.301590] 
[   29.301918] Last potentially related work creation:
[   29.302222]  kasan_save_stack+0x3d/0x60
[   29.302499]  kasan_record_aux_stack+0xb2/0xc0
[   29.303196]  kmem_cache_free+0x284/0x420
[   29.303721]  kmem_cache_rcu_uaf+0x195/0x510
[   29.304213]  kunit_try_run_case+0x1b3/0x490
[   29.304517]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   29.305310]  kthread+0x257/0x310
[   29.305881]  ret_from_fork+0x41/0x80
[   29.306283]  ret_from_fork_asm+0x1a/0x30
[   29.306733] 
[   29.307256] The buggy address belongs to the object at ffff888101abc000
[   29.307256]  which belongs to the cache test_cache of size 200
[   29.308217] The buggy address is located 0 bytes inside of
[   29.308217]  freed 200-byte region [ffff888101abc000, ffff888101abc0c8)
[   29.309669] 
[   29.309994] The buggy address belongs to the physical page:
[   29.310587] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101abc
[   29.311368] flags: 0x200000000000000(node=0|zone=2)
[   29.312049] page_type: f5(slab)
[   29.312381] raw: 0200000000000000 ffff8881011e5dc0 dead000000000122 0000000000000000
[   29.313108] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   29.313936] page dumped because: kasan: bad access detected
[   29.314503] 
[   29.314799] Memory state around the buggy address:
[   29.315256]  ffff888101abbf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.315948]  ffff888101abbf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.316676] >ffff888101abc000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   29.317319]                    ^
[   29.317822]  ffff888101abc080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   29.318656]  ffff888101abc100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.319385] ==================================================================