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

Environment
qemu-arm64
qemu-x86_64

[   32.079186] ==================================================================
[   32.080236] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x64/0x70
[   32.081141] Read of size 4 at addr fff00000c66cf640 by task swapper/0/0
[   32.081874] 
[   32.082413] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Tainted: G    B            N 6.13.0-rc1-next-20241206 #1
[   32.083490] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.084631] Hardware name: linux,dummy-virt (DT)
[   32.085189] Call trace:
[   32.085737]  show_stack+0x20/0x38 (C)
[   32.086718]  dump_stack_lvl+0x8c/0xd0
[   32.087303]  print_report+0x118/0x5e0
[   32.087926]  kasan_report+0xc8/0x118
[   32.088656]  __asan_report_load4_noabort+0x20/0x30
[   32.089250]  rcu_uaf_reclaim+0x64/0x70
[   32.089900]  rcu_core+0x9f4/0x1e20
[   32.090477]  rcu_core_si+0x18/0x30
[   32.091205]  handle_softirqs+0x374/0xb20
[   32.092309]  __do_softirq+0x1c/0x28
[   32.092863]  ____do_softirq+0x18/0x30
[   32.093646]  call_on_irq_stack+0x24/0x58
[   32.094706]  do_softirq_own_stack+0x24/0x38
[   32.095312]  __irq_exit_rcu+0x1fc/0x318
[   32.096054]  irq_exit_rcu+0x1c/0x80
[   32.096648]  el1_interrupt+0x38/0x58
[   32.097364]  el1h_64_irq_handler+0x18/0x28
[   32.098081]  el1h_64_irq+0x6c/0x70
[   32.099341]  arch_local_irq_enable+0x4/0x8 (P)
[   32.100163]  default_idle_call+0x6c/0x78 (L)
[   32.100909]  do_idle+0x384/0x4e8
[   32.101459]  cpu_startup_entry+0x68/0x80
[   32.101780]  rest_init+0x160/0x188
[   32.102039]  start_kernel+0x308/0x3d0
[   32.103203]  __primary_switched+0x8c/0xa0
[   32.103975] 
[   32.104401] Allocated by task 187:
[   32.105046]  kasan_save_stack+0x3c/0x68
[   32.105673]  kasan_save_track+0x20/0x40
[   32.106594]  kasan_save_alloc_info+0x40/0x58
[   32.107268]  __kasan_kmalloc+0xd4/0xd8
[   32.107809]  __kmalloc_cache_noprof+0x15c/0x3c0
[   32.108496]  rcu_uaf+0xb0/0x2d0
[   32.109334]  kunit_try_run_case+0x14c/0x3d0
[   32.110083]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.110987]  kthread+0x24c/0x2d0
[   32.111252]  ret_from_fork+0x10/0x20
[   32.111502] 
[   32.112117] Freed by task 0:
[   32.112845]  kasan_save_stack+0x3c/0x68
[   32.113559]  kasan_save_track+0x20/0x40
[   32.114250]  kasan_save_free_info+0x4c/0x78
[   32.115111]  __kasan_slab_free+0x6c/0x98
[   32.116006]  kfree+0x114/0x3c8
[   32.117098]  rcu_uaf_reclaim+0x28/0x70
[   32.117707]  rcu_core+0x9f4/0x1e20
[   32.118255]  rcu_core_si+0x18/0x30
[   32.118840]  handle_softirqs+0x374/0xb20
[   32.119425]  __do_softirq+0x1c/0x28
[   32.120199] 
[   32.120387] Last potentially related work creation:
[   32.120699]  kasan_save_stack+0x3c/0x68
[   32.120968]  kasan_record_aux_stack+0xb4/0xc8
[   32.121246]  __call_rcu_common.constprop.0+0x74/0xa10
[   32.121613]  call_rcu+0x18/0x30
[   32.122685]  rcu_uaf+0x14c/0x2d0
[   32.123285]  kunit_try_run_case+0x14c/0x3d0
[   32.123971]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.125706]  kthread+0x24c/0x2d0
[   32.126598]  ret_from_fork+0x10/0x20
[   32.127154] 
[   32.127564] The buggy address belongs to the object at fff00000c66cf640
[   32.127564]  which belongs to the cache kmalloc-32 of size 32
[   32.128686] The buggy address is located 0 bytes inside of
[   32.128686]  freed 32-byte region [fff00000c66cf640, fff00000c66cf660)
[   32.129828] 
[   32.130198] The buggy address belongs to the physical page:
[   32.130954] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1066cf
[   32.132919] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   32.133719] page_type: f5(slab)
[   32.134274] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   32.135757] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   32.136358] page dumped because: kasan: bad access detected
[   32.137124] 
[   32.137477] Memory state around the buggy address:
[   32.138169]  fff00000c66cf500: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   32.139285]  fff00000c66cf580: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   32.140297] >fff00000c66cf600: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   32.141232]                                            ^
[   32.141992]  fff00000c66cf680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.143127]  fff00000c66cf700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.144036] ==================================================================

