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

Environment
qemu-arm64
qemu-x86_64

[   48.423115] ==================================================================
[   48.423791] BUG: KASAN: double-free in kfree_sensitive+0x3c/0xb0
[   48.424655] Free of addr fff00000c5f55300 by task kunit_try_catch/181
[   48.425447] 
[   48.425827] CPU: 0 UID: 0 PID: 181 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   48.426944] Tainted: [B]=BAD_PAGE, [N]=TEST
[   48.427562] Hardware name: linux,dummy-virt (DT)
[   48.428443] Call trace:
[   48.428824]  show_stack+0x20/0x38 (C)
[   48.429506]  dump_stack_lvl+0x8c/0xd0
[   48.430089]  print_report+0x118/0x5e0
[   48.431144]  kasan_report_invalid_free+0xb0/0xd8
[   48.431795]  check_slab_allocation+0xd4/0x108
[   48.432461]  __kasan_slab_pre_free+0x2c/0x48
[   48.433566]  kfree+0xe8/0x3c8
[   48.434197]  kfree_sensitive+0x3c/0xb0
[   48.434752]  kmalloc_double_kzfree+0x168/0x308
[   48.435664]  kunit_try_run_case+0x14c/0x3d0
[   48.436125]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   48.437099]  kthread+0x24c/0x2d0
[   48.437675]  ret_from_fork+0x10/0x20
[   48.438240] 
[   48.438635] Allocated by task 181:
[   48.439199]  kasan_save_stack+0x3c/0x68
[   48.439787]  kasan_save_track+0x20/0x40
[   48.440357]  kasan_save_alloc_info+0x40/0x58
[   48.441284]  __kasan_kmalloc+0xd4/0xd8
[   48.441844]  __kmalloc_cache_noprof+0x15c/0x3c0
[   48.442482]  kmalloc_double_kzfree+0xb8/0x308
[   48.443044]  kunit_try_run_case+0x14c/0x3d0
[   48.444373]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   48.445563]  kthread+0x24c/0x2d0
[   48.446000]  ret_from_fork+0x10/0x20
[   48.446494] 
[   48.446852] Freed by task 181:
[   48.447263]  kasan_save_stack+0x3c/0x68
[   48.447991]  kasan_save_track+0x20/0x40
[   48.448542]  kasan_save_free_info+0x4c/0x78
[   48.449205]  __kasan_slab_free+0x6c/0x98
[   48.449880]  kfree+0x114/0x3c8
[   48.450442]  kfree_sensitive+0x80/0xb0
[   48.451066]  kmalloc_double_kzfree+0x11c/0x308
[   48.452670]  kunit_try_run_case+0x14c/0x3d0
[   48.453006]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   48.454363]  kthread+0x24c/0x2d0
[   48.454792]  ret_from_fork+0x10/0x20
[   48.455540] 
[   48.455948] The buggy address belongs to the object at fff00000c5f55300
[   48.455948]  which belongs to the cache kmalloc-16 of size 16
[   48.457634] The buggy address is located 0 bytes inside of
[   48.457634]  16-byte region [fff00000c5f55300, fff00000c5f55310)
[   48.459352] 
[   48.459799] The buggy address belongs to the physical page:
[   48.460750] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105f55
[   48.461958] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   48.462749] page_type: f5(slab)
[   48.463390] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   48.464377] raw: 0000000000000000 0000000080800080 00000001f5000000 0000000000000000
[   48.465380] page dumped because: kasan: bad access detected
[   48.466729] 
[   48.467281] Memory state around the buggy address:
[   48.467966]  fff00000c5f55200: 00 05 fc fc fa fb fc fc 00 02 fc fc fa fb fc fc
[   48.468908]  fff00000c5f55280: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   48.470196] >fff00000c5f55300: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.471125]                    ^
[   48.471637]  fff00000c5f55380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.472816]  fff00000c5f55400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.473769] ==================================================================

