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

Environment
qemu-arm64
qemu-x86_64

[   48.789753] ==================================================================
[   48.791213] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x64/0x70
[   48.791929] Read of size 4 at addr fff00000c615dc80 by task swapper/1/0
[   48.792669] 
[   48.792991] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Tainted: G    B            N 6.12.0-next-20241127 #1
[   48.794855] Tainted: [B]=BAD_PAGE, [N]=TEST
[   48.795473] Hardware name: linux,dummy-virt (DT)
[   48.796008] Call trace:
[   48.796425]  show_stack+0x20/0x38 (C)
[   48.796953]  dump_stack_lvl+0x8c/0xd0
[   48.797995]  print_report+0x118/0x5e0
[   48.798704]  kasan_report+0xc8/0x118
[   48.799417]  __asan_report_load4_noabort+0x20/0x30
[   48.800033]  rcu_uaf_reclaim+0x64/0x70
[   48.800616]  rcu_core+0x9f4/0x1e20
[   48.801334]  rcu_core_si+0x18/0x30
[   48.801839]  handle_softirqs+0x374/0xb20
[   48.802477]  __do_softirq+0x1c/0x28
[   48.803051]  ____do_softirq+0x18/0x30
[   48.803569]  call_on_irq_stack+0x24/0x58
[   48.804232]  do_softirq_own_stack+0x24/0x38
[   48.805364]  __irq_exit_rcu+0x1fc/0x318
[   48.805769]  irq_exit_rcu+0x1c/0x80
[   48.806148]  el1_interrupt+0x38/0x58
[   48.806563]  el1h_64_irq_handler+0x18/0x28
[   48.806974]  el1h_64_irq+0x6c/0x70
[   48.808911]  arch_local_irq_enable+0x4/0x8 (P)
[   48.809875]  default_idle_call+0x6c/0x78 (L)
[   48.811392]  do_idle+0x384/0x4e8
[   48.812109]  cpu_startup_entry+0x64/0x80
[   48.812873]  secondary_start_kernel+0x288/0x340
[   48.813649]  __secondary_switched+0xc0/0xc8
[   48.814382] 
[   48.814880] Allocated by task 187:
[   48.815731]  kasan_save_stack+0x3c/0x68
[   48.816285]  kasan_save_track+0x20/0x40
[   48.816990]  kasan_save_alloc_info+0x40/0x58
[   48.817780]  __kasan_kmalloc+0xd4/0xd8
[   48.818428]  __kmalloc_cache_noprof+0x15c/0x3c0
[   48.819273]  rcu_uaf+0xb0/0x2d0
[   48.819967]  kunit_try_run_case+0x14c/0x3d0
[   48.820825]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   48.821859]  kthread+0x24c/0x2d0
[   48.822537]  ret_from_fork+0x10/0x20
[   48.823194] 
[   48.823545] Freed by task 0:
[   48.823967]  kasan_save_stack+0x3c/0x68
[   48.824561]  kasan_save_track+0x20/0x40
[   48.825526]  kasan_save_free_info+0x4c/0x78
[   48.826159]  __kasan_slab_free+0x6c/0x98
[   48.826877]  kfree+0x114/0x3c8
[   48.827511]  rcu_uaf_reclaim+0x28/0x70
[   48.828166]  rcu_core+0x9f4/0x1e20
[   48.828817]  rcu_core_si+0x18/0x30
[   48.829664]  handle_softirqs+0x374/0xb20
[   48.830508]  __do_softirq+0x1c/0x28
[   48.831015] 
[   48.831348] Last potentially related work creation:
[   48.832180]  kasan_save_stack+0x3c/0x68
[   48.832975]  __kasan_record_aux_stack+0xbc/0xe8
[   48.833975]  kasan_record_aux_stack_noalloc+0x14/0x20
[   48.834838]  __call_rcu_common.constprop.0+0x74/0xa10
[   48.835695]  call_rcu+0x18/0x30
[   48.836178]  rcu_uaf+0x14c/0x2d0
[   48.836908]  kunit_try_run_case+0x14c/0x3d0
[   48.837780]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   48.838476]  kthread+0x24c/0x2d0
[   48.838985]  ret_from_fork+0x10/0x20
[   48.839580] 
[   48.839896] The buggy address belongs to the object at fff00000c615dc80
[   48.839896]  which belongs to the cache kmalloc-32 of size 32
[   48.841664] The buggy address is located 0 bytes inside of
[   48.841664]  freed 32-byte region [fff00000c615dc80, fff00000c615dca0)
[   48.843202] 
[   48.843497] The buggy address belongs to the physical page:
[   48.844216] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10615d
[   48.845174] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   48.845970] page_type: f5(slab)
[   48.846569] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   48.847803] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   48.848684] page dumped because: kasan: bad access detected
[   48.849662] 
[   48.849953] Memory state around the buggy address:
[   48.850634]  fff00000c615db80: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   48.851517]  fff00000c615dc00: 00 00 05 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   48.852453] >fff00000c615dc80: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   48.853216]                    ^
[   48.854419]  fff00000c615dd00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.855595]  fff00000c615dd80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.856405] ==================================================================

