Hay
Date
Dec. 3, 2024, 11:38 p.m.

Environment
qemu-arm64
qemu-x86_64

[   31.419576] ==================================================================
[   31.420642] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x64/0x70
[   31.421629] Read of size 4 at addr fff00000c58b0740 by task swapper/0/0
[   31.422737] 
[   31.423083] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   31.424899] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.425475] Hardware name: linux,dummy-virt (DT)
[   31.426175] Call trace:
[   31.426714]  show_stack+0x20/0x38 (C)
[   31.427493]  dump_stack_lvl+0x8c/0xd0
[   31.427800]  print_report+0x118/0x5e0
[   31.428092]  kasan_report+0xc8/0x118
[   31.428461]  __asan_report_load4_noabort+0x20/0x30
[   31.429578]  rcu_uaf_reclaim+0x64/0x70
[   31.430478]  rcu_core+0x9f4/0x1e20
[   31.431425]  rcu_core_si+0x18/0x30
[   31.432376]  handle_softirqs+0x374/0xb20
[   31.433237]  __do_softirq+0x1c/0x28
[   31.433772]  ____do_softirq+0x18/0x30
[   31.434313]  call_on_irq_stack+0x24/0x58
[   31.434941]  do_softirq_own_stack+0x24/0x38
[   31.435913]  __irq_exit_rcu+0x1fc/0x318
[   31.436788]  irq_exit_rcu+0x1c/0x80
[   31.437422]  el1_interrupt+0x38/0x58
[   31.438082]  el1h_64_irq_handler+0x18/0x28
[   31.438762]  el1h_64_irq+0x6c/0x70
[   31.439657]  arch_local_irq_enable+0x4/0x8 (P)
[   31.441147]  default_idle_call+0x6c/0x78 (L)
[   31.441849]  do_idle+0x384/0x4e8
[   31.442449]  cpu_startup_entry+0x64/0x80
[   31.443243]  rest_init+0x160/0x188
[   31.443833]  start_kernel+0x308/0x3d0
[   31.444143]  __primary_switched+0x8c/0xa0
[   31.444556] 
[   31.445001] Allocated by task 187:
[   31.445913]  kasan_save_stack+0x3c/0x68
[   31.446627]  kasan_save_track+0x20/0x40
[   31.447279]  kasan_save_alloc_info+0x40/0x58
[   31.448066]  __kasan_kmalloc+0xd4/0xd8
[   31.448620]  __kmalloc_cache_noprof+0x15c/0x3c0
[   31.449343]  rcu_uaf+0xb0/0x2d0
[   31.449849]  kunit_try_run_case+0x14c/0x3d0
[   31.450495]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.451475]  kthread+0x24c/0x2d0
[   31.451968]  ret_from_fork+0x10/0x20
[   31.452509] 
[   31.452827] Freed by task 0:
[   31.453278]  kasan_save_stack+0x3c/0x68
[   31.453983]  kasan_save_track+0x20/0x40
[   31.454626]  kasan_save_free_info+0x4c/0x78
[   31.455572]  __kasan_slab_free+0x6c/0x98
[   31.456205]  kfree+0x114/0x3c8
[   31.456704]  rcu_uaf_reclaim+0x28/0x70
[   31.457233]  rcu_core+0x9f4/0x1e20
[   31.457683]  rcu_core_si+0x18/0x30
[   31.458127]  handle_softirqs+0x374/0xb20
[   31.458841]  __do_softirq+0x1c/0x28
[   31.460548] 
[   31.460938] Last potentially related work creation:
[   31.461866]  kasan_save_stack+0x3c/0x68
[   31.462429]  kasan_record_aux_stack+0xb4/0xc8
[   31.463117]  __call_rcu_common.constprop.0+0x74/0xa10
[   31.463824]  call_rcu+0x18/0x30
[   31.464775]  rcu_uaf+0x14c/0x2d0
[   31.465320]  kunit_try_run_case+0x14c/0x3d0
[   31.465974]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.466762]  kthread+0x24c/0x2d0
[   31.467493]  ret_from_fork+0x10/0x20
[   31.468178] 
[   31.468565] The buggy address belongs to the object at fff00000c58b0740
[   31.468565]  which belongs to the cache kmalloc-32 of size 32
[   31.470017] The buggy address is located 0 bytes inside of
[   31.470017]  freed 32-byte region [fff00000c58b0740, fff00000c58b0760)
[   31.471721] 
[   31.472176] The buggy address belongs to the physical page:
[   31.472889] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1058b0
[   31.473954] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.474933] page_type: f5(slab)
[   31.475798] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   31.476763] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   31.477682] page dumped because: kasan: bad access detected
[   31.478404] 
[   31.478715] Memory state around the buggy address:
[   31.480012]  fff00000c58b0600: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.481034]  fff00000c58b0680: 00 00 00 fc fc fc fc fc 00 00 05 fc fc fc fc fc
[   31.481934] >fff00000c58b0700: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.483063]                                            ^
[   31.484390]  fff00000c58b0780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.485509]  fff00000c58b0800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.486379] ==================================================================