[   25.656472] ==================================================================
[   25.657074] BUG: KASAN: double-free in kfree_sensitive+0x2e/0x90
[   25.657762] Free of addr ffff888102699d60 by task kunit_try_catch/200
[   25.658451] 
[   25.658790] CPU: 0 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   25.660201] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.661169] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.662294] Call Trace:
[   25.662529]  <TASK>
[   25.662829]  dump_stack_lvl+0x73/0xb0
[   25.663621]  print_report+0xd1/0x640
[   25.664255]  ? __virt_addr_valid+0x1db/0x2d0
[   25.664691]  ? kfree_sensitive+0x2e/0x90
[   25.665257]  ? kasan_complete_mode_report_info+0x64/0x200
[   25.665772]  ? kfree_sensitive+0x2e/0x90
[   25.666179]  kasan_report_invalid_free+0xc0/0xf0
[   25.666762]  ? kfree_sensitive+0x2e/0x90
[   25.667580]  ? kfree_sensitive+0x2e/0x90
[   25.668131]  check_slab_allocation+0x101/0x130
[   25.668853]  __kasan_slab_pre_free+0x28/0x40
[   25.669551]  kfree+0xf1/0x3f0
[   25.669810]  ? kfree_sensitive+0x2e/0x90
[   25.670459]  kfree_sensitive+0x2e/0x90
[   25.670883]  kmalloc_double_kzfree+0x19d/0x360
[   25.671662]  ? __pfx_kmalloc_double_kzfree+0x10/0x10
[   25.672181]  ? __schedule+0xc3e/0x2790
[   25.672950]  ? __pfx_read_tsc+0x10/0x10
[   25.673546]  ? ktime_get_ts64+0x84/0x230
[   25.674091]  kunit_try_run_case+0x1b3/0x490
[   25.674721]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.675559]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   25.676119]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.676740]  ? __kthread_parkme+0x82/0x160
[   25.677156]  ? preempt_count_sub+0x50/0x80
[   25.677770]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.678388]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.678909]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.679603]  kthread+0x257/0x310
[   25.679959]  ? __pfx_kthread+0x10/0x10
[   25.680864]  ret_from_fork+0x41/0x80
[   25.681511]  ? __pfx_kthread+0x10/0x10
[   25.681913]  ret_from_fork_asm+0x1a/0x30
[   25.682601]  </TASK>
[   25.683061] 
[   25.683315] Allocated by task 200:
[   25.683899]  kasan_save_stack+0x3d/0x60
[   25.684832]  kasan_save_track+0x18/0x40
[   25.685430]  kasan_save_alloc_info+0x3b/0x50
[   25.685868]  __kasan_kmalloc+0xb7/0xc0
[   25.686584]  __kmalloc_cache_noprof+0x184/0x410
[   25.686950]  kmalloc_double_kzfree+0xaa/0x360
[   25.687689]  kunit_try_run_case+0x1b3/0x490
[   25.688476]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.689324]  kthread+0x257/0x310
[   25.689709]  ret_from_fork+0x41/0x80
[   25.690277]  ret_from_fork_asm+0x1a/0x30
[   25.690649] 
[   25.691055] Freed by task 200:
[   25.691442]  kasan_save_stack+0x3d/0x60
[   25.692228]  kasan_save_track+0x18/0x40
[   25.692750]  kasan_save_free_info+0x3f/0x60
[   25.693424]  __kasan_slab_free+0x56/0x70
[   25.694142]  kfree+0x123/0x3f0
[   25.694514]  kfree_sensitive+0x67/0x90
[   25.695062]  kmalloc_double_kzfree+0x12c/0x360
[   25.695570]  kunit_try_run_case+0x1b3/0x490
[   25.696458]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.697091]  kthread+0x257/0x310
[   25.697387]  ret_from_fork+0x41/0x80
[   25.697816]  ret_from_fork_asm+0x1a/0x30
[   25.698575] 
[   25.698859] The buggy address belongs to the object at ffff888102699d60
[   25.698859]  which belongs to the cache kmalloc-16 of size 16
[   25.699863] The buggy address is located 0 bytes inside of
[   25.699863]  16-byte region [ffff888102699d60, ffff888102699d70)
[   25.700889] 
[   25.701460] The buggy address belongs to the physical page:
[   25.702325] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102699
[   25.702969] flags: 0x200000000000000(node=0|zone=2)
[   25.703655] page_type: f5(slab)
[   25.703925] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   25.704664] raw: 0000000000000000 0000000080800080 00000001f5000000 0000000000000000
[   25.705648] page dumped because: kasan: bad access detected
[   25.706408] 
[   25.706576] Memory state around the buggy address:
[   25.706975]  ffff888102699c00: 00 02 fc fc 00 02 fc fc 00 02 fc fc fa fb fc fc
[   25.707586]  ffff888102699c80: fa fb fc fc fa fb fc fc 00 05 fc fc 00 04 fc fc
[   25.708473] >ffff888102699d00: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   25.709241]                                                        ^
[   25.709605]  ffff888102699d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.710642]  ffff888102699e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.711287] ==================================================================