Hay
Date
Dec. 3, 2024, 11:38 p.m.

Environment
qemu-arm64
qemu-x86_64

[   31.040265] ==================================================================
[   31.041188] BUG: KASAN: double-free in kfree_sensitive+0x3c/0xb0
[   31.042006] Free of addr fff00000c63183a0 by task kunit_try_catch/181
[   31.042809] 
[   31.043311] CPU: 0 UID: 0 PID: 181 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   31.044864] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.045558] Hardware name: linux,dummy-virt (DT)
[   31.046569] Call trace:
[   31.047240]  show_stack+0x20/0x38 (C)
[   31.047791]  dump_stack_lvl+0x8c/0xd0
[   31.048318]  print_report+0x118/0x5e0
[   31.048979]  kasan_report_invalid_free+0xb0/0xd8
[   31.049753]  check_slab_allocation+0xd4/0x108
[   31.050416]  __kasan_slab_pre_free+0x2c/0x48
[   31.051370]  kfree+0xe8/0x3c8
[   31.051831]  kfree_sensitive+0x3c/0xb0
[   31.052493]  kmalloc_double_kzfree+0x168/0x308
[   31.053171]  kunit_try_run_case+0x14c/0x3d0
[   31.053838]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.054506]  kthread+0x24c/0x2d0
[   31.055572]  ret_from_fork+0x10/0x20
[   31.056205] 
[   31.056529] Allocated by task 181:
[   31.057131]  kasan_save_stack+0x3c/0x68
[   31.057739]  kasan_save_track+0x20/0x40
[   31.058430]  kasan_save_alloc_info+0x40/0x58
[   31.059414]  __kasan_kmalloc+0xd4/0xd8
[   31.060429]  __kmalloc_cache_noprof+0x15c/0x3c0
[   31.061150]  kmalloc_double_kzfree+0xb8/0x308
[   31.061743]  kunit_try_run_case+0x14c/0x3d0
[   31.062379]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.063484]  kthread+0x24c/0x2d0
[   31.064029]  ret_from_fork+0x10/0x20
[   31.064849] 
[   31.065133] Freed by task 181:
[   31.065846]  kasan_save_stack+0x3c/0x68
[   31.066651]  kasan_save_track+0x20/0x40
[   31.067604]  kasan_save_free_info+0x4c/0x78
[   31.068216]  __kasan_slab_free+0x6c/0x98
[   31.068692]  kfree+0x114/0x3c8
[   31.069471]  kfree_sensitive+0x80/0xb0
[   31.070089]  kmalloc_double_kzfree+0x11c/0x308
[   31.070792]  kunit_try_run_case+0x14c/0x3d0
[   31.071759]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.072444]  kthread+0x24c/0x2d0
[   31.073037]  ret_from_fork+0x10/0x20
[   31.073627] 
[   31.074018] The buggy address belongs to the object at fff00000c63183a0
[   31.074018]  which belongs to the cache kmalloc-16 of size 16
[   31.075841] The buggy address is located 0 bytes inside of
[   31.075841]  16-byte region [fff00000c63183a0, fff00000c63183b0)
[   31.077185] 
[   31.077562] The buggy address belongs to the physical page:
[   31.078371] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106318
[   31.079874] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.080742] page_type: f5(slab)
[   31.081195] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   31.082774] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   31.083678] page dumped because: kasan: bad access detected
[   31.084024] 
[   31.084190] Memory state around the buggy address:
[   31.084827]  fff00000c6318280: fa fb fc fc fa fb fc fc 00 02 fc fc 00 02 fc fc
[   31.085571]  fff00000c6318300: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   31.086626] >fff00000c6318380: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   31.087682]                                ^
[   31.088388]  fff00000c6318400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.089262]  fff00000c6318480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.090482] ==================================================================

