Hay
Date
Nov. 22, 2024, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   34.797230] ==================================================================
[   34.798764] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x64/0x70
[   34.799800] Read of size 4 at addr fff00000c6a708c0 by task swapper/0/0
[   34.800558] 
[   34.800945] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Tainted: G    B            N 6.12.0-next-20241122 #1
[   34.802111] Tainted: [B]=BAD_PAGE, [N]=TEST
[   34.803278] Hardware name: linux,dummy-virt (DT)
[   34.805311] Call trace:
[   34.805832]  show_stack+0x20/0x38 (C)
[   34.806638]  dump_stack_lvl+0x8c/0xd0
[   34.807362]  print_report+0x118/0x5e0
[   34.808199]  kasan_report+0xc8/0x118
[   34.809111]  __asan_report_load4_noabort+0x20/0x30
[   34.810373]  rcu_uaf_reclaim+0x64/0x70
[   34.811162]  rcu_core+0xa54/0x1df8
[   34.811907]  rcu_core_si+0x18/0x30
[   34.812592]  handle_softirqs+0x374/0xb20
[   34.813574]  __do_softirq+0x1c/0x28
[   34.814217]  ____do_softirq+0x18/0x30
[   34.814684]  call_on_irq_stack+0x24/0x58
[   34.815244]  do_softirq_own_stack+0x24/0x38
[   34.815717]  __irq_exit_rcu+0x1fc/0x318
[   34.817580]  irq_exit_rcu+0x1c/0x80
[   34.818580]  el1_interrupt+0x38/0x58
[   34.819673]  el1h_64_irq_handler+0x18/0x28
[   34.820562]  el1h_64_irq+0x6c/0x70
[   34.821630]  arch_local_irq_enable+0x4/0x8 (P)
[   34.822593]  default_idle_call+0x6c/0x78 (L)
[   34.823712]  do_idle+0x384/0x4e8
[   34.824406]  cpu_startup_entry+0x64/0x80
[   34.825264]  rest_init+0x160/0x188
[   34.826254]  start_kernel+0x308/0x3d0
[   34.826921]  __primary_switched+0x8c/0xa0
[   34.827518] 
[   34.827896] Allocated by task 187:
[   34.828338]  kasan_save_stack+0x3c/0x68
[   34.829724]  kasan_save_track+0x20/0x40
[   34.830357]  kasan_save_alloc_info+0x40/0x58
[   34.831069]  __kasan_kmalloc+0xd4/0xd8
[   34.831801]  __kmalloc_cache_noprof+0x15c/0x3c8
[   34.832498]  rcu_uaf+0xb0/0x2d0
[   34.833322]  kunit_try_run_case+0x14c/0x3d0
[   34.834663]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.835931]  kthread+0x24c/0x2d0
[   34.836927]  ret_from_fork+0x10/0x20
[   34.837694] 
[   34.838306] Freed by task 0:
[   34.838739]  kasan_save_stack+0x3c/0x68
[   34.839246]  kasan_save_track+0x20/0x40
[   34.839913]  kasan_save_free_info+0x4c/0x78
[   34.840718]  __kasan_slab_free+0x6c/0x98
[   34.841705]  kfree+0x114/0x3d0
[   34.842346]  rcu_uaf_reclaim+0x28/0x70
[   34.842944]  rcu_core+0xa54/0x1df8
[   34.843468]  rcu_core_si+0x18/0x30
[   34.843923]  handle_softirqs+0x374/0xb20
[   34.845142]  __do_softirq+0x1c/0x28
[   34.845687] 
[   34.846078] Last potentially related work creation:
[   34.847144]  kasan_save_stack+0x3c/0x68
[   34.847969]  __kasan_record_aux_stack+0xbc/0xe8
[   34.848940]  kasan_record_aux_stack_noalloc+0x14/0x20
[   34.850103]  __call_rcu_common.constprop.0+0x74/0xa18
[   34.850899]  call_rcu+0x18/0x30
[   34.851359]  rcu_uaf+0x14c/0x2d0
[   34.851941]  kunit_try_run_case+0x14c/0x3d0
[   34.852897]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.854090]  kthread+0x24c/0x2d0
[   34.854580]  ret_from_fork+0x10/0x20
[   34.855337] 
[   34.855705] The buggy address belongs to the object at fff00000c6a708c0
[   34.855705]  which belongs to the cache kmalloc-32 of size 32
[   34.858007] The buggy address is located 0 bytes inside of
[   34.858007]  freed 32-byte region [fff00000c6a708c0, fff00000c6a708e0)
[   34.859427] 
[   34.859813] The buggy address belongs to the physical page:
[   34.861071] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106a70
[   34.862688] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   34.863550] page_type: f5(slab)
[   34.864034] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   34.866791] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   34.867746] page dumped because: kasan: bad access detected
[   34.868511] 
[   34.868961] Memory state around the buggy address:
[   34.869785]  fff00000c6a70780: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   34.871041]  fff00000c6a70800: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   34.871755] >fff00000c6a70880: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   34.873545]                                            ^
[   34.874350]  fff00000c6a70900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.875953]  fff00000c6a70980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.877402] ==================================================================

