Hay
Date
May 29, 2025, 7:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   23.395530] ==================================================================
[   23.395732] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x388/0x468
[   23.395908] Read of size 1 at addr fff00000c725e000 by task kunit_try_catch/213
[   23.396036] 
[   23.396133] CPU: 1 UID: 0 PID: 213 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250529 #1 PREEMPT 
[   23.396351] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.396457] Hardware name: linux,dummy-virt (DT)
[   23.396531] Call trace:
[   23.396587]  show_stack+0x20/0x38 (C)
[   23.396762]  dump_stack_lvl+0x8c/0xd0
[   23.396915]  print_report+0x118/0x608
[   23.397015]  kasan_report+0xdc/0x128
[   23.397114]  __asan_report_load1_noabort+0x20/0x30
[   23.397239]  kmem_cache_rcu_uaf+0x388/0x468
[   23.397367]  kunit_try_run_case+0x170/0x3f0
[   23.397546]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   23.397686]  kthread+0x328/0x630
[   23.397785]  ret_from_fork+0x10/0x20
[   23.397926] 
[   23.397971] Allocated by task 213:
[   23.398042]  kasan_save_stack+0x3c/0x68
[   23.398142]  kasan_save_track+0x20/0x40
[   23.398229]  kasan_save_alloc_info+0x40/0x58
[   23.398316]  __kasan_slab_alloc+0xa8/0xb0
[   23.398469]  kmem_cache_alloc_noprof+0x10c/0x3a0
[   23.398577]  kmem_cache_rcu_uaf+0x12c/0x468
[   23.398678]  kunit_try_run_case+0x170/0x3f0
[   23.398835]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   23.398966]  kthread+0x328/0x630
[   23.399159]  ret_from_fork+0x10/0x20
[   23.399248] 
[   23.399287] Freed by task 0:
[   23.399347]  kasan_save_stack+0x3c/0x68
[   23.399447]  kasan_save_track+0x20/0x40
[   23.399556]  kasan_save_free_info+0x4c/0x78
[   23.399640]  __kasan_slab_free+0x6c/0x98
[   23.399726]  slab_free_after_rcu_debug+0xd4/0x2f8
[   23.399809]  rcu_core+0x9f4/0x1e20
[   23.399879]  rcu_core_si+0x18/0x30
[   23.399996]  handle_softirqs+0x374/0xb28
[   23.400080]  __do_softirq+0x1c/0x28
[   23.400193] 
[   23.400277] Last potentially related work creation:
[   23.400408]  kasan_save_stack+0x3c/0x68
[   23.400547]  kasan_record_aux_stack+0xb4/0xc8
[   23.400707]  kmem_cache_free+0x120/0x470
[   23.400797]  kmem_cache_rcu_uaf+0x16c/0x468
[   23.400887]  kunit_try_run_case+0x170/0x3f0
[   23.400999]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   23.401174]  kthread+0x328/0x630
[   23.401249]  ret_from_fork+0x10/0x20
[   23.401330] 
[   23.401469] The buggy address belongs to the object at fff00000c725e000
[   23.401469]  which belongs to the cache test_cache of size 200
[   23.401663] The buggy address is located 0 bytes inside of
[   23.401663]  freed 200-byte region [fff00000c725e000, fff00000c725e0c8)
[   23.401830] 
[   23.401922] The buggy address belongs to the physical page:
[   23.402031] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10725e
[   23.402193] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   23.402310] page_type: f5(slab)
[   23.402478] raw: 0bfffe0000000000 fff00000c787b280 dead000000000122 0000000000000000
[   23.402582] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   23.402699] page dumped because: kasan: bad access detected
[   23.402789] 
[   23.402839] Memory state around the buggy address:
[   23.402920]  fff00000c725df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.403014]  fff00000c725df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.403092] >fff00000c725e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   23.403165]                    ^
[   23.403231]  fff00000c725e080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   23.403409]  fff00000c725e100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.403574] ==================================================================