[   24.852098] ==================================================================
[   24.852667] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x50/0x60
[   24.853048] Read of size 4 at addr ffff8881024751c0 by task swapper/1/0
[   24.853973] 
[   24.854167] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Tainted: G    B            N 6.13.0-rc1-next-20241206 #1
[   24.854731] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.855032] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.856124] Call Trace:
[   24.856592]  <IRQ>
[   24.856807]  dump_stack_lvl+0x73/0xb0
[   24.857165]  print_report+0xd1/0x640
[   24.857682]  ? __virt_addr_valid+0x1db/0x2d0
[   24.858165]  ? kasan_complete_mode_report_info+0x64/0x200
[   24.858956]  kasan_report+0x102/0x140
[   24.859699]  ? rcu_uaf_reclaim+0x50/0x60
[   24.860413]  ? rcu_uaf_reclaim+0x50/0x60
[   24.860735]  __asan_report_load4_noabort+0x18/0x20
[   24.861467]  rcu_uaf_reclaim+0x50/0x60
[   24.862042]  rcu_core+0x680/0x1d70
[   24.862546]  ? __pfx_rcu_core+0x10/0x10
[   24.863005]  rcu_core_si+0x12/0x20
[   24.863379]  handle_softirqs+0x209/0x720
[   24.863855]  ? hrtimer_interrupt+0x2fe/0x780
[   24.864534]  ? __pfx_handle_softirqs+0x10/0x10
[   24.865018]  __irq_exit_rcu+0xc9/0x110
[   24.865491]  irq_exit_rcu+0x12/0x20
[   24.865878]  sysvec_apic_timer_interrupt+0x81/0x90
[   24.866573]  </IRQ>
[   24.866912]  <TASK>
[   24.867230]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   24.868034] RIP: 0010:default_idle+0xf/0x20
[   24.868843] 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 53 3b 13 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
[   24.870437] RSP: 0000:ffff888100877de0 EFLAGS: 00010216
[   24.870820] RAX: ffff88815b100000 RBX: ffff888100845000 RCX: ffffffffabb27165
[   24.871502] RDX: ffffed102b626b23 RSI: 0000000000000004 RDI: 000000000000e51c
[   24.872449] RBP: ffff888100877de8 R08: 0000000000000001 R09: ffffed102b626b22
[   24.872989] R10: ffff88815b135913 R11: 0000000000000000 R12: 0000000000000001
[   24.873679] R13: ffffed1020108a00 R14: ffffffffad781f90 R15: 0000000000000000
[   24.874586]  ? ct_kernel_exit.constprop.0+0xa5/0xd0
[   24.875224]  ? arch_cpu_idle+0xd/0x20
[   24.875582]  default_idle_call+0x48/0x80
[   24.875902]  do_idle+0x310/0x3c0
[   24.876401]  ? __pfx_do_idle+0x10/0x10
[   24.876758]  cpu_startup_entry+0x5c/0x70
[   24.877319]  start_secondary+0x216/0x290
[   24.877644]  ? __pfx_start_secondary+0x10/0x10
[   24.878282]  common_startup_64+0x12c/0x138
[   24.878641]  </TASK>
[   24.878958] 
[   24.879272] Allocated by task 206:
[   24.879611]  kasan_save_stack+0x3d/0x60
[   24.880054]  kasan_save_track+0x18/0x40
[   24.880554]  kasan_save_alloc_info+0x3b/0x50
[   24.880836]  __kasan_kmalloc+0xb7/0xc0
[   24.881383]  __kmalloc_cache_noprof+0x184/0x410
[   24.881825]  rcu_uaf+0xb1/0x330
[   24.882233]  kunit_try_run_case+0x1b3/0x490
[   24.882706]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.883237]  kthread+0x257/0x310
[   24.883496]  ret_from_fork+0x41/0x80
[   24.883735]  ret_from_fork_asm+0x1a/0x30
[   24.884310] 
[   24.884551] Freed by task 0:
[   24.884976]  kasan_save_stack+0x3d/0x60
[   24.885522]  kasan_save_track+0x18/0x40
[   24.885873]  kasan_save_free_info+0x3f/0x60
[   24.886446]  __kasan_slab_free+0x56/0x70
[   24.886826]  kfree+0x123/0x3f0
[   24.887157]  rcu_uaf_reclaim+0x1f/0x60
[   24.887429]  rcu_core+0x680/0x1d70
[   24.887725]  rcu_core_si+0x12/0x20
[   24.888281]  handle_softirqs+0x209/0x720
[   24.888747]  __irq_exit_rcu+0xc9/0x110
[   24.889322]  irq_exit_rcu+0x12/0x20
[   24.889604]  sysvec_apic_timer_interrupt+0x81/0x90
[   24.890228]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   24.890661] 
[   24.890975] Last potentially related work creation:
[   24.891390]  kasan_save_stack+0x3d/0x60
[   24.891711]  kasan_record_aux_stack+0xb2/0xc0
[   24.892037]  __call_rcu_common.constprop.0+0x72/0xaa0
[   24.892502]  call_rcu+0x12/0x20
[   24.892897]  rcu_uaf+0x169/0x330
[   24.893396]  kunit_try_run_case+0x1b3/0x490
[   24.893924]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.894466]  kthread+0x257/0x310
[   24.894729]  ret_from_fork+0x41/0x80
[   24.895047]  ret_from_fork_asm+0x1a/0x30
[   24.895647] 
[   24.895909] The buggy address belongs to the object at ffff8881024751c0
[   24.895909]  which belongs to the cache kmalloc-32 of size 32
[   24.896953] The buggy address is located 0 bytes inside of
[   24.896953]  freed 32-byte region [ffff8881024751c0, ffff8881024751e0)
[   24.897910] 
[   24.898247] The buggy address belongs to the physical page:
[   24.898816] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102475
[   24.899420] flags: 0x200000000000000(node=0|zone=2)
[   24.899807] page_type: f5(slab)
[   24.900282] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   24.901156] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   24.901745] page dumped because: kasan: bad access detected
[   24.903904] 
[   24.904229] Memory state around the buggy address:
[   24.904704]  ffff888102475080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   24.905269]  ffff888102475100: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   24.906060] >ffff888102475180: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   24.906686]                                            ^
[   24.907205]  ffff888102475200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.907871]  ffff888102475280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.908462] ==================================================================