Hay
Date
Nov. 27, 2024, 3:37 a.m.

Environment
qemu-arm64
qemu-x86_64

[   49.262595] ==================================================================
[   49.263822] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x390/0x468
[   49.264484] Read of size 1 at addr fff00000c6176000 by task kunit_try_catch/202
[   49.265396] 
[   49.265769] CPU: 0 UID: 0 PID: 202 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   49.266964] Tainted: [B]=BAD_PAGE, [N]=TEST
[   49.267582] Hardware name: linux,dummy-virt (DT)
[   49.268197] Call trace:
[   49.268576]  show_stack+0x20/0x38 (C)
[   49.269237]  dump_stack_lvl+0x8c/0xd0
[   49.269730]  print_report+0x118/0x5e0
[   49.270388]  kasan_report+0xc8/0x118
[   49.270923]  __asan_report_load1_noabort+0x20/0x30
[   49.271656]  kmem_cache_rcu_uaf+0x390/0x468
[   49.272308]  kunit_try_run_case+0x14c/0x3d0
[   49.272861]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   49.273707]  kthread+0x24c/0x2d0
[   49.274325]  ret_from_fork+0x10/0x20
[   49.274925] 
[   49.275231] Allocated by task 202:
[   49.275836]  kasan_save_stack+0x3c/0x68
[   49.276369]  kasan_save_track+0x20/0x40
[   49.276955]  kasan_save_alloc_info+0x40/0x58
[   49.277588]  __kasan_slab_alloc+0xa8/0xb0
[   49.278141]  kmem_cache_alloc_noprof+0x108/0x398
[   49.278786]  kmem_cache_rcu_uaf+0x12c/0x468
[   49.279362]  kunit_try_run_case+0x14c/0x3d0
[   49.279950]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   49.280720]  kthread+0x24c/0x2d0
[   49.281203]  ret_from_fork+0x10/0x20
[   49.281837] 
[   49.282164] Freed by task 0:
[   49.282650]  kasan_save_stack+0x3c/0x68
[   49.283315]  kasan_save_track+0x20/0x40
[   49.283836]  kasan_save_free_info+0x4c/0x78
[   49.284367]  __kasan_slab_free+0x6c/0x98
[   49.284993]  slab_free_after_rcu_debug+0xd4/0x2f8
[   49.285756]  rcu_core+0x9f4/0x1e20
[   49.286360]  rcu_core_si+0x18/0x30
[   49.286900]  handle_softirqs+0x374/0xb20
[   49.287451]  __do_softirq+0x1c/0x28
[   49.287987] 
[   49.288331] Last potentially related work creation:
[   49.289027]  kasan_save_stack+0x3c/0x68
[   49.289575]  __kasan_record_aux_stack+0xbc/0xe8
[   49.290426]  kasan_record_aux_stack_noalloc+0x14/0x20
[   49.290968]  kmem_cache_free+0x28c/0x470
[   49.291696]  kmem_cache_rcu_uaf+0x16c/0x468
[   49.292272]  kunit_try_run_case+0x14c/0x3d0
[   49.292883]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   49.293532]  kthread+0x24c/0x2d0
[   49.294190]  ret_from_fork+0x10/0x20
[   49.294719] 
[   49.295076] The buggy address belongs to the object at fff00000c6176000
[   49.295076]  which belongs to the cache test_cache of size 200
[   49.296480] The buggy address is located 0 bytes inside of
[   49.296480]  freed 200-byte region [fff00000c6176000, fff00000c61760c8)
[   49.297772] 
[   49.298106] The buggy address belongs to the physical page:
[   49.298896] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106176
[   49.299908] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   49.300728] page_type: f5(slab)
[   49.301255] raw: 0bfffe0000000000 fff00000c6181280 dead000000000122 0000000000000000
[   49.302170] raw: 0000000000000000 00000000800f000f 00000001f5000000 0000000000000000
[   49.303055] page dumped because: kasan: bad access detected
[   49.303812] 
[   49.304124] Memory state around the buggy address:
[   49.304701]  fff00000c6175f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   49.305604]  fff00000c6175f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   49.306452] >fff00000c6176000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   49.307249]                    ^
[   49.307805]  fff00000c6176080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   49.308631]  fff00000c6176100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   49.309497] ==================================================================

