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

Environment
qemu-arm64
qemu-x86_64

[   37.254926] ==================================================================
[   37.256002] BUG: KASAN: double-free in kfree_sensitive+0x3c/0xb0
[   37.256771] Free of addr fff00000c5a3bf20 by task kunit_try_catch/181
[   37.257419] 
[   37.257783] CPU: 1 UID: 0 PID: 181 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   37.259279] Tainted: [B]=BAD_PAGE, [N]=TEST
[   37.260138] Hardware name: linux,dummy-virt (DT)
[   37.260735] Call trace:
[   37.261095]  show_stack+0x20/0x38 (C)
[   37.261685]  dump_stack_lvl+0x8c/0xd0
[   37.262293]  print_report+0x118/0x5e0
[   37.262892]  kasan_report_invalid_free+0xb0/0xd8
[   37.263521]  check_slab_allocation+0xd4/0x108
[   37.264100]  __kasan_slab_pre_free+0x2c/0x48
[   37.264715]  kfree+0xe8/0x3d0
[   37.265181]  kfree_sensitive+0x3c/0xb0
[   37.265838]  kmalloc_double_kzfree+0x168/0x308
[   37.266549]  kunit_try_run_case+0x14c/0x3d0
[   37.267222]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.267901]  kthread+0x24c/0x2d0
[   37.268618]  ret_from_fork+0x10/0x20
[   37.269090] 
[   37.269424] Allocated by task 181:
[   37.269951]  kasan_save_stack+0x3c/0x68
[   37.270460]  kasan_save_track+0x20/0x40
[   37.271037]  kasan_save_alloc_info+0x40/0x58
[   37.271586]  __kasan_kmalloc+0xd4/0xd8
[   37.272194]  __kmalloc_cache_noprof+0x15c/0x3c8
[   37.272909]  kmalloc_double_kzfree+0xb8/0x308
[   37.273540]  kunit_try_run_case+0x14c/0x3d0
[   37.274097]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.274812]  kthread+0x24c/0x2d0
[   37.275240]  ret_from_fork+0x10/0x20
[   37.275729] 
[   37.276083] Freed by task 181:
[   37.276499]  kasan_save_stack+0x3c/0x68
[   37.277068]  kasan_save_track+0x20/0x40
[   37.277648]  kasan_save_free_info+0x4c/0x78
[   37.278160]  __kasan_slab_free+0x6c/0x98
[   37.278759]  kfree+0x114/0x3d0
[   37.279273]  kfree_sensitive+0x80/0xb0
[   37.279853]  kmalloc_double_kzfree+0x11c/0x308
[   37.280367]  kunit_try_run_case+0x14c/0x3d0
[   37.280997]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.281663]  kthread+0x24c/0x2d0
[   37.282122]  ret_from_fork+0x10/0x20
[   37.282694] 
[   37.283065] The buggy address belongs to the object at fff00000c5a3bf20
[   37.283065]  which belongs to the cache kmalloc-16 of size 16
[   37.284257] The buggy address is located 0 bytes inside of
[   37.284257]  16-byte region [fff00000c5a3bf20, fff00000c5a3bf30)
[   37.285302] 
[   37.285665] The buggy address belongs to the physical page:
[   37.286358] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105a3b
[   37.287212] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   37.287966] page_type: f5(slab)
[   37.288539] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   37.289324] raw: 0000000000000000 0000000080800080 00000001f5000000 0000000000000000
[   37.290101] page dumped because: kasan: bad access detected
[   37.290814] 
[   37.291150] Memory state around the buggy address:
[   37.291750]  fff00000c5a3be00: fa fb fc fc 00 02 fc fc fa fb fc fc fa fb fc fc
[   37.292537]  fff00000c5a3be80: fa fb fc fc fa fb fc fc fa fb fc fc 00 04 fc fc
[   37.293248] >fff00000c5a3bf00: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   37.294089]                                ^
[   37.294583]  fff00000c5a3bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.295366]  fff00000c5a3c000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   37.296105] ==================================================================

