Hay
Date
May 12, 2025, 11:48 a.m.

Environment
qemu-arm64
qemu-x86_64

[   18.051207] ==================================================================
[   18.051382] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x388/0x468
[   18.051697] Read of size 1 at addr fff00000c794e000 by task kunit_try_catch/213
[   18.051875] 
[   18.051990] CPU: 1 UID: 0 PID: 213 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT 
[   18.052195] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.052255] Hardware name: linux,dummy-virt (DT)
[   18.052423] Call trace:
[   18.052482]  show_stack+0x20/0x38 (C)
[   18.052592]  dump_stack_lvl+0x8c/0xd0
[   18.052704]  print_report+0x118/0x608
[   18.052809]  kasan_report+0xdc/0x128
[   18.052909]  __asan_report_load1_noabort+0x20/0x30
[   18.053024]  kmem_cache_rcu_uaf+0x388/0x468
[   18.053125]  kunit_try_run_case+0x170/0x3f0
[   18.053228]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.053340]  kthread+0x328/0x630
[   18.053436]  ret_from_fork+0x10/0x20
[   18.053540] 
[   18.053581] Allocated by task 213:
[   18.053647]  kasan_save_stack+0x3c/0x68
[   18.053730]  kasan_save_track+0x20/0x40
[   18.053811]  kasan_save_alloc_info+0x40/0x58
[   18.053885]  __kasan_slab_alloc+0xa8/0xb0
[   18.054547]  kmem_cache_alloc_noprof+0x10c/0x3a0
[   18.054716]  kmem_cache_rcu_uaf+0x12c/0x468
[   18.054807]  kunit_try_run_case+0x170/0x3f0
[   18.055050]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.055166]  kthread+0x328/0x630
[   18.055228]  ret_from_fork+0x10/0x20
[   18.055490] 
[   18.055858] Freed by task 0:
[   18.055934]  kasan_save_stack+0x3c/0x68
[   18.056198]  kasan_save_track+0x20/0x40
[   18.056315]  kasan_save_free_info+0x4c/0x78
[   18.056416]  __kasan_slab_free+0x6c/0x98
[   18.056495]  slab_free_after_rcu_debug+0xd4/0x2f8
[   18.056579]  rcu_core+0x9f4/0x1e20
[   18.057034]  rcu_core_si+0x18/0x30
[   18.057516]  handle_softirqs+0x374/0xb28
[   18.057707]  __do_softirq+0x1c/0x28
[   18.057951] 
[   18.058092] Last potentially related work creation:
[   18.058187]  kasan_save_stack+0x3c/0x68
[   18.058401]  kasan_record_aux_stack+0xb4/0xc8
[   18.058536]  kmem_cache_free+0x120/0x470
[   18.058621]  kmem_cache_rcu_uaf+0x16c/0x468
[   18.058692]  kunit_try_run_case+0x170/0x3f0
[   18.058764]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.059201]  kthread+0x328/0x630
[   18.059688]  ret_from_fork+0x10/0x20
[   18.059766] 
[   18.059981] The buggy address belongs to the object at fff00000c794e000
[   18.059981]  which belongs to the cache test_cache of size 200
[   18.060322] The buggy address is located 0 bytes inside of
[   18.060322]  freed 200-byte region [fff00000c794e000, fff00000c794e0c8)
[   18.060846] 
[   18.060956] The buggy address belongs to the physical page:
[   18.061159] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10794e
[   18.061880] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.062226] page_type: f5(slab)
[   18.062611] raw: 0bfffe0000000000 fff00000c1096b40 dead000000000122 0000000000000000
[   18.063248] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   18.063767] page dumped because: kasan: bad access detected
[   18.063953] 
[   18.063996] Memory state around the buggy address:
[   18.064198]  fff00000c794df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.064454]  fff00000c794df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.064900] >fff00000c794e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   18.065376]                    ^
[   18.065493]  fff00000c794e080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   18.065606]  fff00000c794e100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.066124] ==================================================================