[   26.886918] ==================================================================
[   26.887687] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x50/0x60
[   26.888592] Read of size 4 at addr ffff888102984d40 by task swapper/0/0
[   26.889567] 
[   26.889813] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   26.891116] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.892106] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.892964] Call Trace:
[   26.893249]  <IRQ>
[   26.893458]  dump_stack_lvl+0x73/0xb0
[   26.894281]  print_report+0xd1/0x640
[   26.895118]  ? __virt_addr_valid+0x1db/0x2d0
[   26.895700]  ? kasan_complete_mode_report_info+0x64/0x200
[   26.896208]  kasan_report+0x102/0x140
[   26.896594]  ? rcu_uaf_reclaim+0x50/0x60
[   26.897201]  ? rcu_uaf_reclaim+0x50/0x60
[   26.897847]  __asan_report_load4_noabort+0x18/0x20
[   26.898324]  rcu_uaf_reclaim+0x50/0x60
[   26.898938]  rcu_core+0x680/0x1d70
[   26.899331]  ? __pfx_rcu_core+0x10/0x10
[   26.899883]  rcu_core_si+0x12/0x20
[   26.900129]  handle_softirqs+0x209/0x720
[   26.900367]  ? hrtimer_interrupt+0x2fe/0x780
[   26.900751]  ? __pfx_handle_softirqs+0x10/0x10
[   26.901241]  __irq_exit_rcu+0xc9/0x110
[   26.901572]  irq_exit_rcu+0x12/0x20
[   26.902004]  sysvec_apic_timer_interrupt+0x81/0x90
[   26.902561]  </IRQ>
[   26.903006]  <TASK>
[   26.903320]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   26.903976] RIP: 0010:default_idle+0xf/0x20
[   26.905318] 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 d3 99 35 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.906910] RSP: 0000:ffffffffb1e07df0 EFLAGS: 00010216
[   26.907653] RAX: ffff88815b000000 RBX: ffffffffb1e1a680 RCX: ffffffffb0b01165
[   26.908297] RDX: ffffed102b606b23 RSI: 0000000000000004 RDI: 000000000001da0c
[   26.908829] RBP: ffffffffb1e07df8 R08: 0000000000000001 R09: ffffed102b606b22
[   26.909542] R10: ffff88815b035913 R11: 0000000000000000 R12: 0000000000000000
[   26.910021] R13: fffffbfff63c34d0 R14: ffffffffb2974110 R15: 0000000000000000
[   26.911243]  ? ct_kernel_exit.constprop.0+0xa5/0xd0
[   26.911867]  ? arch_cpu_idle+0xd/0x20
[   26.912230]  default_idle_call+0x48/0x80
[   26.912608]  do_idle+0x310/0x3c0
[   26.913332]  ? __pfx_do_idle+0x10/0x10
[   26.913948]  ? rest_init+0x10b/0x140
[   26.914347]  cpu_startup_entry+0x5c/0x70
[   26.914929]  rest_init+0x11a/0x140
[   26.915344]  ? acpi_subsystem_init+0x5d/0x150
[   26.915952]  start_kernel+0x320/0x400
[   26.916484]  x86_64_start_reservations+0x1c/0x30
[   26.916882]  x86_64_start_kernel+0xcf/0xe0
[   26.917294]  common_startup_64+0x12c/0x138
[   26.917747]  </TASK>
[   26.918014] 
[   26.918921] Allocated by task 207:
[   26.919324]  kasan_save_stack+0x3d/0x60
[   26.919882]  kasan_save_track+0x18/0x40
[   26.920290]  kasan_save_alloc_info+0x3b/0x50
[   26.920951]  __kasan_kmalloc+0xb7/0xc0
[   26.921297]  __kmalloc_cache_noprof+0x184/0x410
[   26.921866]  rcu_uaf+0xb1/0x330
[   26.922874]  kunit_try_run_case+0x1b3/0x490
[   26.923351]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.923915]  kthread+0x257/0x310
[   26.924264]  ret_from_fork+0x41/0x80
[   26.924935]  ret_from_fork_asm+0x1a/0x30
[   26.925359] 
[   26.925555] Freed by task 0:
[   26.926125]  kasan_save_stack+0x3d/0x60
[   26.927074]  kasan_save_track+0x18/0x40
[   26.927538]  kasan_save_free_info+0x3f/0x60
[   26.928085]  __kasan_slab_free+0x56/0x70
[   26.928544]  kfree+0x123/0x3f0
[   26.929122]  rcu_uaf_reclaim+0x1f/0x60
[   26.929513]  rcu_core+0x680/0x1d70
[   26.930177]  rcu_core_si+0x12/0x20
[   26.930509]  handle_softirqs+0x209/0x720
[   26.931512]  __irq_exit_rcu+0xc9/0x110
[   26.931910]  irq_exit_rcu+0x12/0x20
[   26.932301]  sysvec_apic_timer_interrupt+0x81/0x90
[   26.932792]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   26.933293] 
[   26.933518] Last potentially related work creation:
[   26.934322]  kasan_save_stack+0x3d/0x60
[   26.934676]  kasan_record_aux_stack+0xb2/0xc0
[   26.935042]  __call_rcu_common.constprop.0+0x72/0xaa0
[   26.935984]  call_rcu+0x12/0x20
[   26.936384]  rcu_uaf+0x169/0x330
[   26.936632]  kunit_try_run_case+0x1b3/0x490
[   26.936901]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.937356]  kthread+0x257/0x310
[   26.937805]  ret_from_fork+0x41/0x80
[   26.938635]  ret_from_fork_asm+0x1a/0x30
[   26.939551] 
[   26.939863] The buggy address belongs to the object at ffff888102984d40
[   26.939863]  which belongs to the cache kmalloc-32 of size 32
[   26.941007] The buggy address is located 0 bytes inside of
[   26.941007]  freed 32-byte region [ffff888102984d40, ffff888102984d60)
[   26.942373] 
[   26.942559] The buggy address belongs to the physical page:
[   26.943141] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102984
[   26.943496] flags: 0x200000000000000(node=0|zone=2)
[   26.944767] page_type: f5(slab)
[   26.945329] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   26.946131] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   26.947013] page dumped because: kasan: bad access detected
[   26.947544] 
[   26.947807] Memory state around the buggy address:
[   26.948369]  ffff888102984c00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   26.949241]  ffff888102984c80: 00 00 00 fc fc fc fc fc 00 00 05 fc fc fc fc fc
[   26.949985] >ffff888102984d00: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   26.951150]                                            ^
[   26.951638]  ffff888102984d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.952704]  ffff888102984e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.953414] ==================================================================