[   28.757043] ==================================================================
[   28.757833] BUG: KASAN: double-free in kfree_sensitive+0x2e/0x90
[   28.758438] Free of addr ffff8881025fee80 by task kunit_try_catch/199
[   28.759272] 
[   28.759440] CPU: 1 UID: 0 PID: 199 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   28.760444] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.760889] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.761604] Call Trace:
[   28.764357]  <TASK>
[   28.765002]  dump_stack_lvl+0x73/0xb0
[   28.766365]  print_report+0xd1/0x640
[   28.767386]  ? __virt_addr_valid+0x1db/0x2d0
[   28.768888]  ? kfree_sensitive+0x2e/0x90
[   28.770191]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.771534]  ? kfree_sensitive+0x2e/0x90
[   28.773654]  kasan_report_invalid_free+0xc0/0xf0
[   28.775135]  ? kfree_sensitive+0x2e/0x90
[   28.776308]  ? kfree_sensitive+0x2e/0x90
[   28.776960]  check_slab_allocation+0x101/0x130
[   28.777399]  __kasan_slab_pre_free+0x28/0x40
[   28.777921]  kfree+0xf1/0x3f0
[   28.778334]  ? kfree_sensitive+0x2e/0x90
[   28.778763]  kfree_sensitive+0x2e/0x90
[   28.779244]  kmalloc_double_kzfree+0x19d/0x360
[   28.779640]  ? __pfx_kmalloc_double_kzfree+0x10/0x10
[   28.780355]  ? __schedule+0xc3e/0x2790
[   28.780790]  ? __pfx_read_tsc+0x10/0x10
[   28.781318]  ? ktime_get_ts64+0x84/0x230
[   28.781880]  kunit_try_run_case+0x1b3/0x490
[   28.782708]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.783303]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.783857]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.784443]  ? __kthread_parkme+0x82/0x160
[   28.784937]  ? preempt_count_sub+0x50/0x80
[   28.785291]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.785869]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.786630]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.787398]  kthread+0x257/0x310
[   28.787777]  ? __pfx_kthread+0x10/0x10
[   28.788458]  ret_from_fork+0x41/0x80
[   28.788917]  ? __pfx_kthread+0x10/0x10
[   28.789448]  ret_from_fork_asm+0x1a/0x30
[   28.789899]  </TASK>
[   28.790306] 
[   28.790513] Allocated by task 199:
[   28.790968]  kasan_save_stack+0x3d/0x60
[   28.791276]  kasan_save_track+0x18/0x40
[   28.791898]  kasan_save_alloc_info+0x3b/0x50
[   28.792501]  __kasan_kmalloc+0xb7/0xc0
[   28.792820]  __kmalloc_cache_noprof+0x184/0x410
[   28.793344]  kmalloc_double_kzfree+0xaa/0x360
[   28.794263]  kunit_try_run_case+0x1b3/0x490
[   28.794714]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.795255]  kthread+0x257/0x310
[   28.795705]  ret_from_fork+0x41/0x80
[   28.796075]  ret_from_fork_asm+0x1a/0x30
[   28.796728] 
[   28.796958] Freed by task 199:
[   28.797380]  kasan_save_stack+0x3d/0x60
[   28.797782]  kasan_save_track+0x18/0x40
[   28.798201]  kasan_save_free_info+0x3f/0x60
[   28.798523]  __kasan_slab_free+0x56/0x70
[   28.799021]  kfree+0x123/0x3f0
[   28.799806]  kfree_sensitive+0x67/0x90
[   28.800377]  kmalloc_double_kzfree+0x12c/0x360
[   28.800967]  kunit_try_run_case+0x1b3/0x490
[   28.802068]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.802603]  kthread+0x257/0x310
[   28.802977]  ret_from_fork+0x41/0x80
[   28.803468]  ret_from_fork_asm+0x1a/0x30
[   28.803907] 
[   28.804406] The buggy address belongs to the object at ffff8881025fee80
[   28.804406]  which belongs to the cache kmalloc-16 of size 16
[   28.805446] The buggy address is located 0 bytes inside of
[   28.805446]  16-byte region [ffff8881025fee80, ffff8881025fee90)
[   28.806512] 
[   28.806803] The buggy address belongs to the physical page:
[   28.807270] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1025fe
[   28.808220] flags: 0x200000000000000(node=0|zone=2)
[   28.808656] page_type: f5(slab)
[   28.809023] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   28.810016] raw: 0000000000000000 0000000080800080 00000001f5000000 0000000000000000
[   28.810726] page dumped because: kasan: bad access detected
[   28.811410] 
[   28.811640] Memory state around the buggy address:
[   28.812147]  ffff8881025fed80: fa fb fc fc 00 05 fc fc fa fb fc fc fa fb fc fc
[   28.812806]  ffff8881025fee00: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   28.813372] >ffff8881025fee80: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.814182]                    ^
[   28.814494]  ffff8881025fef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.815573]  ffff8881025fef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.816480] ==================================================================