[   17.653831] ==================================================================
[   17.654907] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e3/0x510
[   17.655411] Read of size 1 at addr ffff88810231d000 by task kunit_try_catch/230
[   17.655597] 
[   17.655691] CPU: 0 UID: 0 PID: 230 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT(voluntary) 
[   17.655751] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.655764] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   17.655791] Call Trace:
[   17.655809]  <TASK>
[   17.655833]  dump_stack_lvl+0x73/0xb0
[   17.655868]  print_report+0xd1/0x650
[   17.655892]  ? __virt_addr_valid+0x1db/0x2d0
[   17.655921]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   17.655946]  ? kasan_complete_mode_report_info+0x64/0x200
[   17.655969]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   17.655994]  kasan_report+0x141/0x180
[   17.656018]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   17.656047]  __asan_report_load1_noabort+0x18/0x20
[   17.656069]  kmem_cache_rcu_uaf+0x3e3/0x510
[   17.656093]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   17.656118]  ? finish_task_switch.isra.0+0x153/0x700
[   17.656143]  ? __switch_to+0x47/0xf50
[   17.656173]  ? __pfx_read_tsc+0x10/0x10
[   17.656196]  ? ktime_get_ts64+0x86/0x230
[   17.656222]  kunit_try_run_case+0x1a5/0x480
[   17.656250]  ? __pfx_kunit_try_run_case+0x10/0x10
[   17.656883]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   17.656920]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   17.656945]  ? __kthread_parkme+0x82/0x180
[   17.656969]  ? preempt_count_sub+0x50/0x80
[   17.656993]  ? __pfx_kunit_try_run_case+0x10/0x10
[   17.657017]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.657062]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   17.657088]  kthread+0x337/0x6f0
[   17.657110]  ? trace_preempt_on+0x20/0xc0
[   17.657136]  ? __pfx_kthread+0x10/0x10
[   17.657158]  ? _raw_spin_unlock_irq+0x47/0x80
[   17.657178]  ? calculate_sigpending+0x7b/0xa0
[   17.657340]  ? __pfx_kthread+0x10/0x10
[   17.657369]  ret_from_fork+0x116/0x1d0
[   17.657392]  ? __pfx_kthread+0x10/0x10
[   17.657414]  ret_from_fork_asm+0x1a/0x30
[   17.657446]  </TASK>
[   17.657460] 
[   17.666358] Allocated by task 230:
[   17.666916]  kasan_save_stack+0x45/0x70
[   17.667105]  kasan_save_track+0x18/0x40
[   17.667410]  kasan_save_alloc_info+0x3b/0x50
[   17.667674]  __kasan_slab_alloc+0x91/0xa0
[   17.667875]  kmem_cache_alloc_noprof+0x123/0x3f0
[   17.668170]  kmem_cache_rcu_uaf+0x155/0x510
[   17.668449]  kunit_try_run_case+0x1a5/0x480
[   17.668685]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.668886]  kthread+0x337/0x6f0
[   17.669004]  ret_from_fork+0x116/0x1d0
[   17.669284]  ret_from_fork_asm+0x1a/0x30
[   17.669463] 
[   17.669522] Freed by task 0:
[   17.669634]  kasan_save_stack+0x45/0x70
[   17.669957]  kasan_save_track+0x18/0x40
[   17.670131]  kasan_save_free_info+0x3f/0x60
[   17.670284]  __kasan_slab_free+0x56/0x70
[   17.670386]  slab_free_after_rcu_debug+0xe4/0x310
[   17.670756]  rcu_core+0x66f/0x1c40
[   17.670993]  rcu_core_si+0x12/0x20
[   17.671093]  handle_softirqs+0x209/0x730
[   17.671191]  __irq_exit_rcu+0xc9/0x110
[   17.671296]  irq_exit_rcu+0x12/0x20
[   17.671390]  sysvec_apic_timer_interrupt+0x81/0x90
[   17.671829]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   17.672205] 
[   17.672358] Last potentially related work creation:
[   17.672593]  kasan_save_stack+0x45/0x70
[   17.672688]  kasan_record_aux_stack+0xb2/0xc0
[   17.672792]  kmem_cache_free+0x131/0x420
[   17.672996]  kmem_cache_rcu_uaf+0x194/0x510
[   17.673466]  kunit_try_run_case+0x1a5/0x480
[   17.673902]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.674283]  kthread+0x337/0x6f0
[   17.674513]  ret_from_fork+0x116/0x1d0
[   17.675135]  ret_from_fork_asm+0x1a/0x30
[   17.675641] 
[   17.675965] The buggy address belongs to the object at ffff88810231d000
[   17.675965]  which belongs to the cache test_cache of size 200
[   17.676695] The buggy address is located 0 bytes inside of
[   17.676695]  freed 200-byte region [ffff88810231d000, ffff88810231d0c8)
[   17.677618] 
[   17.677928] The buggy address belongs to the physical page:
[   17.678379] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10231d
[   17.678730] flags: 0x200000000000000(node=0|zone=2)
[   17.678871] page_type: f5(slab)
[   17.679115] raw: 0200000000000000 ffff8881009f8b40 dead000000000122 0000000000000000
[   17.679586] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   17.679890] page dumped because: kasan: bad access detected
[   17.680126] 
[   17.680216] Memory state around the buggy address:
[   17.680450]  ffff88810231cf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.681085]  ffff88810231cf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.681469] >ffff88810231d000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   17.681780]                    ^
[   17.681915]  ffff88810231d080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   17.682544]  ffff88810231d100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.682964] ==================================================================