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

Environment
qemu-arm64
qemu-x86_64

[   35.183521] ==================================================================
[   35.185553] BUG: KASAN: invalid-free in kmem_cache_invalid_free+0x184/0x3b8
[   35.187228] Free of addr fff00000c6afa001 by task kunit_try_catch/200
[   35.189099] 
[   35.189937] CPU: 0 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   35.191151] Tainted: [B]=BAD_PAGE, [N]=TEST
[   35.191831] Hardware name: linux,dummy-virt (DT)
[   35.193118] Call trace:
[   35.193600]  show_stack+0x20/0x38 (C)
[   35.194278]  dump_stack_lvl+0x8c/0xd0
[   35.195215]  print_report+0x118/0x5e0
[   35.196074]  kasan_report_invalid_free+0xb0/0xd8
[   35.197073]  check_slab_allocation+0xfc/0x108
[   35.198059]  __kasan_slab_pre_free+0x2c/0x48
[   35.199161]  kmem_cache_free+0xf0/0x470
[   35.199883]  kmem_cache_invalid_free+0x184/0x3b8
[   35.200370]  kunit_try_run_case+0x14c/0x3d0
[   35.201275]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   35.202723]  kthread+0x24c/0x2d0
[   35.203330]  ret_from_fork+0x10/0x20
[   35.204183] 
[   35.204735] Allocated by task 200:
[   35.205198]  kasan_save_stack+0x3c/0x68
[   35.205922]  kasan_save_track+0x20/0x40
[   35.207204]  kasan_save_alloc_info+0x40/0x58
[   35.207899]  __kasan_slab_alloc+0xa8/0xb0
[   35.209125]  kmem_cache_alloc_noprof+0x108/0x3a0
[   35.209903]  kmem_cache_invalid_free+0x12c/0x3b8
[   35.210963]  kunit_try_run_case+0x14c/0x3d0
[   35.211634]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   35.212903]  kthread+0x24c/0x2d0
[   35.213959]  ret_from_fork+0x10/0x20
[   35.214526] 
[   35.214842] The buggy address belongs to the object at fff00000c6afa000
[   35.214842]  which belongs to the cache test_cache of size 200
[   35.216929] The buggy address is located 1 bytes inside of
[   35.216929]  200-byte region [fff00000c6afa000, fff00000c6afa0c8)
[   35.218656] 
[   35.219077] The buggy address belongs to the physical page:
[   35.219934] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106afa
[   35.221969] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   35.222717] page_type: f5(slab)
[   35.223409] raw: 0bfffe0000000000 fff00000c408c500 dead000000000122 0000000000000000
[   35.225423] raw: 0000000000000000 00000000800f000f 00000001f5000000 0000000000000000
[   35.227104] page dumped because: kasan: bad access detected
[   35.227883] 
[   35.228214] Memory state around the buggy address:
[   35.229613]  fff00000c6af9f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.230966]  fff00000c6af9f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.231751] >fff00000c6afa000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   35.232329]                    ^
[   35.232705]  fff00000c6afa080: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
[   35.234757]  fff00000c6afa100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.235379] ==================================================================

[   26.328627] ==================================================================
[   26.329763] BUG: KASAN: invalid-free in kmem_cache_invalid_free+0x1d9/0x470
[   26.330184] Free of addr ffff888101ab5001 by task kunit_try_catch/219
[   26.330870] 
[   26.331119] CPU: 0 UID: 0 PID: 219 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   26.332947] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.333201] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.333895] Call Trace:
[   26.334278]  <TASK>
[   26.334646]  dump_stack_lvl+0x73/0xb0
[   26.335349]  print_report+0xd1/0x640
[   26.336122]  ? __virt_addr_valid+0x1db/0x2d0
[   26.336809]  ? kmem_cache_invalid_free+0x1d9/0x470
[   26.337457]  ? kasan_complete_mode_report_info+0x2a/0x200
[   26.338064]  ? kmem_cache_invalid_free+0x1d9/0x470
[   26.338497]  kasan_report_invalid_free+0xc0/0xf0
[   26.338923]  ? kmem_cache_invalid_free+0x1d9/0x470
[   26.339202]  ? kmem_cache_invalid_free+0x1d9/0x470
[   26.339689]  check_slab_allocation+0x11f/0x130
[   26.341182]  __kasan_slab_pre_free+0x28/0x40
[   26.341683]  kmem_cache_free+0xee/0x420
[   26.341972]  ? kmem_cache_alloc_noprof+0x11e/0x3f0
[   26.342683]  ? kmem_cache_invalid_free+0x1d9/0x470
[   26.344171]  kmem_cache_invalid_free+0x1d9/0x470
[   26.345054]  ? __pfx_kmem_cache_invalid_free+0x10/0x10
[   26.345433]  ? finish_task_switch.isra.0+0x153/0x700
[   26.346284]  ? __switch_to+0x5d9/0xf60
[   26.346680]  ? __pfx_read_tsc+0x10/0x10
[   26.347589]  ? ktime_get_ts64+0x84/0x230
[   26.348491]  kunit_try_run_case+0x1b3/0x490
[   26.348917]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.349685]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   26.350158]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   26.351226]  ? __kthread_parkme+0x82/0x160
[   26.351603]  ? preempt_count_sub+0x50/0x80
[   26.352060]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.352786]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   26.353656]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.354039]  kthread+0x257/0x310
[   26.354296]  ? __pfx_kthread+0x10/0x10
[   26.355234]  ret_from_fork+0x41/0x80
[   26.355630]  ? __pfx_kthread+0x10/0x10
[   26.356091]  ret_from_fork_asm+0x1a/0x30
[   26.356458]  </TASK>
[   26.356693] 
[   26.357817] Allocated by task 219:
[   26.358285]  kasan_save_stack+0x3d/0x60
[   26.358648]  kasan_save_track+0x18/0x40
[   26.359576]  kasan_save_alloc_info+0x3b/0x50
[   26.360503]  __kasan_slab_alloc+0x91/0xa0
[   26.360765]  kmem_cache_alloc_noprof+0x11e/0x3f0
[   26.361263]  kmem_cache_invalid_free+0x158/0x470
[   26.362597]  kunit_try_run_case+0x1b3/0x490
[   26.362942]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.363565]  kthread+0x257/0x310
[   26.364531]  ret_from_fork+0x41/0x80
[   26.365337]  ret_from_fork_asm+0x1a/0x30
[   26.365886] 
[   26.367038] The buggy address belongs to the object at ffff888101ab5000
[   26.367038]  which belongs to the cache test_cache of size 200
[   26.368308] The buggy address is located 1 bytes inside of
[   26.368308]  200-byte region [ffff888101ab5000, ffff888101ab50c8)
[   26.370219] 
[   26.370403] The buggy address belongs to the physical page:
[   26.370747] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ab5
[   26.371947] flags: 0x200000000000000(node=0|zone=2)
[   26.372861] page_type: f5(slab)
[   26.373950] raw: 0200000000000000 ffff888101a67280 dead000000000122 0000000000000000
[   26.374532] raw: 0000000000000000 00000000800f000f 00000001f5000000 0000000000000000
[   26.375055] page dumped because: kasan: bad access detected
[   26.376124] 
[   26.376302] Memory state around the buggy address:
[   26.376680]  ffff888101ab4f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.377009]  ffff888101ab4f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.377782] >ffff888101ab5000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   26.378290]                    ^
[   26.379590]  ffff888101ab5080: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
[   26.379952]  ffff888101ab5100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.380988] ==================================================================