Hay
Date
Nov. 28, 2024, 2:36 a.m.

Environment
qemu-arm64
qemu-x86_64

[   31.894024] ==================================================================
[   31.894936] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x390/0x468
[   31.895771] Read of size 1 at addr fff00000c4074000 by task kunit_try_catch/201
[   31.896421] 
[   31.896790] CPU: 1 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   31.897704] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.898457] Hardware name: linux,dummy-virt (DT)
[   31.899037] Call trace:
[   31.899464]  show_stack+0x20/0x38 (C)
[   31.899935]  dump_stack_lvl+0x8c/0xd0
[   31.900531]  print_report+0x118/0x5e0
[   31.901161]  kasan_report+0xc8/0x118
[   31.902169]  __asan_report_load1_noabort+0x20/0x30
[   31.902847]  kmem_cache_rcu_uaf+0x390/0x468
[   31.903384]  kunit_try_run_case+0x14c/0x3d0
[   31.903983]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.904663]  kthread+0x24c/0x2d0
[   31.905289]  ret_from_fork+0x10/0x20
[   31.905877] 
[   31.906192] Allocated by task 201:
[   31.906684]  kasan_save_stack+0x3c/0x68
[   31.907235]  kasan_save_track+0x20/0x40
[   31.907816]  kasan_save_alloc_info+0x40/0x58
[   31.908428]  __kasan_slab_alloc+0xa8/0xb0
[   31.909047]  kmem_cache_alloc_noprof+0x108/0x398
[   31.909743]  kmem_cache_rcu_uaf+0x12c/0x468
[   31.910437]  kunit_try_run_case+0x14c/0x3d0
[   31.910993]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.911646]  kthread+0x24c/0x2d0
[   31.912199]  ret_from_fork+0x10/0x20
[   31.912692] 
[   31.913328] Freed by task 0:
[   31.913778]  kasan_save_stack+0x3c/0x68
[   31.914344]  kasan_save_track+0x20/0x40
[   31.914813]  kasan_save_free_info+0x4c/0x78
[   31.915446]  __kasan_slab_free+0x6c/0x98
[   31.915982]  slab_free_after_rcu_debug+0xd4/0x2f8
[   31.916577]  rcu_core+0x9f4/0x1e20
[   31.917735]  rcu_core_si+0x18/0x30
[   31.918269]  handle_softirqs+0x374/0xb20
[   31.918793]  __do_softirq+0x1c/0x28
[   31.919251] 
[   31.919601] Last potentially related work creation:
[   31.920228]  kasan_save_stack+0x3c/0x68
[   31.920822]  __kasan_record_aux_stack+0xbc/0xe8
[   31.921647]  kasan_record_aux_stack_noalloc+0x14/0x20
[   31.922247]  kmem_cache_free+0x28c/0x470
[   31.922830]  kmem_cache_rcu_uaf+0x16c/0x468
[   31.923483]  kunit_try_run_case+0x14c/0x3d0
[   31.924104]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.924774]  kthread+0x24c/0x2d0
[   31.925596]  ret_from_fork+0x10/0x20
[   31.926125] 
[   31.926474] The buggy address belongs to the object at fff00000c4074000
[   31.926474]  which belongs to the cache test_cache of size 200
[   31.927543] The buggy address is located 0 bytes inside of
[   31.927543]  freed 200-byte region [fff00000c4074000, fff00000c40740c8)
[   31.928696] 
[   31.929352] The buggy address belongs to the physical page:
[   31.929997] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104074
[   31.930940] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.931670] page_type: f5(slab)
[   31.932232] raw: 0bfffe0000000000 fff00000c5b7b3c0 dead000000000122 0000000000000000
[   31.933441] raw: 0000000000000000 00000000800f000f 00000001f5000000 0000000000000000
[   31.934148] page dumped because: kasan: bad access detected
[   31.934832] 
[   31.935159] Memory state around the buggy address:
[   31.935778]  fff00000c4073f00: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
[   31.936533]  fff00000c4073f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.937350] >fff00000c4074000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   31.938488]                    ^
[   31.938859]  fff00000c4074080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   31.939699]  fff00000c4074100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.940400] ==================================================================