[   26.424625] ==================================================================
[   26.425760] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e5/0x510
[   26.426402] Read of size 1 at addr ffff888101aae000 by task kunit_try_catch/221
[   26.427507] 
[   26.427796] CPU: 1 UID: 0 PID: 221 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   26.428907] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.429366] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.430550] Call Trace:
[   26.430966]  <TASK>
[   26.431820]  dump_stack_lvl+0x73/0xb0
[   26.432258]  print_report+0xd1/0x640
[   26.433261]  ? __virt_addr_valid+0x1db/0x2d0
[   26.433757]  ? kasan_complete_mode_report_info+0x64/0x200
[   26.434555]  kasan_report+0x102/0x140
[   26.435046]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   26.435472]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   26.436167]  __asan_report_load1_noabort+0x18/0x20
[   26.436583]  kmem_cache_rcu_uaf+0x3e5/0x510
[   26.437208]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   26.438163]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   26.439092]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   26.439575]  kunit_try_run_case+0x1b3/0x490
[   26.440089]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.440680]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   26.441183]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   26.441718]  ? __kthread_parkme+0x82/0x160
[   26.442189]  ? preempt_count_sub+0x50/0x80
[   26.442801]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.443429]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   26.444110]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.444641]  kthread+0x257/0x310
[   26.445244]  ? __pfx_kthread+0x10/0x10
[   26.445642]  ret_from_fork+0x41/0x80
[   26.446203]  ? __pfx_kthread+0x10/0x10
[   26.446557]  ret_from_fork_asm+0x1a/0x30
[   26.447333]  </TASK>
[   26.447595] 
[   26.447809] Allocated by task 221:
[   26.448292]  kasan_save_stack+0x3d/0x60
[   26.448715]  kasan_save_track+0x18/0x40
[   26.449226]  kasan_save_alloc_info+0x3b/0x50
[   26.449698]  __kasan_slab_alloc+0x91/0xa0
[   26.450258]  kmem_cache_alloc_noprof+0x11e/0x3e0
[   26.450781]  kmem_cache_rcu_uaf+0x156/0x510
[   26.451496]  kunit_try_run_case+0x1b3/0x490
[   26.452200]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.452596]  kthread+0x257/0x310
[   26.452888]  ret_from_fork+0x41/0x80
[   26.453568]  ret_from_fork_asm+0x1a/0x30
[   26.454069] 
[   26.454295] Freed by task 0:
[   26.454528]  kasan_save_stack+0x3d/0x60
[   26.455248]  kasan_save_track+0x18/0x40
[   26.455711]  kasan_save_free_info+0x3f/0x60
[   26.456361]  __kasan_slab_free+0x56/0x70
[   26.456652]  slab_free_after_rcu_debug+0xe4/0x310
[   26.457385]  rcu_core+0x680/0x1d70
[   26.457782]  rcu_core_si+0x12/0x20
[   26.458396]  handle_softirqs+0x209/0x720
[   26.458693]  __irq_exit_rcu+0xc9/0x110
[   26.459431]  irq_exit_rcu+0x12/0x20
[   26.459867]  sysvec_apic_timer_interrupt+0x81/0x90
[   26.460293]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   26.460778] 
[   26.460931] Last potentially related work creation:
[   26.461630]  kasan_save_stack+0x3d/0x60
[   26.462172]  __kasan_record_aux_stack+0xae/0xc0
[   26.462596]  kasan_record_aux_stack_noalloc+0xf/0x20
[   26.463482]  kmem_cache_free+0x284/0x420
[   26.463768]  kmem_cache_rcu_uaf+0x195/0x510
[   26.464431]  kunit_try_run_case+0x1b3/0x490
[   26.464742]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.465510]  kthread+0x257/0x310
[   26.465816]  ret_from_fork+0x41/0x80
[   26.466413]  ret_from_fork_asm+0x1a/0x30
[   26.466763] 
[   26.467220] The buggy address belongs to the object at ffff888101aae000
[   26.467220]  which belongs to the cache test_cache of size 200
[   26.468368] The buggy address is located 0 bytes inside of
[   26.468368]  freed 200-byte region [ffff888101aae000, ffff888101aae0c8)
[   26.469556] 
[   26.469773] The buggy address belongs to the physical page:
[   26.470473] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101aae
[   26.471377] flags: 0x200000000000000(node=0|zone=2)
[   26.471860] page_type: f5(slab)
[   26.472265] raw: 0200000000000000 ffff888101a54a00 dead000000000122 0000000000000000
[   26.473025] raw: 0000000000000000 00000000800f000f 00000001f5000000 0000000000000000
[   26.473643] page dumped because: kasan: bad access detected
[   26.474366] 
[   26.474551] Memory state around the buggy address:
[   26.475383]  ffff888101aadf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.476131]  ffff888101aadf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.476822] >ffff888101aae000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   26.478071]                    ^
[   26.478548]  ffff888101aae080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   26.479484]  ffff888101aae100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.480108] ==================================================================