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

Environment
qemu-arm64
qemu-x86_64

[   31.027778] ==================================================================
[   31.028927] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x64/0x70
[   31.029504] Read of size 4 at addr fff00000c63c1600 by task swapper/0/0
[   31.030921] 
[   31.031258] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Tainted: G    B            N 6.13.0-rc1-next-20241205 #1
[   31.032793] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.033566] Hardware name: linux,dummy-virt (DT)
[   31.034145] Call trace:
[   31.034696]  show_stack+0x20/0x38 (C)
[   31.035236]  dump_stack_lvl+0x8c/0xd0
[   31.035901]  print_report+0x118/0x5e0
[   31.036434]  kasan_report+0xc8/0x118
[   31.037263]  __asan_report_load4_noabort+0x20/0x30
[   31.037895]  rcu_uaf_reclaim+0x64/0x70
[   31.038546]  rcu_core+0x9f4/0x1e20
[   31.039253]  rcu_core_si+0x18/0x30
[   31.039793]  handle_softirqs+0x374/0xb20
[   31.040430]  __do_softirq+0x1c/0x28
[   31.040998]  ____do_softirq+0x18/0x30
[   31.041598]  call_on_irq_stack+0x24/0x58
[   31.042332]  do_softirq_own_stack+0x24/0x38
[   31.042955]  __irq_exit_rcu+0x1fc/0x318
[   31.043765]  irq_exit_rcu+0x1c/0x80
[   31.044721]  el1_interrupt+0x38/0x58
[   31.045339]  el1h_64_irq_handler+0x18/0x28
[   31.045975]  el1h_64_irq+0x6c/0x70
[   31.046690]  arch_local_irq_enable+0x4/0x8 (P)
[   31.047827]  default_idle_call+0x6c/0x78 (L)
[   31.048586]  do_idle+0x384/0x4e8
[   31.049067]  cpu_startup_entry+0x64/0x80
[   31.049746]  rest_init+0x160/0x188
[   31.050400]  start_kernel+0x308/0x3d0
[   31.050952]  __primary_switched+0x8c/0xa0
[   31.051923] 
[   31.052268] Allocated by task 187:
[   31.053333]  kasan_save_stack+0x3c/0x68
[   31.053952]  kasan_save_track+0x20/0x40
[   31.054717]  kasan_save_alloc_info+0x40/0x58
[   31.055813]  __kasan_kmalloc+0xd4/0xd8
[   31.057072]  __kmalloc_cache_noprof+0x15c/0x3c0
[   31.058115]  rcu_uaf+0xb0/0x2d0
[   31.058894]  kunit_try_run_case+0x14c/0x3d0
[   31.060020]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.060663]  kthread+0x24c/0x2d0
[   31.061146]  ret_from_fork+0x10/0x20
[   31.061672] 
[   31.062026] Freed by task 0:
[   31.062540]  kasan_save_stack+0x3c/0x68
[   31.063060]  kasan_save_track+0x20/0x40
[   31.063718]  kasan_save_free_info+0x4c/0x78
[   31.064795]  __kasan_slab_free+0x6c/0x98
[   31.065553]  kfree+0x114/0x3c8
[   31.066012]  rcu_uaf_reclaim+0x28/0x70
[   31.066751]  rcu_core+0x9f4/0x1e20
[   31.067222]  rcu_core_si+0x18/0x30
[   31.067837]  handle_softirqs+0x374/0xb20
[   31.068453]  __do_softirq+0x1c/0x28
[   31.069349] 
[   31.069709] Last potentially related work creation:
[   31.070343]  kasan_save_stack+0x3c/0x68
[   31.070956]  kasan_record_aux_stack+0xb4/0xc8
[   31.072080]  __call_rcu_common.constprop.0+0x74/0xa10
[   31.073102]  call_rcu+0x18/0x30
[   31.073547]  rcu_uaf+0x14c/0x2d0
[   31.074097]  kunit_try_run_case+0x14c/0x3d0
[   31.074699]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.075783]  kthread+0x24c/0x2d0
[   31.076290]  ret_from_fork+0x10/0x20
[   31.076848] 
[   31.077181] The buggy address belongs to the object at fff00000c63c1600
[   31.077181]  which belongs to the cache kmalloc-32 of size 32
[   31.078608] The buggy address is located 0 bytes inside of
[   31.078608]  freed 32-byte region [fff00000c63c1600, fff00000c63c1620)
[   31.080399] 
[   31.080742] The buggy address belongs to the physical page:
[   31.081573] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1063c1
[   31.082570] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.083352] page_type: f5(slab)
[   31.084355] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   31.085340] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   31.086240] page dumped because: kasan: bad access detected
[   31.086867] 
[   31.087245] Memory state around the buggy address:
[   31.087913]  fff00000c63c1500: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   31.088660]  fff00000c63c1580: 00 00 05 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   31.090203] >fff00000c63c1600: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   31.091287]                    ^
[   31.092250]  fff00000c63c1680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.093309]  fff00000c63c1700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.094352] ==================================================================