[   22.797590] ==================================================================
[   22.798564] BUG: KASAN: slab-use-after-free in kmem_cache_rcu_uaf+0x3e5/0x510
[   22.799659] Read of size 1 at addr ffff888102a27000 by task kunit_try_catch/221
[   22.801314] 
[   22.801579] CPU: 0 UID: 0 PID: 221 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   22.802524] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.802953] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   22.803749] Call Trace:
[   22.804205]  <TASK>
[   22.804576]  dump_stack_lvl+0x73/0xb0
[   22.805357]  print_report+0xd1/0x640
[   22.806003]  ? __virt_addr_valid+0x1db/0x2d0
[   22.806775]  ? kasan_complete_mode_report_info+0x64/0x200
[   22.807440]  kasan_report+0x102/0x140
[   22.807819]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   22.808571]  ? kmem_cache_rcu_uaf+0x3e5/0x510
[   22.809053]  __asan_report_load1_noabort+0x18/0x20
[   22.809911]  kmem_cache_rcu_uaf+0x3e5/0x510
[   22.810370]  ? __pfx_kmem_cache_rcu_uaf+0x10/0x10
[   22.810912]  ? finish_task_switch.isra.0+0x153/0x700
[   22.811433]  ? __switch_to+0x5d9/0xf60
[   22.811947]  ? __pfx_read_tsc+0x10/0x10
[   22.812626]  ? ktime_get_ts64+0x84/0x230
[   22.813049]  kunit_try_run_case+0x1b3/0x490
[   22.813855]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.814502]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   22.815229]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   22.816183]  ? __kthread_parkme+0x82/0x160
[   22.816899]  ? preempt_count_sub+0x50/0x80
[   22.817458]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.818402]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   22.818992]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.819832]  kthread+0x257/0x310
[   22.820189]  ? __pfx_kthread+0x10/0x10
[   22.820541]  ret_from_fork+0x41/0x80
[   22.820894]  ? __pfx_kthread+0x10/0x10
[   22.821219]  ret_from_fork_asm+0x1a/0x30
[   22.821760]  </TASK>
[   22.822061] 
[   22.822281] Allocated by task 221:
[   22.822679]  kasan_save_stack+0x3d/0x60
[   22.823215]  kasan_save_track+0x18/0x40
[   22.823518]  kasan_save_alloc_info+0x3b/0x50
[   22.824008]  __kasan_slab_alloc+0x91/0xa0
[   22.824387]  kmem_cache_alloc_noprof+0x11e/0x3e0
[   22.824893]  kmem_cache_rcu_uaf+0x156/0x510
[   22.825413]  kunit_try_run_case+0x1b3/0x490
[   22.825720]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.826261]  kthread+0x257/0x310
[   22.826706]  ret_from_fork+0x41/0x80
[   22.827201]  ret_from_fork_asm+0x1a/0x30
[   22.827697] 
[   22.827890] Freed by task 0:
[   22.828150]  kasan_save_stack+0x3d/0x60
[   22.828525]  kasan_save_track+0x18/0x40
[   22.828982]  kasan_save_free_info+0x3f/0x60
[   22.829555]  __kasan_slab_free+0x56/0x70
[   22.829933]  slab_free_after_rcu_debug+0xe4/0x310
[   22.830262]  rcu_core+0x680/0x1d70
[   22.830687]  rcu_core_si+0x12/0x20
[   22.831117]  handle_softirqs+0x209/0x720
[   22.831653]  __irq_exit_rcu+0xc9/0x110
[   22.832006]  irq_exit_rcu+0x12/0x20
[   22.832316]  sysvec_apic_timer_interrupt+0x81/0x90
[   22.832869]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   22.833493] 
[   22.833659] Last potentially related work creation:
[   22.834241]  kasan_save_stack+0x3d/0x60
[   22.834652]  __kasan_record_aux_stack+0xae/0xc0
[   22.835166]  kasan_record_aux_stack_noalloc+0xf/0x20
[   22.835688]  kmem_cache_free+0x284/0x420
[   22.835962]  kmem_cache_rcu_uaf+0x195/0x510
[   22.836314]  kunit_try_run_case+0x1b3/0x490
[   22.836812]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.837518]  kthread+0x257/0x310
[   22.837939]  ret_from_fork+0x41/0x80
[   22.838323]  ret_from_fork_asm+0x1a/0x30
[   22.838624] 
[   22.838774] The buggy address belongs to the object at ffff888102a27000
[   22.838774]  which belongs to the cache test_cache of size 200
[   22.839936] The buggy address is located 0 bytes inside of
[   22.839936]  freed 200-byte region [ffff888102a27000, ffff888102a270c8)
[   22.841174] 
[   22.841389] The buggy address belongs to the physical page:
[   22.841736] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a27
[   22.842665] flags: 0x200000000000000(node=0|zone=2)
[   22.843204] page_type: f5(slab)
[   22.843473] raw: 0200000000000000 ffff888101653c80 dead000000000122 0000000000000000
[   22.844272] raw: 0000000000000000 00000000800f000f 00000001f5000000 0000000000000000
[   22.844995] page dumped because: kasan: bad access detected
[   22.845605] 
[   22.845781] Memory state around the buggy address:
[   22.846276]  ffff888102a26f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.846966]  ffff888102a26f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.847505] >ffff888102a27000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   22.847983]                    ^
[   22.848456]  ffff888102a27080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[   22.849060]  ffff888102a27100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.849788] ==================================================================