Hay
Date
June 17, 2025, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   18.111205] ==================================================================
[   18.111309] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x388/0x468
[   18.111395] Read of size 1 at addr fff00000c507c000 by task kunit_try_catch/222
[   18.111450] 
[   18.111496] CPU: 1 UID: 0 PID: 222 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250617 #1 PREEMPT 
[   18.111589] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.111617] Hardware name: linux,dummy-virt (DT)
[   18.111652] Call trace:
[   18.111679]  show_stack+0x20/0x38 (C)
[   18.111733]  dump_stack_lvl+0x8c/0xd0
[   18.111786]  print_report+0x118/0x608
[   18.111836]  kasan_report+0xdc/0x128
[   18.111883]  __asan_report_load1_noabort+0x20/0x30
[   18.111949]  kmem_cache_rcu_uaf+0x388/0x468
[   18.112000]  kunit_try_run_case+0x170/0x3f0
[   18.112054]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.112108]  kthread+0x328/0x630
[   18.112153]  ret_from_fork+0x10/0x20
[   18.112203] 
[   18.112222] Allocated by task 222:
[   18.112256]  kasan_save_stack+0x3c/0x68
[   18.112299]  kasan_save_track+0x20/0x40
[   18.112337]  kasan_save_alloc_info+0x40/0x58
[   18.112375]  __kasan_slab_alloc+0xa8/0xb0
[   18.112413]  kmem_cache_alloc_noprof+0x10c/0x398
[   18.112454]  kmem_cache_rcu_uaf+0x12c/0x468
[   18.112492]  kunit_try_run_case+0x170/0x3f0
[   18.112529]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.112573]  kthread+0x328/0x630
[   18.112606]  ret_from_fork+0x10/0x20
[   18.112642] 
[   18.112660] Freed by task 0:
[   18.112687]  kasan_save_stack+0x3c/0x68
[   18.112723]  kasan_save_track+0x20/0x40
[   18.112761]  kasan_save_free_info+0x4c/0x78
[   18.112796]  __kasan_slab_free+0x6c/0x98
[   18.112834]  slab_free_after_rcu_debug+0xd4/0x2f8
[   18.112874]  rcu_core+0x9f4/0x1e20
[   18.112913]  rcu_core_si+0x18/0x30
[   18.115987]  handle_softirqs+0x374/0xb28
[   18.116033]  __do_softirq+0x1c/0x28
[   18.116071] 
[   18.116092] Last potentially related work creation:
[   18.116120]  kasan_save_stack+0x3c/0x68
[   18.116160]  kasan_record_aux_stack+0xb4/0xc8
[   18.116198]  kmem_cache_free+0x120/0x468
[   18.116238]  kmem_cache_rcu_uaf+0x16c/0x468
[   18.116277]  kunit_try_run_case+0x170/0x3f0
[   18.116314]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.116358]  kthread+0x328/0x630
[   18.116391]  ret_from_fork+0x10/0x20
[   18.116427] 
[   18.116447] The buggy address belongs to the object at fff00000c507c000
[   18.116447]  which belongs to the cache test_cache of size 200
[   18.116510] The buggy address is located 0 bytes inside of
[   18.116510]  freed 200-byte region [fff00000c507c000, fff00000c507c0c8)
[   18.116574] 
[   18.116597] The buggy address belongs to the physical page:
[   18.116632] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10507c
[   18.116692] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.116745] page_type: f5(slab)
[   18.116788] raw: 0bfffe0000000000 fff00000c115d8c0 dead000000000122 0000000000000000
[   18.116840] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   18.116883] page dumped because: kasan: bad access detected
[   18.116916] 
[   18.116942] Memory state around the buggy address:
[   18.117021]  fff00000c507bf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.117102]  fff00000c507bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.117225] >fff00000c507c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   18.117283]                    ^
[   18.117331]  fff00000c507c080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   18.117375]  fff00000c507c100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.117427] ==================================================================