[   11.640101] ==================================================================
[   11.640682] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e3/0x510
[   11.641097] Read of size 1 at addr ffff8881028ad000 by task kunit_try_catch/230
[   11.641525] 
[   11.641640] CPU: 1 UID: 0 PID: 230 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250529 #1 PREEMPT(voluntary) 
[   11.641689] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.641701] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.641724] Call Trace:
[   11.641738]  <TASK>
[   11.641755]  dump_stack_lvl+0x73/0xb0
[   11.641895]  print_report+0xd1/0x650
[   11.641925]  ? __virt_addr_valid+0x1db/0x2d0
[   11.641950]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   11.641973]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.641996]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   11.642019]  kasan_report+0x141/0x180
[   11.642041]  ? kmem_cache_rcu_uaf+0x3e3/0x510
[   11.642069]  __asan_report_load1_noabort+0x18/0x20
[   11.642089]  kmem_cache_rcu_uaf+0x3e3/0x510
[   11.642113]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   11.642135]  ? finish_task_switch.isra.0+0x153/0x700
[   11.642158]  ? __switch_to+0x47/0xf50
[   11.642187]  ? __pfx_read_tsc+0x10/0x10
[   11.642208]  ? ktime_get_ts64+0x86/0x230
[   11.642234]  kunit_try_run_case+0x1a5/0x480
[   11.642256]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.642276]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.642322]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.642347]  ? __kthread_parkme+0x82/0x180
[   11.642367]  ? preempt_count_sub+0x50/0x80
[   11.642390]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.642410]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.642433]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.642457]  kthread+0x337/0x6f0
[   11.642476]  ? trace_preempt_on+0x20/0xc0
[   11.642500]  ? __pfx_kthread+0x10/0x10
[   11.642520]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.642546]  ? calculate_sigpending+0x7b/0xa0
[   11.642571]  ? __pfx_kthread+0x10/0x10
[   11.642592]  ret_from_fork+0x116/0x1d0
[   11.642619]  ? __pfx_kthread+0x10/0x10
[   11.642641]  ret_from_fork_asm+0x1a/0x30
[   11.642673]  </TASK>
[   11.642685] 
[   11.653023] Allocated by task 230:
[   11.653310]  kasan_save_stack+0x45/0x70
[   11.653523]  kasan_save_track+0x18/0x40
[   11.653714]  kasan_save_alloc_info+0x3b/0x50
[   11.654146]  __kasan_slab_alloc+0x91/0xa0
[   11.654463]  kmem_cache_alloc_noprof+0x123/0x3f0
[   11.654851]  kmem_cache_rcu_uaf+0x155/0x510
[   11.655181]  kunit_try_run_case+0x1a5/0x480
[   11.655381]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.655624]  kthread+0x337/0x6f0
[   11.655987]  ret_from_fork+0x116/0x1d0
[   11.656284]  ret_from_fork_asm+0x1a/0x30
[   11.656577] 
[   11.656815] Freed by task 0:
[   11.657099]  kasan_save_stack+0x45/0x70
[   11.657303]  kasan_save_track+0x18/0x40
[   11.657488]  kasan_save_free_info+0x3f/0x60
[   11.657685]  __kasan_slab_free+0x56/0x70
[   11.658634]  slab_free_after_rcu_debug+0xe4/0x310
[   11.658945]  rcu_core+0x66f/0x1c40
[   11.659362]  rcu_core_si+0x12/0x20
[   11.659558]  handle_softirqs+0x209/0x730
[   11.659919]  __irq_exit_rcu+0xc9/0x110
[   11.660160]  irq_exit_rcu+0x12/0x20
[   11.660343]  sysvec_apic_timer_interrupt+0x81/0x90
[   11.660559]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   11.661008] 
[   11.661274] Last potentially related work creation:
[   11.661574]  kasan_save_stack+0x45/0x70
[   11.662007]  kasan_record_aux_stack+0xb2/0xc0
[   11.662220]  kmem_cache_free+0x131/0x420
[   11.662403]  kmem_cache_rcu_uaf+0x194/0x510
[   11.662595]  kunit_try_run_case+0x1a5/0x480
[   11.663062]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.663387]  kthread+0x337/0x6f0
[   11.663824]  ret_from_fork+0x116/0x1d0
[   11.664144]  ret_from_fork_asm+0x1a/0x30
[   11.664345] 
[   11.664436] The buggy address belongs to the object at ffff8881028ad000
[   11.664436]  which belongs to the cache test_cache of size 200
[   11.665406] The buggy address is located 0 bytes inside of
[   11.665406]  freed 200-byte region [ffff8881028ad000, ffff8881028ad0c8)
[   11.666262] 
[   11.666505] The buggy address belongs to the physical page:
[   11.667131] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1028ad
[   11.667484] flags: 0x200000000000000(node=0|zone=2)
[   11.667717] page_type: f5(slab)
[   11.668168] raw: 0200000000000000 ffff8881028a7280 dead000000000122 0000000000000000
[   11.668500] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   11.669183] page dumped because: kasan: bad access detected
[   11.669510] 
[   11.669620] Memory state around the buggy address:
[   11.669950]  ffff8881028acf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.670249]  ffff8881028acf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.670542] >ffff8881028ad000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   11.671271]                    ^
[   11.671456]  ffff8881028ad080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   11.672046]  ffff8881028ad100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.672359] ==================================================================