Hay
Date
June 3, 2025, 7:38 a.m.

Environment
qemu-arm64
qemu-x86_64

[   19.529135] ==================================================================
[   19.529461] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x388/0x468
[   19.529586] Read of size 1 at addr fff00000c65d7000 by task kunit_try_catch/213
[   19.529640] 
[   19.529690] CPU: 1 UID: 0 PID: 213 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250603 #1 PREEMPT 
[   19.529787] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.529813] Hardware name: linux,dummy-virt (DT)
[   19.529874] Call trace:
[   19.529899]  show_stack+0x20/0x38 (C)
[   19.529969]  dump_stack_lvl+0x8c/0xd0
[   19.530030]  print_report+0x118/0x608
[   19.530098]  kasan_report+0xdc/0x128
[   19.530145]  __asan_report_load1_noabort+0x20/0x30
[   19.530194]  kmem_cache_rcu_uaf+0x388/0x468
[   19.530255]  kunit_try_run_case+0x170/0x3f0
[   19.530522]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.530612]  kthread+0x328/0x630
[   19.530658]  ret_from_fork+0x10/0x20
[   19.530730] 
[   19.530749] Allocated by task 213:
[   19.530781]  kasan_save_stack+0x3c/0x68
[   19.530838]  kasan_save_track+0x20/0x40
[   19.530883]  kasan_save_alloc_info+0x40/0x58
[   19.531100]  __kasan_slab_alloc+0xa8/0xb0
[   19.531179]  kmem_cache_alloc_noprof+0x10c/0x398
[   19.531239]  kmem_cache_rcu_uaf+0x12c/0x468
[   19.531285]  kunit_try_run_case+0x170/0x3f0
[   19.531338]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.531410]  kthread+0x328/0x630
[   19.531455]  ret_from_fork+0x10/0x20
[   19.531491] 
[   19.531509] Freed by task 0:
[   19.531810]  kasan_save_stack+0x3c/0x68
[   19.531885]  kasan_save_track+0x20/0x40
[   19.531933]  kasan_save_free_info+0x4c/0x78
[   19.532021]  __kasan_slab_free+0x6c/0x98
[   19.532057]  slab_free_after_rcu_debug+0xd4/0x2f8
[   19.532130]  rcu_core+0x9f4/0x1e20
[   19.532505]  rcu_core_si+0x18/0x30
[   19.532610]  handle_softirqs+0x374/0xb28
[   19.532678]  __do_softirq+0x1c/0x28
[   19.532735] 
[   19.532771] Last potentially related work creation:
[   19.532860]  kasan_save_stack+0x3c/0x68
[   19.532929]  kasan_record_aux_stack+0xb4/0xc8
[   19.533014]  kmem_cache_free+0x120/0x468
[   19.533103]  kmem_cache_rcu_uaf+0x16c/0x468
[   19.533180]  kunit_try_run_case+0x170/0x3f0
[   19.533253]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.533523]  kthread+0x328/0x630
[   19.533612]  ret_from_fork+0x10/0x20
[   19.533728] 
[   19.533800] The buggy address belongs to the object at fff00000c65d7000
[   19.533800]  which belongs to the cache test_cache of size 200
[   19.533938] The buggy address is located 0 bytes inside of
[   19.533938]  freed 200-byte region [fff00000c65d7000, fff00000c65d70c8)
[   19.534048] 
[   19.534091] The buggy address belongs to the physical page:
[   19.534124] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1065d7
[   19.534406] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.534509] page_type: f5(slab)
[   19.534562] raw: 0bfffe0000000000 fff00000c65c9140 dead000000000122 0000000000000000
[   19.534614] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   19.534656] page dumped because: kasan: bad access detected
[   19.534688] 
[   19.534717] Memory state around the buggy address:
[   19.534777]  fff00000c65d6f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   19.534836]  fff00000c65d6f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   19.534890] >fff00000c65d7000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   19.534946]                    ^
[   19.534976]  fff00000c65d7080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   19.535028]  fff00000c65d7100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.535097] ==================================================================