[   19.248575] ==================================================================
[   19.249277] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e3/0x510
[   19.250239] Read of size 1 at addr ffff88810383a000 by task kunit_try_catch/240
[   19.250972] 
[   19.251630] CPU: 1 UID: 0 PID: 240 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250617 #1 PREEMPT(voluntary) 
[   19.251761] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.251797] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   19.251936] Call Trace:
[   19.252037]  <TASK>
[   19.252089]  dump_stack_lvl+0x73/0xb0
[   19.252175]  print_report+0xd1/0x650
[   19.252389]  ? __virt_addr_valid+0x1db/0x2d0
[   19.252465]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   19.252503]  ? kasan_complete_mode_report_info+0x64/0x200
[   19.252536]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   19.252569]  kasan_report+0x141/0x180
[   19.252600]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   19.252640]  __asan_report_load1_noabort+0x18/0x20
[   19.252677]  kmem_cache_rcu_uaf+0x3e3/0x510
[   19.252711]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   19.252742]  ? finish_task_switch.isra.0+0x153/0x700
[   19.252773]  ? __switch_to+0x47/0xf50
[   19.252811]  ? __pfx_read_tsc+0x10/0x10
[   19.252869]  ? ktime_get_ts64+0x86/0x230
[   19.252905]  kunit_try_run_case+0x1a5/0x480
[   19.252942]  ? __pfx_kunit_try_run_case+0x10/0x10
[   19.252973]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   19.253002]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   19.253038]  ? __kthread_parkme+0x82/0x180
[   19.253067]  ? preempt_count_sub+0x50/0x80
[   19.253098]  ? __pfx_kunit_try_run_case+0x10/0x10
[   19.253131]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.253164]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   19.253196]  kthread+0x337/0x6f0
[   19.253284]  ? trace_preempt_on+0x20/0xc0
[   19.253359]  ? __pfx_kthread+0x10/0x10
[   19.253390]  ? _raw_spin_unlock_irq+0x47/0x80
[   19.253423]  ? calculate_sigpending+0x7b/0xa0
[   19.253458]  ? __pfx_kthread+0x10/0x10
[   19.253486]  ret_from_fork+0x116/0x1d0
[   19.253512]  ? __pfx_kthread+0x10/0x10
[   19.253540]  ret_from_fork_asm+0x1a/0x30
[   19.253581]  </TASK>
[   19.253597] 
[   19.270212] Allocated by task 240:
[   19.270736]  kasan_save_stack+0x45/0x70
[   19.271193]  kasan_save_track+0x18/0x40
[   19.271721]  kasan_save_alloc_info+0x3b/0x50
[   19.272178]  __kasan_slab_alloc+0x91/0xa0
[   19.272763]  kmem_cache_alloc_noprof+0x123/0x3f0
[   19.273143]  kmem_cache_rcu_uaf+0x155/0x510
[   19.273915]  kunit_try_run_case+0x1a5/0x480
[   19.274390]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.275027]  kthread+0x337/0x6f0
[   19.275569]  ret_from_fork+0x116/0x1d0
[   19.275935]  ret_from_fork_asm+0x1a/0x30
[   19.276503] 
[   19.276729] Freed by task 0:
[   19.277042]  kasan_save_stack+0x45/0x70
[   19.277493]  kasan_save_track+0x18/0x40
[   19.278108]  kasan_save_free_info+0x3f/0x60
[   19.278707]  __kasan_slab_free+0x56/0x70
[   19.279124]  slab_free_after_rcu_debug+0xe4/0x310
[   19.279768]  rcu_core+0x66f/0x1c40
[   19.280189]  rcu_core_si+0x12/0x20
[   19.280665]  handle_softirqs+0x209/0x730
[   19.280976]  __irq_exit_rcu+0xc9/0x110
[   19.281523]  irq_exit_rcu+0x12/0x20
[   19.282158]  sysvec_apic_timer_interrupt+0x81/0x90
[   19.282748]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   19.283190] 
[   19.283566] Last potentially related work creation:
[   19.284057]  kasan_save_stack+0x45/0x70
[   19.284578]  kasan_record_aux_stack+0xb2/0xc0
[   19.285010]  kmem_cache_free+0x131/0x420
[   19.285492]  kmem_cache_rcu_uaf+0x194/0x510
[   19.285908]  kunit_try_run_case+0x1a5/0x480
[   19.286639]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.287094]  kthread+0x337/0x6f0
[   19.287651]  ret_from_fork+0x116/0x1d0
[   19.287970]  ret_from_fork_asm+0x1a/0x30
[   19.288545] 
[   19.288749] The buggy address belongs to the object at ffff88810383a000
[   19.288749]  which belongs to the cache test_cache of size 200
[   19.289799] The buggy address is located 0 bytes inside of
[   19.289799]  freed 200-byte region [ffff88810383a000, ffff88810383a0c8)
[   19.291172] 
[   19.291545] The buggy address belongs to the physical page:
[   19.291989] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10383a
[   19.292779] flags: 0x200000000000000(node=0|zone=2)
[   19.293371] page_type: f5(slab)
[   19.293738] raw: 0200000000000000 ffff888101db3780 dead000000000122 0000000000000000
[   19.294612] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   19.295313] page dumped because: kasan: bad access detected
[   19.295761] 
[   19.295975] Memory state around the buggy address:
[   19.296340]  ffff888103839f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.297189]  ffff888103839f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.297878] >ffff88810383a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   19.298794]                    ^
[   19.299105]  ffff88810383a080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   19.299818]  ffff88810383a100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.300524] ==================================================================