Hay
Date
Nov. 20, 2024, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   37.936519] ==================================================================
[   37.937416] BUG: KASAN: invalid-free in kmem_cache_invalid_free+0x184/0x3b8
[   37.938844] Free of addr fff00000c65af001 by task kunit_try_catch/200
[   37.940097] 
[   37.940492] CPU: 1 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   37.941694] Tainted: [B]=BAD_PAGE, [N]=TEST
[   37.942197] Hardware name: linux,dummy-virt (DT)
[   37.942755] Call trace:
[   37.943181]  show_stack+0x20/0x38 (C)
[   37.943693]  dump_stack_lvl+0x8c/0xd0
[   37.944294]  print_report+0x118/0x5e0
[   37.944909]  kasan_report_invalid_free+0xb0/0xd8
[   37.945765]  check_slab_allocation+0xfc/0x108
[   37.946331]  __kasan_slab_pre_free+0x2c/0x48
[   37.946846]  kmem_cache_free+0xf0/0x470
[   37.947308]  kmem_cache_invalid_free+0x184/0x3b8
[   37.947970]  kunit_try_run_case+0x14c/0x3d0
[   37.948504]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.949228]  kthread+0x24c/0x2d0
[   37.950154]  ret_from_fork+0x10/0x20
[   37.950695] 
[   37.951033] Allocated by task 200:
[   37.951533]  kasan_save_stack+0x3c/0x68
[   37.952115]  kasan_save_track+0x20/0x40
[   37.952704]  kasan_save_alloc_info+0x40/0x58
[   37.953309]  __kasan_slab_alloc+0xa8/0xb0
[   37.954087]  kmem_cache_alloc_noprof+0x108/0x3a0
[   37.954672]  kmem_cache_invalid_free+0x12c/0x3b8
[   37.955223]  kunit_try_run_case+0x14c/0x3d0
[   37.955938]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.956645]  kthread+0x24c/0x2d0
[   37.957137]  ret_from_fork+0x10/0x20
[   37.958285] 
[   37.958578] The buggy address belongs to the object at fff00000c65af000
[   37.958578]  which belongs to the cache test_cache of size 200
[   37.959843] The buggy address is located 1 bytes inside of
[   37.959843]  200-byte region [fff00000c65af000, fff00000c65af0c8)
[   37.961281] 
[   37.961671] The buggy address belongs to the physical page:
[   37.962622] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1065af
[   37.963438] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   37.964247] page_type: f5(slab)
[   37.964722] raw: 0bfffe0000000000 fff00000c59d3640 dead000000000122 0000000000000000
[   37.965764] raw: 0000000000000000 00000000800f000f 00000001f5000000 0000000000000000
[   37.966830] page dumped because: kasan: bad access detected
[   37.967483] 
[   37.967815] Memory state around the buggy address:
[   37.968452]  fff00000c65aef00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   37.969213]  fff00000c65aef80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   37.970095] >fff00000c65af000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   37.970916]                    ^
[   37.971361]  fff00000c65af080: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
[   37.972170]  fff00000c65af100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.973077] ==================================================================