[   26.034136] ==================================================================
[   26.034616] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x50/0x60
[   26.034876] Read of size 4 at addr ffff888101ab0500 by task swapper/0/0
[   26.035075] 
[   26.035172] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Tainted: G    B            N 6.12.0-next-20241122 #1
[   26.035438] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.035571] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.035818] Call Trace:
[   26.036520]  <IRQ>
[   26.037039]  dump_stack_lvl+0x73/0xb0
[   26.037515]  print_report+0xd1/0x640
[   26.038042]  ? __virt_addr_valid+0x1db/0x2d0
[   26.038574]  ? kasan_complete_mode_report_info+0x64/0x200
[   26.039018]  kasan_report+0x102/0x140
[   26.039290]  ? rcu_uaf_reclaim+0x50/0x60
[   26.039567]  ? rcu_uaf_reclaim+0x50/0x60
[   26.039869]  __asan_report_load4_noabort+0x18/0x20
[   26.040329]  rcu_uaf_reclaim+0x50/0x60
[   26.040853]  rcu_core+0x680/0x1d70
[   26.041616]  ? __pfx_rcu_core+0x10/0x10
[   26.042412]  ? ktime_get+0x69/0x150
[   26.044643]  ? handle_softirqs+0x18e/0x720
[   26.045486]  rcu_core_si+0x12/0x20
[   26.046388]  handle_softirqs+0x209/0x720
[   26.046964]  ? hrtimer_interrupt+0x2fe/0x780
[   26.047692]  ? __pfx_handle_softirqs+0x10/0x10
[   26.048697]  __irq_exit_rcu+0xc9/0x110
[   26.049751]  irq_exit_rcu+0x12/0x20
[   26.050104]  sysvec_apic_timer_interrupt+0x81/0x90
[   26.051038]  </IRQ>
[   26.051236]  <TASK>
[   26.051414]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   26.052854] RIP: 0010:default_idle+0xf/0x20
[   26.053818] Code: 4c 01 c7 4c 29 c2 e9 72 ff ff ff 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa eb 07 0f 00 2d 13 f0 34 00 fb f4 <fa> c3 cc cc cc cc 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90
[   26.055801] RSP: 0000:ffffffff89c07df0 EFLAGS: 00010206
[   26.057127] RAX: ffff88815b000000 RBX: ffffffff89c1a680 RCX: ffffffff8890b925
[   26.057853] RDX: ffffed102b606b23 RSI: 0000000000000004 RDI: 00000000000864c4
[   26.058446] RBP: ffffffff89c07df8 R08: 0000000000000001 R09: ffffed102b606b22
[   26.059875] R10: ffff88815b035913 R11: 0000000000000000 R12: 0000000000000000
[   26.060955] R13: fffffbfff13834d0 R14: ffffffff8a772650 R15: 0000000000000000
[   26.061799]  ? ct_kernel_exit.constprop.0+0xa5/0xd0
[   26.062115]  ? arch_cpu_idle+0xd/0x20
[   26.062271]  default_idle_call+0x48/0x80
[   26.062420]  do_idle+0x310/0x3c0
[   26.062560]  ? __pfx_do_idle+0x10/0x10
[   26.062713]  cpu_startup_entry+0x5c/0x70
[   26.062932]  rest_init+0x11a/0x140
[   26.063307]  ? acpi_subsystem_init+0x5d/0x150
[   26.065403]  start_kernel+0x320/0x400
[   26.065814]  x86_64_start_reservations+0x1c/0x30
[   26.066739]  x86_64_start_kernel+0xcf/0xe0
[   26.067788]  common_startup_64+0x12c/0x138
[   26.068386]  </TASK>
[   26.068565] 
[   26.068693] Allocated by task 206:
[   26.069066]  kasan_save_stack+0x3d/0x60
[   26.069480]  kasan_save_track+0x18/0x40
[   26.069916]  kasan_save_alloc_info+0x3b/0x50
[   26.070368]  __kasan_kmalloc+0xb7/0xc0
[   26.070702]  __kmalloc_cache_noprof+0x184/0x410
[   26.071435]  rcu_uaf+0xb1/0x330
[   26.071787]  kunit_try_run_case+0x1b3/0x490
[   26.073057]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.073586]  kthread+0x257/0x310
[   26.074130]  ret_from_fork+0x41/0x80
[   26.074622]  ret_from_fork_asm+0x1a/0x30
[   26.075378] 
[   26.075608] Freed by task 0:
[   26.076597]  kasan_save_stack+0x3d/0x60
[   26.077209]  kasan_save_track+0x18/0x40
[   26.077572]  kasan_save_free_info+0x3f/0x60
[   26.078024]  __kasan_slab_free+0x56/0x70
[   26.078550]  kfree+0x123/0x3f0
[   26.079159]  rcu_uaf_reclaim+0x1f/0x60
[   26.079663]  rcu_core+0x680/0x1d70
[   26.080674]  rcu_core_si+0x12/0x20
[   26.081188]  handle_softirqs+0x209/0x720
[   26.081776]  __irq_exit_rcu+0xc9/0x110
[   26.082309]  irq_exit_rcu+0x12/0x20
[   26.082905]  sysvec_apic_timer_interrupt+0x81/0x90
[   26.083717]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   26.084467] 
[   26.084688] Last potentially related work creation:
[   26.085604]  kasan_save_stack+0x3d/0x60
[   26.086329]  __kasan_record_aux_stack+0xae/0xc0
[   26.087104]  kasan_record_aux_stack_noalloc+0xf/0x20
[   26.087685]  __call_rcu_common.constprop.0+0x72/0xaa0
[   26.088316]  call_rcu+0x12/0x20
[   26.088793]  rcu_uaf+0x169/0x330
[   26.089219]  kunit_try_run_case+0x1b3/0x490
[   26.089491]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.090035]  kthread+0x257/0x310
[   26.090396]  ret_from_fork+0x41/0x80
[   26.090672]  ret_from_fork_asm+0x1a/0x30
[   26.091952] 
[   26.092205] The buggy address belongs to the object at ffff888101ab0500
[   26.092205]  which belongs to the cache kmalloc-32 of size 32
[   26.093900] The buggy address is located 0 bytes inside of
[   26.093900]  freed 32-byte region [ffff888101ab0500, ffff888101ab0520)
[   26.094658] 
[   26.094912] The buggy address belongs to the physical page:
[   26.095375] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ab0
[   26.096138] flags: 0x200000000000000(node=0|zone=2)
[   26.096485] page_type: f5(slab)
[   26.097326] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   26.098207] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   26.098773] page dumped because: kasan: bad access detected
[   26.099474] 
[   26.099756] Memory state around the buggy address:
[   26.100393]  ffff888101ab0400: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   26.101011]  ffff888101ab0480: 00 00 05 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   26.102070] >ffff888101ab0500: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   26.102759]                    ^
[   26.103093]  ffff888101ab0580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.103847]  ffff888101ab0600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.104518] ==================================================================