Hay
Date
Dec. 6, 2024, 3:11 p.m.

Environment
qemu-arm64
qemu-x86_64

[   32.535556] ==================================================================
[   32.536935] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x390/0x468
[   32.537944] Read of size 1 at addr fff00000c69b9000 by task kunit_try_catch/202
[   32.539148] 
[   32.539566] CPU: 0 UID: 0 PID: 202 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241206 #1
[   32.540557] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.541065] Hardware name: linux,dummy-virt (DT)
[   32.541667] Call trace:
[   32.542067]  show_stack+0x20/0x38 (C)
[   32.542933]  dump_stack_lvl+0x8c/0xd0
[   32.543591]  print_report+0x118/0x5e0
[   32.544154]  kasan_report+0xc8/0x118
[   32.544870]  __asan_report_load1_noabort+0x20/0x30
[   32.545618]  kmem_cache_rcu_uaf+0x390/0x468
[   32.546479]  kunit_try_run_case+0x14c/0x3d0
[   32.547107]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.547764]  kthread+0x24c/0x2d0
[   32.548355]  ret_from_fork+0x10/0x20
[   32.548936] 
[   32.549283] Allocated by task 202:
[   32.549859]  kasan_save_stack+0x3c/0x68
[   32.550675]  kasan_save_track+0x20/0x40
[   32.551302]  kasan_save_alloc_info+0x40/0x58
[   32.551890]  __kasan_slab_alloc+0xa8/0xb0
[   32.552584]  kmem_cache_alloc_noprof+0x108/0x398
[   32.553279]  kmem_cache_rcu_uaf+0x12c/0x468
[   32.553963]  kunit_try_run_case+0x14c/0x3d0
[   32.554856]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.555558]  kthread+0x24c/0x2d0
[   32.556143]  ret_from_fork+0x10/0x20
[   32.556732] 
[   32.557072] Freed by task 0:
[   32.557462]  kasan_save_stack+0x3c/0x68
[   32.558111]  kasan_save_track+0x20/0x40
[   32.559618]  kasan_save_free_info+0x4c/0x78
[   32.560388]  __kasan_slab_free+0x6c/0x98
[   32.561136]  slab_free_after_rcu_debug+0xd4/0x2f8
[   32.561745]  rcu_core+0x9f4/0x1e20
[   32.562232]  rcu_core_si+0x18/0x30
[   32.562829]  handle_softirqs+0x374/0xb20
[   32.563349]  __do_softirq+0x1c/0x28
[   32.564245] 
[   32.564626] Last potentially related work creation:
[   32.565203]  kasan_save_stack+0x3c/0x68
[   32.565876]  kasan_record_aux_stack+0xb4/0xc8
[   32.566806]  kmem_cache_free+0x28c/0x470
[   32.567385]  kmem_cache_rcu_uaf+0x16c/0x468
[   32.567968]  kunit_try_run_case+0x14c/0x3d0
[   32.568656]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.569370]  kthread+0x24c/0x2d0
[   32.569920]  ret_from_fork+0x10/0x20
[   32.570791] 
[   32.571128] The buggy address belongs to the object at fff00000c69b9000
[   32.571128]  which belongs to the cache test_cache of size 200
[   32.572343] The buggy address is located 0 bytes inside of
[   32.572343]  freed 200-byte region [fff00000c69b9000, fff00000c69b90c8)
[   32.573552] 
[   32.573925] The buggy address belongs to the physical page:
[   32.574920] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1069b9
[   32.575745] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   32.576638] page_type: f5(slab)
[   32.577193] raw: 0bfffe0000000000 fff00000c5b4c280 dead000000000122 0000000000000000
[   32.578022] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   32.579250] page dumped because: kasan: bad access detected
[   32.579809] 
[   32.580178] Memory state around the buggy address:
[   32.580816]  fff00000c69b8f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   32.581592]  fff00000c69b8f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   32.582457] >fff00000c69b9000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   32.583530]                    ^
[   32.583990]  fff00000c69b9080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   32.584923]  fff00000c69b9100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.585871] ==================================================================

