Hay
Date
Nov. 27, 2024, 3:37 a.m.

Environment
qemu-arm64
qemu-x86_64

[   49.123569] ==================================================================
[   49.124758] BUG: KASAN: invalid-free in kmem_cache_invalid_free+0x184/0x3b8
[   49.125452] Free of addr fff00000c617a001 by task kunit_try_catch/200
[   49.126996] 
[   49.127317] CPU: 1 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   49.128723] Tainted: [B]=BAD_PAGE, [N]=TEST
[   49.129422] Hardware name: linux,dummy-virt (DT)
[   49.130032] Call trace:
[   49.130775]  show_stack+0x20/0x38 (C)
[   49.131384]  dump_stack_lvl+0x8c/0xd0
[   49.132095]  print_report+0x118/0x5e0
[   49.132626]  kasan_report_invalid_free+0xb0/0xd8
[   49.133473]  check_slab_allocation+0xfc/0x108
[   49.134268]  __kasan_slab_pre_free+0x2c/0x48
[   49.134819]  kmem_cache_free+0xf0/0x470
[   49.135457]  kmem_cache_invalid_free+0x184/0x3b8
[   49.136076]  kunit_try_run_case+0x14c/0x3d0
[   49.136802]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   49.137785]  kthread+0x24c/0x2d0
[   49.138317]  ret_from_fork+0x10/0x20
[   49.138934] 
[   49.139205] Allocated by task 200:
[   49.139928]  kasan_save_stack+0x3c/0x68
[   49.140491]  kasan_save_track+0x20/0x40
[   49.141514]  kasan_save_alloc_info+0x40/0x58
[   49.142132]  __kasan_slab_alloc+0xa8/0xb0
[   49.142767]  kmem_cache_alloc_noprof+0x108/0x398
[   49.143404]  kmem_cache_invalid_free+0x12c/0x3b8
[   49.144083]  kunit_try_run_case+0x14c/0x3d0
[   49.144770]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   49.145807]  kthread+0x24c/0x2d0
[   49.146394]  ret_from_fork+0x10/0x20
[   49.147094] 
[   49.147398] The buggy address belongs to the object at fff00000c617a000
[   49.147398]  which belongs to the cache test_cache of size 200
[   49.148799] The buggy address is located 1 bytes inside of
[   49.148799]  200-byte region [fff00000c617a000, fff00000c617a0c8)
[   49.150358] 
[   49.150696] The buggy address belongs to the physical page:
[   49.151397] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10617a
[   49.152382] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   49.154015] page_type: f5(slab)
[   49.154440] raw: 0bfffe0000000000 fff00000c6181140 dead000000000122 0000000000000000
[   49.155495] raw: 0000000000000000 00000000800f000f 00000001f5000000 0000000000000000
[   49.156285] page dumped because: kasan: bad access detected
[   49.157028] 
[   49.157328] Memory state around the buggy address:
[   49.158899]  fff00000c6179f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   49.159754]  fff00000c6179f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   49.160591] >fff00000c617a000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   49.161779]                    ^
[   49.162166]  fff00000c617a080: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
[   49.162965]  fff00000c617a100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   49.163902] ==================================================================

[   26.327881] ==================================================================
[   26.329724] BUG: KASAN: invalid-free in kmem_cache_invalid_free+0x1d9/0x470
[   26.330453] Free of addr ffff888102a52001 by task kunit_try_catch/219
[   26.331806] 
[   26.332201] CPU: 0 UID: 0 PID: 219 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   26.333474] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.333799] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.335067] Call Trace:
[   26.335300]  <TASK>
[   26.335591]  dump_stack_lvl+0x73/0xb0
[   26.336025]  print_report+0xd1/0x640
[   26.336408]  ? __virt_addr_valid+0x1db/0x2d0
[   26.336866]  ? kmem_cache_invalid_free+0x1d9/0x470
[   26.338123]  ? kasan_complete_mode_report_info+0x2a/0x200
[   26.338833]  ? kmem_cache_invalid_free+0x1d9/0x470
[   26.339736]  kasan_report_invalid_free+0xc0/0xf0
[   26.340512]  ? kmem_cache_invalid_free+0x1d9/0x470
[   26.341340]  ? kmem_cache_invalid_free+0x1d9/0x470
[   26.342151]  check_slab_allocation+0x11f/0x130
[   26.342852]  __kasan_slab_pre_free+0x28/0x40
[   26.343610]  kmem_cache_free+0xee/0x420
[   26.344637]  ? kmem_cache_alloc_noprof+0x11e/0x3e0
[   26.345327]  ? kmem_cache_invalid_free+0x1d9/0x470
[   26.346240]  kmem_cache_invalid_free+0x1d9/0x470
[   26.346759]  ? __pfx_kmem_cache_invalid_free+0x10/0x10
[   26.348213]  ? finish_task_switch.isra.0+0x153/0x700
[   26.348949]  ? __switch_to+0x5d9/0xf60
[   26.349664]  ? __pfx_read_tsc+0x10/0x10
[   26.349856]  ? ktime_get_ts64+0x84/0x230
[   26.350884]  kunit_try_run_case+0x1b3/0x490
[   26.351676]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.352687]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   26.353806]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   26.354956]  ? __kthread_parkme+0x82/0x160
[   26.355468]  ? preempt_count_sub+0x50/0x80
[   26.355669]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.355874]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   26.357294]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.358487]  kthread+0x257/0x310
[   26.359292]  ? __pfx_kthread+0x10/0x10
[   26.360175]  ret_from_fork+0x41/0x80
[   26.360443]  ? __pfx_kthread+0x10/0x10
[   26.360643]  ret_from_fork_asm+0x1a/0x30
[   26.360846]  </TASK>
[   26.360962] 
[   26.361186] Allocated by task 219:
[   26.361587]  kasan_save_stack+0x3d/0x60
[   26.362176]  kasan_save_track+0x18/0x40
[   26.362866]  kasan_save_alloc_info+0x3b/0x50
[   26.363466]  __kasan_slab_alloc+0x91/0xa0
[   26.363837]  kmem_cache_alloc_noprof+0x11e/0x3e0
[   26.364468]  kmem_cache_invalid_free+0x158/0x470
[   26.365187]  kunit_try_run_case+0x1b3/0x490
[   26.365488]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.366275]  kthread+0x257/0x310
[   26.366728]  ret_from_fork+0x41/0x80
[   26.367505]  ret_from_fork_asm+0x1a/0x30
[   26.368185] 
[   26.368438] The buggy address belongs to the object at ffff888102a52000
[   26.368438]  which belongs to the cache test_cache of size 200
[   26.369613] The buggy address is located 1 bytes inside of
[   26.369613]  200-byte region [ffff888102a52000, ffff888102a520c8)
[   26.370669] 
[   26.371133] The buggy address belongs to the physical page:
[   26.371710] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a52
[   26.373030] flags: 0x200000000000000(node=0|zone=2)
[   26.373716] page_type: f5(slab)
[   26.374399] raw: 0200000000000000 ffff88810166ab40 dead000000000122 0000000000000000
[   26.375522] raw: 0000000000000000 00000000800f000f 00000001f5000000 0000000000000000
[   26.376578] page dumped because: kasan: bad access detected
[   26.377068] 
[   26.377259] Memory state around the buggy address:
[   26.377673]  ffff888102a51f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.378691]  ffff888102a51f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.379457] >ffff888102a52000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   26.380355]                    ^
[   26.380823]  ffff888102a52080: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
[   26.381644]  ffff888102a52100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.382483] ==================================================================