Hay
Date
May 15, 2025, 10:38 a.m.

Environment
qemu-arm64
qemu-x86_64

[   19.262437] ==================================================================
[   19.262543] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x388/0x468
[   19.262625] Read of size 1 at addr fff00000c6891000 by task kunit_try_catch/213
[   19.262676] 
[   19.262721] CPU: 0 UID: 0 PID: 213 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250515 #1 PREEMPT 
[   19.262816] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.262843] Hardware name: linux,dummy-virt (DT)
[   19.262878] Call trace:
[   19.262902]  show_stack+0x20/0x38 (C)
[   19.262955]  dump_stack_lvl+0x8c/0xd0
[   19.263006]  print_report+0x118/0x608
[   19.263053]  kasan_report+0xdc/0x128
[   19.263099]  __asan_report_load1_noabort+0x20/0x30
[   19.263149]  kmem_cache_rcu_uaf+0x388/0x468
[   19.263210]  kunit_try_run_case+0x170/0x3f0
[   19.263259]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.263311]  kthread+0x328/0x630
[   19.263360]  ret_from_fork+0x10/0x20
[   19.263409] 
[   19.263429] Allocated by task 213:
[   19.263458]  kasan_save_stack+0x3c/0x68
[   19.263499]  kasan_save_track+0x20/0x40
[   19.263535]  kasan_save_alloc_info+0x40/0x58
[   19.263575]  __kasan_slab_alloc+0xa8/0xb0
[   19.263610]  kmem_cache_alloc_noprof+0x10c/0x3a0
[   19.263651]  kmem_cache_rcu_uaf+0x12c/0x468
[   19.263688]  kunit_try_run_case+0x170/0x3f0
[   19.263725]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.263765]  kthread+0x328/0x630
[   19.263801]  ret_from_fork+0x10/0x20
[   19.263835] 
[   19.263854] Freed by task 0:
[   19.263882]  kasan_save_stack+0x3c/0x68
[   19.263920]  kasan_save_track+0x20/0x40
[   19.263955]  kasan_save_free_info+0x4c/0x78
[   19.263994]  __kasan_slab_free+0x6c/0x98
[   19.264029]  slab_free_after_rcu_debug+0xd4/0x2f8
[   19.264067]  rcu_core+0x9f4/0x1e20
[   19.264103]  rcu_core_si+0x18/0x30
[   19.264137]  handle_softirqs+0x374/0xb28
[   19.264182]  __do_softirq+0x1c/0x28
[   19.264217] 
[   19.264237] Last potentially related work creation:
[   19.264263]  kasan_save_stack+0x3c/0x68
[   19.264299]  kasan_record_aux_stack+0xb4/0xc8
[   19.264339]  kmem_cache_free+0x120/0x470
[   19.264375]  kmem_cache_rcu_uaf+0x16c/0x468
[   19.264413]  kunit_try_run_case+0x170/0x3f0
[   19.264449]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.264491]  kthread+0x328/0x630
[   19.264527]  ret_from_fork+0x10/0x20
[   19.264562] 
[   19.264580] The buggy address belongs to the object at fff00000c6891000
[   19.264580]  which belongs to the cache test_cache of size 200
[   19.264638] The buggy address is located 0 bytes inside of
[   19.264638]  freed 200-byte region [fff00000c6891000, fff00000c68910c8)
[   19.264699] 
[   19.264722] The buggy address belongs to the physical page:
[   19.264756] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106891
[   19.264813] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.264866] page_type: f5(slab)
[   19.264909] raw: 0bfffe0000000000 fff00000c17363c0 dead000000000122 0000000000000000
[   19.264958] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   19.264999] page dumped because: kasan: bad access detected
[   19.265030] 
[   19.265050] Memory state around the buggy address:
[   19.265083]  fff00000c6890f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.265125]  fff00000c6890f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.265178] >fff00000c6891000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   19.265215]                    ^
[   19.265243]  fff00000c6891080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   19.265285]  fff00000c6891100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.265323] ==================================================================