[   25.259910] ==================================================================
[   25.261523] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e5/0x510
[   25.262210] Read of size 1 at addr ffff888102929000 by task kunit_try_catch/221
[   25.262781] 
[   25.263049] CPU: 0 UID: 0 PID: 221 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241206 #1
[   25.264226] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.264530] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.265524] Call Trace:
[   25.265825]  <TASK>
[   25.266055]  dump_stack_lvl+0x73/0xb0
[   25.266684]  print_report+0xd1/0x640
[   25.267197]  ? __virt_addr_valid+0x1db/0x2d0
[   25.267758]  ? kasan_complete_mode_report_info+0x64/0x200
[   25.268409]  kasan_report+0x102/0x140
[   25.268859]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   25.269427]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   25.269769]  __asan_report_load1_noabort+0x18/0x20
[   25.270379]  kmem_cache_rcu_uaf+0x3e5/0x510
[   25.270955]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   25.271474]  ? finish_task_switch.isra.0+0x153/0x700
[   25.272236]  ? __switch_to+0x5d9/0xf60
[   25.272745]  ? __pfx_read_tsc+0x10/0x10
[   25.273243]  ? ktime_get_ts64+0x86/0x230
[   25.273571]  kunit_try_run_case+0x1b3/0x490
[   25.274232]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.274778]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   25.275337]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.275818]  ? __kthread_parkme+0x82/0x160
[   25.276416]  ? preempt_count_sub+0x50/0x80
[   25.276829]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.277415]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.278072]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.278681]  kthread+0x257/0x310
[   25.278974]  ? __pfx_kthread+0x10/0x10
[   25.279495]  ret_from_fork+0x41/0x80
[   25.279994]  ? __pfx_kthread+0x10/0x10
[   25.280522]  ret_from_fork_asm+0x1a/0x30
[   25.281131]  </TASK>
[   25.281482] 
[   25.281730] Allocated by task 221:
[   25.282109]  kasan_save_stack+0x3d/0x60
[   25.282617]  kasan_save_track+0x18/0x40
[   25.283188]  kasan_save_alloc_info+0x3b/0x50
[   25.283649]  __kasan_slab_alloc+0x91/0xa0
[   25.284048]  kmem_cache_alloc_noprof+0x11e/0x3e0
[   25.284734]  kmem_cache_rcu_uaf+0x156/0x510
[   25.285239]  kunit_try_run_case+0x1b3/0x490
[   25.285669]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.286313]  kthread+0x257/0x310
[   25.286715]  ret_from_fork+0x41/0x80
[   25.287033]  ret_from_fork_asm+0x1a/0x30
[   25.287634] 
[   25.287863] Freed by task 0:
[   25.288147]  kasan_save_stack+0x3d/0x60
[   25.288650]  kasan_save_track+0x18/0x40
[   25.289029]  kasan_save_free_info+0x3f/0x60
[   25.289474]  __kasan_slab_free+0x56/0x70
[   25.290061]  slab_free_after_rcu_debug+0xe4/0x310
[   25.290418]  rcu_core+0x680/0x1d70
[   25.290693]  rcu_core_si+0x12/0x20
[   25.290991]  handle_softirqs+0x209/0x720
[   25.291594]  __irq_exit_rcu+0xc9/0x110
[   25.292158]  irq_exit_rcu+0x12/0x20
[   25.292575]  sysvec_apic_timer_interrupt+0x81/0x90
[   25.293139]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   25.293564] 
[   25.293845] Last potentially related work creation:
[   25.294272]  kasan_save_stack+0x3d/0x60
[   25.294807]  kasan_record_aux_stack+0xb2/0xc0
[   25.295204]  kmem_cache_free+0x284/0x420
[   25.295729]  kmem_cache_rcu_uaf+0x195/0x510
[   25.296202]  kunit_try_run_case+0x1b3/0x490
[   25.296495]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.296955]  kthread+0x257/0x310
[   25.297505]  ret_from_fork+0x41/0x80
[   25.298052]  ret_from_fork_asm+0x1a/0x30
[   25.298579] 
[   25.298840] The buggy address belongs to the object at ffff888102929000
[   25.298840]  which belongs to the cache test_cache of size 200
[   25.299870] The buggy address is located 0 bytes inside of
[   25.299870]  freed 200-byte region [ffff888102929000, ffff8881029290c8)
[   25.300753] 
[   25.301128] The buggy address belongs to the physical page:
[   25.301725] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102929
[   25.302608] flags: 0x200000000000000(node=0|zone=2)
[   25.303068] page_type: f5(slab)
[   25.303569] raw: 0200000000000000 ffff88815a89af00 dead000000000122 0000000000000000
[   25.304315] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   25.304957] page dumped because: kasan: bad access detected
[   25.305636] 
[   25.305889] Memory state around the buggy address:
[   25.306384]  ffff888102928f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.306880]  ffff888102928f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.307686] >ffff888102929000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   25.308589]                    ^
[   25.308884]  ffff888102929080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   25.309607]  ffff888102929100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.310333] ==================================================================