[   28.881177] ==================================================================
[   28.882543] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x50/0x60
[   28.883441] Read of size 4 at addr ffff888101ab1a80 by task swapper/0/0
[   28.884479] 
[   28.884666] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Tainted: G    B            N 6.13.0-rc1-next-20241205 #1
[   28.885538] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.886033] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.887123] Call Trace:
[   28.887380]  <IRQ>
[   28.887730]  dump_stack_lvl+0x73/0xb0
[   28.888458]  print_report+0xd1/0x640
[   28.888811]  ? __virt_addr_valid+0x1db/0x2d0
[   28.889437]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.890017]  kasan_report+0x102/0x140
[   28.890383]  ? rcu_uaf_reclaim+0x50/0x60
[   28.890964]  ? rcu_uaf_reclaim+0x50/0x60
[   28.891426]  __asan_report_load4_noabort+0x18/0x20
[   28.892087]  rcu_uaf_reclaim+0x50/0x60
[   28.892497]  rcu_core+0x680/0x1d70
[   28.893357]  ? __pfx_rcu_core+0x10/0x10
[   28.893700]  rcu_core_si+0x12/0x20
[   28.894804]  handle_softirqs+0x209/0x720
[   28.895524]  ? hrtimer_interrupt+0x2fe/0x780
[   28.896091]  ? __pfx_handle_softirqs+0x10/0x10
[   28.896449]  __irq_exit_rcu+0xc9/0x110
[   28.897240]  irq_exit_rcu+0x12/0x20
[   28.897843]  sysvec_apic_timer_interrupt+0x81/0x90
[   28.898431]  </IRQ>
[   28.898677]  <TASK>
[   28.898945]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   28.899925] RIP: 0010:default_idle+0xf/0x20
[   28.900522] 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 59 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
[   28.902480] RSP: 0000:ffffffff8e807df0 EFLAGS: 00010206
[   28.903630] RAX: ffff88815b000000 RBX: ffffffff8e81a680 RCX: ffffffff8d505165
[   28.904379] RDX: ffffed102b606b23 RSI: 0000000000000004 RDI: 0000000000072594
[   28.905558] RBP: ffffffff8e807df8 R08: 0000000000000001 R09: ffffed102b606b22
[   28.906361] R10: ffff88815b035913 R11: 0000000000000000 R12: 0000000000000000
[   28.907300] R13: fffffbfff1d034d0 R14: ffffffff8f374a90 R15: 0000000000000000
[   28.908281]  ? ct_kernel_exit.constprop.0+0xa5/0xd0
[   28.908730]  ? arch_cpu_idle+0xd/0x20
[   28.909509]  default_idle_call+0x48/0x80
[   28.909976]  do_idle+0x310/0x3c0
[   28.910881]  ? __pfx_do_idle+0x10/0x10
[   28.911666]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.912343]  ? trace_preempt_on+0x20/0xc0
[   28.913090]  ? schedule+0x86/0x310
[   28.913527]  ? preempt_count_sub+0x50/0x80
[   28.913791]  cpu_startup_entry+0x5c/0x70
[   28.914662]  rest_init+0x11a/0x140
[   28.915093]  ? acpi_subsystem_init+0x5d/0x150
[   28.915571]  start_kernel+0x320/0x400
[   28.916458]  x86_64_start_reservations+0x1c/0x30
[   28.916973]  x86_64_start_kernel+0xcf/0xe0
[   28.917852]  common_startup_64+0x12c/0x138
[   28.918539]  </TASK>
[   28.918998] 
[   28.919190] Allocated by task 205:
[   28.919746]  kasan_save_stack+0x3d/0x60
[   28.920382]  kasan_save_track+0x18/0x40
[   28.920961]  kasan_save_alloc_info+0x3b/0x50
[   28.921419]  __kasan_kmalloc+0xb7/0xc0
[   28.922494]  __kmalloc_cache_noprof+0x184/0x410
[   28.922925]  rcu_uaf+0xb1/0x330
[   28.923229]  kunit_try_run_case+0x1b3/0x490
[   28.923917]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.924585]  kthread+0x257/0x310
[   28.925243]  ret_from_fork+0x41/0x80
[   28.925954]  ret_from_fork_asm+0x1a/0x30
[   28.926592] 
[   28.927246] Freed by task 0:
[   28.927922]  kasan_save_stack+0x3d/0x60
[   28.928573]  kasan_save_track+0x18/0x40
[   28.929179]  kasan_save_free_info+0x3f/0x60
[   28.929945]  __kasan_slab_free+0x56/0x70
[   28.930828]  kfree+0x123/0x3f0
[   28.931391]  rcu_uaf_reclaim+0x1f/0x60
[   28.932157]  rcu_core+0x680/0x1d70
[   28.932535]  rcu_core_si+0x12/0x20
[   28.933262]  handle_softirqs+0x209/0x720
[   28.933526]  __irq_exit_rcu+0xc9/0x110
[   28.934439]  irq_exit_rcu+0x12/0x20
[   28.934893]  sysvec_apic_timer_interrupt+0x81/0x90
[   28.935317]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   28.936187] 
[   28.936472] Last potentially related work creation:
[   28.937045]  kasan_save_stack+0x3d/0x60
[   28.937899]  kasan_record_aux_stack+0xb2/0xc0
[   28.938841]  __call_rcu_common.constprop.0+0x72/0xaa0
[   28.939208]  call_rcu+0x12/0x20
[   28.939912]  rcu_uaf+0x169/0x330
[   28.940759]  kunit_try_run_case+0x1b3/0x490
[   28.941297]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.941824]  kthread+0x257/0x310
[   28.942439]  ret_from_fork+0x41/0x80
[   28.942951]  ret_from_fork_asm+0x1a/0x30
[   28.943610] 
[   28.944222] The buggy address belongs to the object at ffff888101ab1a80
[   28.944222]  which belongs to the cache kmalloc-32 of size 32
[   28.945485] The buggy address is located 0 bytes inside of
[   28.945485]  freed 32-byte region [ffff888101ab1a80, ffff888101ab1aa0)
[   28.946527] 
[   28.947236] The buggy address belongs to the physical page:
[   28.947596] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ab1
[   28.948645] flags: 0x200000000000000(node=0|zone=2)
[   28.949353] page_type: f5(slab)
[   28.949652] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.950848] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   28.951672] page dumped because: kasan: bad access detected
[   28.952299] 
[   28.952512] Memory state around the buggy address:
[   28.953126]  ffff888101ab1980: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   28.953890]  ffff888101ab1a00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   28.954866] >ffff888101ab1a80: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   28.955457]                    ^
[   28.955930]  ffff888101ab1b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.957385]  ffff888101ab1b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.957993] ==================================================================