[   26.569358] ==================================================================
[   26.570597] BUG: KASAN: double-free in kfree_sensitive+0x2e/0x90
[   26.571402] Free of addr ffff888101adffc0 by task kunit_try_catch/201
[   26.572109] 
[   26.572795] CPU: 0 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   26.574044] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.574306] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.575583] Call Trace:
[   26.575878]  <TASK>
[   26.576170]  dump_stack_lvl+0x73/0xb0
[   26.576801]  print_report+0xd1/0x640
[   26.577210]  ? __virt_addr_valid+0x1db/0x2d0
[   26.577684]  ? kfree_sensitive+0x2e/0x90
[   26.577994]  ? kasan_complete_mode_report_info+0x64/0x200
[   26.578415]  ? kfree_sensitive+0x2e/0x90
[   26.578998]  kasan_report_invalid_free+0xc0/0xf0
[   26.579527]  ? kfree_sensitive+0x2e/0x90
[   26.579940]  ? kfree_sensitive+0x2e/0x90
[   26.580413]  check_slab_allocation+0x101/0x130
[   26.580810]  __kasan_slab_pre_free+0x28/0x40
[   26.581110]  kfree+0xf1/0x3f0
[   26.581350]  ? kfree_sensitive+0x2e/0x90
[   26.581778]  kfree_sensitive+0x2e/0x90
[   26.582254]  kmalloc_double_kzfree+0x19d/0x360
[   26.582809]  ? __pfx_kmalloc_double_kzfree+0x10/0x10
[   26.583328]  ? __schedule+0xc3e/0x2790
[   26.583799]  ? __pfx_read_tsc+0x10/0x10
[   26.584246]  ? ktime_get_ts64+0x86/0x230
[   26.584803]  kunit_try_run_case+0x1b3/0x490
[   26.585182]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.585552]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   26.586082]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   26.586629]  ? __kthread_parkme+0x82/0x160
[   26.587076]  ? preempt_count_sub+0x50/0x80
[   26.587514]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.587969]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   26.588580]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.589130]  kthread+0x257/0x310
[   26.589434]  ? __pfx_kthread+0x10/0x10
[   26.589838]  ret_from_fork+0x41/0x80
[   26.590117]  ? __pfx_kthread+0x10/0x10
[   26.590373]  ret_from_fork_asm+0x1a/0x30
[   26.590827]  </TASK>
[   26.591242] 
[   26.591501] Allocated by task 201:
[   26.591872]  kasan_save_stack+0x3d/0x60
[   26.592348]  kasan_save_track+0x18/0x40
[   26.592888]  kasan_save_alloc_info+0x3b/0x50
[   26.593322]  __kasan_kmalloc+0xb7/0xc0
[   26.593722]  __kmalloc_cache_noprof+0x184/0x410
[   26.594172]  kmalloc_double_kzfree+0xaa/0x360
[   26.594450]  kunit_try_run_case+0x1b3/0x490
[   26.594913]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.595506]  kthread+0x257/0x310
[   26.595922]  ret_from_fork+0x41/0x80
[   26.596273]  ret_from_fork_asm+0x1a/0x30
[   26.596842] 
[   26.597114] Freed by task 201:
[   26.597325]  kasan_save_stack+0x3d/0x60
[   26.597666]  kasan_save_track+0x18/0x40
[   26.598285]  kasan_save_free_info+0x3f/0x60
[   26.598831]  __kasan_slab_free+0x56/0x70
[   26.599208]  kfree+0x123/0x3f0
[   26.599717]  kfree_sensitive+0x67/0x90
[   26.600104]  kmalloc_double_kzfree+0x12c/0x360
[   26.600711]  kunit_try_run_case+0x1b3/0x490
[   26.600989]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.601317]  kthread+0x257/0x310
[   26.601540]  ret_from_fork+0x41/0x80
[   26.601775]  ret_from_fork_asm+0x1a/0x30
[   26.602028] 
[   26.602248] The buggy address belongs to the object at ffff888101adffc0
[   26.602248]  which belongs to the cache kmalloc-16 of size 16
[   26.603330] The buggy address is located 0 bytes inside of
[   26.603330]  16-byte region [ffff888101adffc0, ffff888101adffd0)
[   26.604565] 
[   26.604748] The buggy address belongs to the physical page:
[   26.605247] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101adf
[   26.606275] flags: 0x200000000000000(node=0|zone=2)
[   26.606977] page_type: f5(slab)
[   26.607234] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   26.608072] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   26.608445] page dumped because: kasan: bad access detected
[   26.608729] 
[   26.608868] Memory state around the buggy address:
[   26.609173]  ffff888101adfe80: 00 05 fc fc 00 02 fc fc 00 02 fc fc 00 02 fc fc
[   26.609993]  ffff888101adff00: 00 02 fc fc fa fb fc fc 00 05 fc fc fa fb fc fc
[   26.610865] >ffff888101adff80: fa fb fc fc fa fb fc fc fa fb fc fc fc fc fc fc
[   26.611680]                                            ^
[   26.612189]  ffff888101ae0000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   26.613043]  ffff888101ae0080: fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb
[   26.613629] ==================================================================