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

Environment
qemu-arm64
qemu-x86_64

[   31.872408] ==================================================================
[   31.873678] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x390/0x468
[   31.874807] Read of size 1 at addr fff00000c5917000 by task kunit_try_catch/202
[   31.875987] 
[   31.876591] CPU: 1 UID: 0 PID: 202 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   31.878053] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.878748] Hardware name: linux,dummy-virt (DT)
[   31.879439] Call trace:
[   31.879863]  show_stack+0x20/0x38 (C)
[   31.880839]  dump_stack_lvl+0x8c/0xd0
[   31.881473]  print_report+0x118/0x5e0
[   31.882200]  kasan_report+0xc8/0x118
[   31.882904]  __asan_report_load1_noabort+0x20/0x30
[   31.883992]  kmem_cache_rcu_uaf+0x390/0x468
[   31.884702]  kunit_try_run_case+0x14c/0x3d0
[   31.885515]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.886399]  kthread+0x24c/0x2d0
[   31.886953]  ret_from_fork+0x10/0x20
[   31.887832] 
[   31.888470] Allocated by task 202:
[   31.888986]  kasan_save_stack+0x3c/0x68
[   31.889559]  kasan_save_track+0x20/0x40
[   31.890159]  kasan_save_alloc_info+0x40/0x58
[   31.890768]  __kasan_slab_alloc+0xa8/0xb0
[   31.891887]  kmem_cache_alloc_noprof+0x108/0x398
[   31.892380]  kmem_cache_rcu_uaf+0x12c/0x468
[   31.893476]  kunit_try_run_case+0x14c/0x3d0
[   31.894269]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.895007]  kthread+0x24c/0x2d0
[   31.895641]  ret_from_fork+0x10/0x20
[   31.896622] 
[   31.897048] Freed by task 0:
[   31.897646]  kasan_save_stack+0x3c/0x68
[   31.898488]  kasan_save_track+0x20/0x40
[   31.899443]  kasan_save_free_info+0x4c/0x78
[   31.900094]  __kasan_slab_free+0x6c/0x98
[   31.900660]  slab_free_after_rcu_debug+0xd4/0x2f8
[   31.901279]  rcu_core+0x9f4/0x1e20
[   31.901944]  rcu_core_si+0x18/0x30
[   31.902748]  handle_softirqs+0x374/0xb20
[   31.903851]  __do_softirq+0x1c/0x28
[   31.904623] 
[   31.905072] Last potentially related work creation:
[   31.905894]  kasan_save_stack+0x3c/0x68
[   31.906637]  kasan_record_aux_stack+0xb4/0xc8
[   31.907475]  kmem_cache_free+0x28c/0x470
[   31.908364]  kmem_cache_rcu_uaf+0x16c/0x468
[   31.909172]  kunit_try_run_case+0x14c/0x3d0
[   31.909901]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.911356]  kthread+0x24c/0x2d0
[   31.911911]  ret_from_fork+0x10/0x20
[   31.912358] 
[   31.912742] The buggy address belongs to the object at fff00000c5917000
[   31.912742]  which belongs to the cache test_cache of size 200
[   31.914555] The buggy address is located 0 bytes inside of
[   31.914555]  freed 200-byte region [fff00000c5917000, fff00000c59170c8)
[   31.916440] 
[   31.917008] The buggy address belongs to the physical page:
[   31.917762] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105917
[   31.918744] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.919895] page_type: f5(slab)
[   31.920395] raw: 0bfffe0000000000 fff00000c56f9780 dead000000000122 0000000000000000
[   31.921416] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   31.922436] page dumped because: kasan: bad access detected
[   31.923090] 
[   31.923442] Memory state around the buggy address:
[   31.924449]  fff00000c5916f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.925435]  fff00000c5916f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.926283] >fff00000c5917000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   31.927522]                    ^
[   31.928026]  fff00000c5917080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   31.929105]  fff00000c5917100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.930012] ==================================================================