[   26.047359] ==================================================================
[   26.049063] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x50/0x60
[   26.049612] Read of size 4 at addr ffff888102a4c040 by task swapper/0/0
[   26.050507] 
[   26.051108] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Tainted: G    B            N 6.12.0-next-20241127 #1
[   26.052065] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.052543] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.053257] Call Trace:
[   26.053546]  <IRQ>
[   26.053892]  dump_stack_lvl+0x73/0xb0
[   26.054351]  print_report+0xd1/0x640
[   26.054718]  ? __virt_addr_valid+0x1db/0x2d0
[   26.055541]  ? kasan_complete_mode_report_info+0x64/0x200
[   26.056147]  kasan_report+0x102/0x140
[   26.056643]  ? rcu_uaf_reclaim+0x50/0x60
[   26.057388]  ? rcu_uaf_reclaim+0x50/0x60
[   26.057839]  __asan_report_load4_noabort+0x18/0x20
[   26.058218]  rcu_uaf_reclaim+0x50/0x60
[   26.058888]  rcu_core+0x680/0x1d70
[   26.059435]  ? __pfx_rcu_core+0x10/0x10
[   26.059627]  ? ktime_get+0x69/0x150
[   26.059801]  ? handle_softirqs+0x18e/0x720
[   26.060035]  rcu_core_si+0x12/0x20
[   26.060298]  handle_softirqs+0x209/0x720
[   26.060720]  ? hrtimer_interrupt+0x2fe/0x780
[   26.061115]  ? __pfx_handle_softirqs+0x10/0x10
[   26.061781]  __irq_exit_rcu+0xc9/0x110
[   26.062418]  irq_exit_rcu+0x12/0x20
[   26.062974]  sysvec_apic_timer_interrupt+0x81/0x90
[   26.063552]  </IRQ>
[   26.063798]  <TASK>
[   26.064073]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   26.064777] RIP: 0010:default_idle+0xf/0x20
[   26.065489] 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 f3 f5 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.067060] RSP: 0000:ffffffffbac07df0 EFLAGS: 00010202
[   26.067700] RAX: ffff88815b000000 RBX: ffffffffbac1a680 RCX: ffffffffb990b345
[   26.068406] RDX: ffffed102b606b23 RSI: 0000000000000004 RDI: 000000000003c3d4
[   26.069093] RBP: ffffffffbac07df8 R08: 0000000000000001 R09: ffffed102b606b22
[   26.069714] R10: ffff88815b035913 R11: 0000000000000000 R12: 0000000000000000
[   26.070402] R13: fffffbfff75834d0 R14: ffffffffbb772bd0 R15: 0000000000000000
[   26.071224]  ? ct_kernel_exit.constprop.0+0xa5/0xd0
[   26.071706]  ? arch_cpu_idle+0xd/0x20
[   26.072088]  default_idle_call+0x48/0x80
[   26.072547]  do_idle+0x310/0x3c0
[   26.072972]  ? __pfx_do_idle+0x10/0x10
[   26.073388]  ? schedule+0x75/0x310
[   26.073697]  ? trace_preempt_on+0x20/0xc0
[   26.074207]  ? schedule+0x86/0x310
[   26.074586]  ? preempt_count_sub+0x50/0x80
[   26.075107]  cpu_startup_entry+0x5c/0x70
[   26.075472]  rest_init+0x11a/0x140
[   26.075890]  ? acpi_subsystem_init+0x5d/0x150
[   26.076379]  start_kernel+0x320/0x400
[   26.076696]  x86_64_start_reservations+0x1c/0x30
[   26.077326]  x86_64_start_kernel+0xcf/0xe0
[   26.077802]  common_startup_64+0x12c/0x138
[   26.078231]  </TASK>
[   26.078559] 
[   26.078793] Allocated by task 206:
[   26.079163]  kasan_save_stack+0x3d/0x60
[   26.079443]  kasan_save_track+0x18/0x40
[   26.079910]  kasan_save_alloc_info+0x3b/0x50
[   26.080493]  __kasan_kmalloc+0xb7/0xc0
[   26.080807]  __kmalloc_cache_noprof+0x184/0x410
[   26.081389]  rcu_uaf+0xb1/0x330
[   26.081738]  kunit_try_run_case+0x1b3/0x490
[   26.082268]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.082703]  kthread+0x257/0x310
[   26.083054]  ret_from_fork+0x41/0x80
[   26.083496]  ret_from_fork_asm+0x1a/0x30
[   26.083836] 
[   26.084007] Freed by task 0:
[   26.084371]  kasan_save_stack+0x3d/0x60
[   26.084802]  kasan_save_track+0x18/0x40
[   26.085250]  kasan_save_free_info+0x3f/0x60
[   26.085546]  __kasan_slab_free+0x56/0x70
[   26.085851]  kfree+0x123/0x3f0
[   26.086328]  rcu_uaf_reclaim+0x1f/0x60
[   26.086809]  rcu_core+0x680/0x1d70
[   26.087220]  rcu_core_si+0x12/0x20
[   26.087477]  handle_softirqs+0x209/0x720
[   26.087915]  __irq_exit_rcu+0xc9/0x110
[   26.088412]  irq_exit_rcu+0x12/0x20
[   26.088832]  sysvec_apic_timer_interrupt+0x81/0x90
[   26.090577]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   26.091622] 
[   26.091869] Last potentially related work creation:
[   26.092718]  kasan_save_stack+0x3d/0x60
[   26.093375]  __kasan_record_aux_stack+0xae/0xc0
[   26.094037]  kasan_record_aux_stack_noalloc+0xf/0x20
[   26.094614]  __call_rcu_common.constprop.0+0x72/0xaa0
[   26.095482]  call_rcu+0x12/0x20
[   26.095798]  rcu_uaf+0x169/0x330
[   26.096355]  kunit_try_run_case+0x1b3/0x490
[   26.096864]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.097738]  kthread+0x257/0x310
[   26.098407]  ret_from_fork+0x41/0x80
[   26.098922]  ret_from_fork_asm+0x1a/0x30
[   26.099813] 
[   26.100105] The buggy address belongs to the object at ffff888102a4c040
[   26.100105]  which belongs to the cache kmalloc-32 of size 32
[   26.101324] The buggy address is located 0 bytes inside of
[   26.101324]  freed 32-byte region [ffff888102a4c040, ffff888102a4c060)
[   26.102897] 
[   26.103149] The buggy address belongs to the physical page:
[   26.103455] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a4c
[   26.104364] flags: 0x200000000000000(node=0|zone=2)
[   26.104791] page_type: f5(slab)
[   26.105587] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   26.106413] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   26.107252] page dumped because: kasan: bad access detected
[   26.107790] 
[   26.108061] Memory state around the buggy address:
[   26.108933]  ffff888102a4bf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.109757]  ffff888102a4bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.110613] >ffff888102a4c000: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   26.111478]                                            ^
[   26.112088]  ffff888102a4c080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.112804]  ffff888102a4c100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.113842] ==================================================================