[   15.533056] ==================================================================
[   15.533722] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e3/0x510
[   15.533961] Read of size 1 at addr ffff8881033e6000 by task kunit_try_catch/230
[   15.534130] 
[   15.534602] CPU: 0 UID: 0 PID: 230 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250603 #1 PREEMPT(voluntary) 
[   15.534671] Tainted: [B]=BAD_PAGE, [N]=TEST
[   15.534686] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   15.534713] Call Trace:
[   15.534732]  <TASK>
[   15.534760]  dump_stack_lvl+0x73/0xb0
[   15.534799]  print_report+0xd1/0x650
[   15.534829]  ? __virt_addr_valid+0x1db/0x2d0
[   15.534858]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   15.534918]  ? kasan_complete_mode_report_info+0x64/0x200
[   15.534945]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   15.534971]  kasan_report+0x141/0x180
[   15.534997]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   15.535028]  __asan_report_load1_noabort+0x18/0x20
[   15.535051]  kmem_cache_rcu_uaf+0x3e3/0x510
[   15.535077]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   15.535102]  ? finish_task_switch.isra.0+0x153/0x700
[   15.535129]  ? __switch_to+0x47/0xf50
[   15.535162]  ? __pfx_read_tsc+0x10/0x10
[   15.535188]  ? ktime_get_ts64+0x86/0x230
[   15.535217]  kunit_try_run_case+0x1a5/0x480
[   15.535243]  ? __pfx_kunit_try_run_case+0x10/0x10
[   15.535265]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   15.535294]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   15.535321]  ? __kthread_parkme+0x82/0x180
[   15.535379]  ? preempt_count_sub+0x50/0x80
[   15.535412]  ? __pfx_kunit_try_run_case+0x10/0x10
[   15.535435]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   15.535476]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   15.535506]  kthread+0x337/0x6f0
[   15.535528]  ? trace_preempt_on+0x20/0xc0
[   15.535556]  ? __pfx_kthread+0x10/0x10
[   15.535610]  ? _raw_spin_unlock_irq+0x47/0x80
[   15.535635]  ? calculate_sigpending+0x7b/0xa0
[   15.535663]  ? __pfx_kthread+0x10/0x10
[   15.535687]  ret_from_fork+0x116/0x1d0
[   15.535708]  ? __pfx_kthread+0x10/0x10
[   15.535732]  ret_from_fork_asm+0x1a/0x30
[   15.535767]  </TASK>
[   15.535781] 
[   15.544363] Allocated by task 230:
[   15.545269]  kasan_save_stack+0x45/0x70
[   15.545524]  kasan_save_track+0x18/0x40
[   15.546178]  kasan_save_alloc_info+0x3b/0x50
[   15.546448]  __kasan_slab_alloc+0x91/0xa0
[   15.546696]  kmem_cache_alloc_noprof+0x123/0x3f0
[   15.546978]  kmem_cache_rcu_uaf+0x155/0x510
[   15.547237]  kunit_try_run_case+0x1a5/0x480
[   15.547515]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   15.547805]  kthread+0x337/0x6f0
[   15.548008]  ret_from_fork+0x116/0x1d0
[   15.548239]  ret_from_fork_asm+0x1a/0x30
[   15.548642] 
[   15.549269] Freed by task 0:
[   15.549372]  kasan_save_stack+0x45/0x70
[   15.549616]  kasan_save_track+0x18/0x40
[   15.549843]  kasan_save_free_info+0x3f/0x60
[   15.550291]  __kasan_slab_free+0x56/0x70
[   15.550730]  slab_free_after_rcu_debug+0xe4/0x310
[   15.551178]  rcu_core+0x66f/0x1c40
[   15.551453]  rcu_core_si+0x12/0x20
[   15.551697]  handle_softirqs+0x209/0x730
[   15.552654]  __irq_exit_rcu+0xc9/0x110
[   15.552968]  irq_exit_rcu+0x12/0x20
[   15.553383]  sysvec_apic_timer_interrupt+0x81/0x90
[   15.553844]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   15.554431] 
[   15.554689] Last potentially related work creation:
[   15.555043]  kasan_save_stack+0x45/0x70
[   15.555496]  kasan_record_aux_stack+0xb2/0xc0
[   15.555936]  kmem_cache_free+0x131/0x420
[   15.556362]  kmem_cache_rcu_uaf+0x194/0x510
[   15.556668]  kunit_try_run_case+0x1a5/0x480
[   15.557122]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   15.557414]  kthread+0x337/0x6f0
[   15.557659]  ret_from_fork+0x116/0x1d0
[   15.558220]  ret_from_fork_asm+0x1a/0x30
[   15.558675] 
[   15.558919] The buggy address belongs to the object at ffff8881033e6000
[   15.558919]  which belongs to the cache test_cache of size 200
[   15.559213] The buggy address is located 0 bytes inside of
[   15.559213]  freed 200-byte region [ffff8881033e6000, ffff8881033e60c8)
[   15.560212] 
[   15.560349] The buggy address belongs to the physical page:
[   15.560669] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1033e6
[   15.561009] flags: 0x200000000000000(node=0|zone=2)
[   15.561162] page_type: f5(slab)
[   15.561393] raw: 0200000000000000 ffff8881033e3000 dead000000000122 0000000000000000
[   15.562159] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   15.562671] page dumped because: kasan: bad access detected
[   15.563110] 
[   15.563520] Memory state around the buggy address:
[   15.563702]  ffff8881033e5f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.563903]  ffff8881033e5f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.564236] >ffff8881033e6000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   15.564510]                    ^
[   15.564771]  ffff8881033e6080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   15.565023]  ffff8881033e6100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.565273] ==================================================================