[   29.491408] ==================================================================
[   29.492496] BUG: KASAN: invalid-free in kmem_cache_invalid_free+0x1d9/0x470
[   29.493062] Free of addr ffff8881029ed001 by task kunit_try_catch/218
[   29.493806] 
[   29.493986] CPU: 1 UID: 0 PID: 218 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   29.495189] Tainted: [B]=BAD_PAGE, [N]=TEST
[   29.495676] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   29.496985] Call Trace:
[   29.497551]  <TASK>
[   29.497899]  dump_stack_lvl+0x73/0xb0
[   29.498400]  print_report+0xd1/0x640
[   29.498903]  ? __virt_addr_valid+0x1db/0x2d0
[   29.499408]  ? kmem_cache_invalid_free+0x1d9/0x470
[   29.499990]  ? kasan_complete_mode_report_info+0x2a/0x200
[   29.500801]  ? kmem_cache_invalid_free+0x1d9/0x470
[   29.501494]  kasan_report_invalid_free+0xc0/0xf0
[   29.501956]  ? kmem_cache_invalid_free+0x1d9/0x470
[   29.502397]  ? kmem_cache_invalid_free+0x1d9/0x470
[   29.503297]  check_slab_allocation+0x11f/0x130
[   29.504088]  __kasan_slab_pre_free+0x28/0x40
[   29.504418]  kmem_cache_free+0xee/0x420
[   29.504913]  ? kmem_cache_alloc_noprof+0x11e/0x3f0
[   29.505819]  ? kmem_cache_invalid_free+0x1d9/0x470
[   29.506392]  kmem_cache_invalid_free+0x1d9/0x470
[   29.506904]  ? __pfx_kmem_cache_invalid_free+0x10/0x10
[   29.507715]  ? finish_task_switch.isra.0+0x153/0x700
[   29.508316]  ? __switch_to+0x5d9/0xf60
[   29.508630]  ? __pfx_read_tsc+0x10/0x10
[   29.509299]  ? ktime_get_ts64+0x84/0x230
[   29.510022]  kunit_try_run_case+0x1b3/0x490
[   29.510394]  ? __pfx_kunit_try_run_case+0x10/0x10
[   29.511093]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   29.511523]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   29.512272]  ? __kthread_parkme+0x82/0x160
[   29.512842]  ? preempt_count_sub+0x50/0x80
[   29.513255]  ? __pfx_kunit_try_run_case+0x10/0x10
[   29.513888]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   29.514809]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   29.515528]  kthread+0x257/0x310
[   29.516107]  ? __pfx_kthread+0x10/0x10
[   29.516613]  ret_from_fork+0x41/0x80
[   29.517133]  ? __pfx_kthread+0x10/0x10
[   29.517841]  ret_from_fork_asm+0x1a/0x30
[   29.518529]  </TASK>
[   29.518894] 
[   29.519222] Allocated by task 218:
[   29.519614]  kasan_save_stack+0x3d/0x60
[   29.520235]  kasan_save_track+0x18/0x40
[   29.520743]  kasan_save_alloc_info+0x3b/0x50
[   29.521245]  __kasan_slab_alloc+0x91/0xa0
[   29.521813]  kmem_cache_alloc_noprof+0x11e/0x3f0
[   29.522370]  kmem_cache_invalid_free+0x158/0x470
[   29.522756]  kunit_try_run_case+0x1b3/0x490
[   29.523052]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   29.523818]  kthread+0x257/0x310
[   29.524284]  ret_from_fork+0x41/0x80
[   29.524625]  ret_from_fork_asm+0x1a/0x30
[   29.525029] 
[   29.525363] The buggy address belongs to the object at ffff8881029ed000
[   29.525363]  which belongs to the cache test_cache of size 200
[   29.526809] The buggy address is located 1 bytes inside of
[   29.526809]  200-byte region [ffff8881029ed000, ffff8881029ed0c8)
[   29.527418] 
[   29.527589] The buggy address belongs to the physical page:
[   29.528501] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029ed
[   29.530081] flags: 0x200000000000000(node=0|zone=2)
[   29.530669] page_type: f5(slab)
[   29.531090] raw: 0200000000000000 ffff888101ebc780 dead000000000122 0000000000000000
[   29.532389] raw: 0000000000000000 00000000800f000f 00000001f5000000 0000000000000000
[   29.534237] page dumped because: kasan: bad access detected
[   29.535465] 
[   29.535753] Memory state around the buggy address:
[   29.536223]  ffff8881029ecf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.536979]  ffff8881029ecf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.537840] >ffff8881029ed000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   29.538753]                    ^
[   29.539014]  ffff8881029ed080: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
[   29.539837]  ffff8881029ed100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.540811] ==================================================================