[   27.267020] ==================================================================
[   27.267678] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e5/0x510
[   27.268304] Read of size 1 at addr ffff888102a02000 by task kunit_try_catch/222
[   27.268915] 
[   27.269310] CPU: 1 UID: 0 PID: 222 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   27.270797] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.271621] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   27.272425] Call Trace:
[   27.272797]  <TASK>
[   27.273095]  dump_stack_lvl+0x73/0xb0
[   27.273690]  print_report+0xd1/0x640
[   27.274156]  ? __virt_addr_valid+0x1db/0x2d0
[   27.275110]  ? kasan_complete_mode_report_info+0x64/0x200
[   27.275732]  kasan_report+0x102/0x140
[   27.276018]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   27.276634]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   27.277223]  __asan_report_load1_noabort+0x18/0x20
[   27.278007]  kmem_cache_rcu_uaf+0x3e5/0x510
[   27.278523]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   27.279094]  ? finish_task_switch.isra.0+0x153/0x700
[   27.279583]  ? __switch_to+0x5d9/0xf60
[   27.279957]  ? __pfx_read_tsc+0x10/0x10
[   27.280451]  ? ktime_get_ts64+0x86/0x230
[   27.281171]  kunit_try_run_case+0x1b3/0x490
[   27.281719]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.282246]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   27.282809]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   27.283111]  ? __kthread_parkme+0x82/0x160
[   27.283359]  ? preempt_count_sub+0x50/0x80
[   27.283650]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.283975]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   27.284508]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.285092]  kthread+0x257/0x310
[   27.285494]  ? __pfx_kthread+0x10/0x10
[   27.285912]  ret_from_fork+0x41/0x80
[   27.286278]  ? __pfx_kthread+0x10/0x10
[   27.286579]  ret_from_fork_asm+0x1a/0x30
[   27.286913]  </TASK>
[   27.287197] 
[   27.287421] Allocated by task 222:
[   27.287816]  kasan_save_stack+0x3d/0x60
[   27.288216]  kasan_save_track+0x18/0x40
[   27.288644]  kasan_save_alloc_info+0x3b/0x50
[   27.289037]  __kasan_slab_alloc+0x91/0xa0
[   27.290734]  kmem_cache_alloc_noprof+0x11e/0x3e0
[   27.291264]  kmem_cache_rcu_uaf+0x156/0x510
[   27.291547]  kunit_try_run_case+0x1b3/0x490
[   27.291928]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.292436]  kthread+0x257/0x310
[   27.292736]  ret_from_fork+0x41/0x80
[   27.293964]  ret_from_fork_asm+0x1a/0x30
[   27.294433] 
[   27.294592] Freed by task 0:
[   27.294914]  kasan_save_stack+0x3d/0x60
[   27.295235]  kasan_save_track+0x18/0x40
[   27.295516]  kasan_save_free_info+0x3f/0x60
[   27.295895]  __kasan_slab_free+0x56/0x70
[   27.296361]  slab_free_after_rcu_debug+0xe4/0x310
[   27.296672]  rcu_core+0x680/0x1d70
[   27.296910]  rcu_core_si+0x12/0x20
[   27.297276]  handle_softirqs+0x209/0x720
[   27.297653]  __irq_exit_rcu+0xc9/0x110
[   27.298035]  irq_exit_rcu+0x12/0x20
[   27.299230]  sysvec_apic_timer_interrupt+0x81/0x90
[   27.299875]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   27.300378] 
[   27.300765] Last potentially related work creation:
[   27.301163]  kasan_save_stack+0x3d/0x60
[   27.301418]  kasan_record_aux_stack+0xb2/0xc0
[   27.302448]  kmem_cache_free+0x284/0x420
[   27.302832]  kmem_cache_rcu_uaf+0x195/0x510
[   27.303398]  kunit_try_run_case+0x1b3/0x490
[   27.303990]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.304421]  kthread+0x257/0x310
[   27.304865]  ret_from_fork+0x41/0x80
[   27.305276]  ret_from_fork_asm+0x1a/0x30
[   27.306267] 
[   27.306527] The buggy address belongs to the object at ffff888102a02000
[   27.306527]  which belongs to the cache test_cache of size 200
[   27.307282] The buggy address is located 0 bytes inside of
[   27.307282]  freed 200-byte region [ffff888102a02000, ffff888102a020c8)
[   27.308494] 
[   27.308789] The buggy address belongs to the physical page:
[   27.309279] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a02
[   27.310524] flags: 0x200000000000000(node=0|zone=2)
[   27.311007] page_type: f5(slab)
[   27.311357] raw: 0200000000000000 ffff888101e70500 dead000000000122 0000000000000000
[   27.311928] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   27.312597] page dumped because: kasan: bad access detected
[   27.313072] 
[   27.313279] Memory state around the buggy address:
[   27.313702]  ffff888102a01f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.314137]  ffff888102a01f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.314698] >ffff888102a02000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   27.316027]                    ^
[   27.316348]  ffff888102a02080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   27.316996]  ffff888102a02100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.317761] ==================================================================