[   14.962943] ==================================================================
[   14.963524] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e3/0x510
[   14.964518] Read of size 1 at addr ffff888102316000 by task kunit_try_catch/231
[   14.964942] 
[   14.965098] CPU: 1 UID: 0 PID: 231 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250515 #1 PREEMPT(voluntary) 
[   14.965315] Tainted: [B]=BAD_PAGE, [N]=TEST
[   14.965337] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   14.965381] Call Trace:
[   14.965409]  <TASK>
[   14.965444]  dump_stack_lvl+0x73/0xb0
[   14.965522]  print_report+0xd1/0x650
[   14.965570]  ? __virt_addr_valid+0x1db/0x2d0
[   14.965612]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   14.965647]  ? kasan_complete_mode_report_info+0x64/0x200
[   14.966101]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   14.966129]  kasan_report+0x141/0x180
[   14.966153]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   14.966179]  __asan_report_load1_noabort+0x18/0x20
[   14.966198]  kmem_cache_rcu_uaf+0x3e3/0x510
[   14.966238]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   14.966266]  ? finish_task_switch.isra.0+0x153/0x700
[   14.966292]  ? __switch_to+0x47/0xf50
[   14.966321]  ? __pfx_read_tsc+0x10/0x10
[   14.966354]  ? ktime_get_ts64+0x86/0x230
[   14.966381]  kunit_try_run_case+0x1a5/0x480
[   14.966409]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.966430]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   14.966858]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   14.966886]  ? __kthread_parkme+0x82/0x180
[   14.966911]  ? preempt_count_sub+0x50/0x80
[   14.966935]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.966957]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.966979]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   14.967001]  kthread+0x337/0x6f0
[   14.967021]  ? trace_preempt_on+0x20/0xc0
[   14.967045]  ? __pfx_kthread+0x10/0x10
[   14.967064]  ? _raw_spin_unlock_irq+0x47/0x80
[   14.967085]  ? calculate_sigpending+0x7b/0xa0
[   14.967109]  ? __pfx_kthread+0x10/0x10
[   14.967130]  ret_from_fork+0x116/0x1d0
[   14.967148]  ? __pfx_kthread+0x10/0x10
[   14.967168]  ret_from_fork_asm+0x1a/0x30
[   14.967200]  </TASK>
[   14.967213] 
[   14.977464] Allocated by task 231:
[   14.977900]  kasan_save_stack+0x45/0x70
[   14.978273]  kasan_save_track+0x18/0x40
[   14.978765]  kasan_save_alloc_info+0x3b/0x50
[   14.979049]  __kasan_slab_alloc+0x91/0xa0
[   14.979235]  kmem_cache_alloc_noprof+0x123/0x3f0
[   14.979629]  kmem_cache_rcu_uaf+0x155/0x510
[   14.980557]  kunit_try_run_case+0x1a5/0x480
[   14.981239]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.981839]  kthread+0x337/0x6f0
[   14.982094]  ret_from_fork+0x116/0x1d0
[   14.982361]  ret_from_fork_asm+0x1a/0x30
[   14.982605] 
[   14.982762] Freed by task 0:
[   14.982945]  kasan_save_stack+0x45/0x70
[   14.983869]  kasan_save_track+0x18/0x40
[   14.984200]  kasan_save_free_info+0x3f/0x60
[   14.984922]  __kasan_slab_free+0x56/0x70
[   14.985191]  slab_free_after_rcu_debug+0xe4/0x310
[   14.985688]  rcu_core+0x66f/0x1c40
[   14.985877]  rcu_core_si+0x12/0x20
[   14.986161]  handle_softirqs+0x209/0x730
[   14.986404]  __irq_exit_rcu+0xc9/0x110
[   14.986573]  irq_exit_rcu+0x12/0x20
[   14.986754]  sysvec_apic_timer_interrupt+0x81/0x90
[   14.987201]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   14.987726] 
[   14.988295] Last potentially related work creation:
[   14.988570]  kasan_save_stack+0x45/0x70
[   14.989094]  kasan_record_aux_stack+0xb2/0xc0
[   14.989338]  kmem_cache_free+0x131/0x420
[   14.989670]  kmem_cache_rcu_uaf+0x194/0x510
[   14.990194]  kunit_try_run_case+0x1a5/0x480
[   14.990410]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.990915]  kthread+0x337/0x6f0
[   14.991088]  ret_from_fork+0x116/0x1d0
[   14.991363]  ret_from_fork_asm+0x1a/0x30
[   14.992057] 
[   14.992263] The buggy address belongs to the object at ffff888102316000
[   14.992263]  which belongs to the cache test_cache of size 200
[   14.992848] The buggy address is located 0 bytes inside of
[   14.992848]  freed 200-byte region [ffff888102316000, ffff8881023160c8)
[   14.993667] 
[   14.993786] The buggy address belongs to the physical page:
[   14.994431] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102316
[   14.994836] flags: 0x200000000000000(node=0|zone=2)
[   14.995121] page_type: f5(slab)
[   14.995333] raw: 0200000000000000 ffff888102312140 dead000000000122 0000000000000000
[   14.996259] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   14.996530] page dumped because: kasan: bad access detected
[   14.996894] 
[   14.997049] Memory state around the buggy address:
[   14.997544]  ffff888102315f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.998125]  ffff888102315f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.998636] >ffff888102316000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   14.999054]                    ^
[   14.999397]  ffff888102316080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   15.000230]  ffff888102316100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.000672] ==================================================================