Hay
Date
Dec. 4, 2024, 3:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   32.567388] ==================================================================
[   32.568896] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x168/0x308
[   32.569607] Read of size 1 at addr fff00000c5b31d20 by task kunit_try_catch/180
[   32.570769] 
[   32.571155] CPU: 0 UID: 0 PID: 180 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   32.572345] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.573558] Hardware name: linux,dummy-virt (DT)
[   32.574201] Call trace:
[   32.575173]  show_stack+0x20/0x38 (C)
[   32.575998]  dump_stack_lvl+0x8c/0xd0
[   32.576891]  print_report+0x118/0x5e0
[   32.577550]  kasan_report+0xc8/0x118
[   32.578391]  __kasan_check_byte+0x54/0x70
[   32.579027]  kfree_sensitive+0x30/0xb0
[   32.579478]  kmalloc_double_kzfree+0x168/0x308
[   32.580699]  kunit_try_run_case+0x14c/0x3d0
[   32.581323]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.582358]  kthread+0x24c/0x2d0
[   32.582983]  ret_from_fork+0x10/0x20
[   32.584105] 
[   32.584368] Allocated by task 180:
[   32.585062]  kasan_save_stack+0x3c/0x68
[   32.586831]  kasan_save_track+0x20/0x40
[   32.587500]  kasan_save_alloc_info+0x40/0x58
[   32.588085]  __kasan_kmalloc+0xd4/0xd8
[   32.588604]  __kmalloc_cache_noprof+0x15c/0x3c0
[   32.589608]  kmalloc_double_kzfree+0xb8/0x308
[   32.590642]  kunit_try_run_case+0x14c/0x3d0
[   32.591545]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.592291]  kthread+0x24c/0x2d0
[   32.592920]  ret_from_fork+0x10/0x20
[   32.593616] 
[   32.595044] Freed by task 180:
[   32.595580]  kasan_save_stack+0x3c/0x68
[   32.596312]  kasan_save_track+0x20/0x40
[   32.597114]  kasan_save_free_info+0x4c/0x78
[   32.597888]  __kasan_slab_free+0x6c/0x98
[   32.599266]  kfree+0x114/0x3c8
[   32.599702]  kfree_sensitive+0x80/0xb0
[   32.600476]  kmalloc_double_kzfree+0x11c/0x308
[   32.601137]  kunit_try_run_case+0x14c/0x3d0
[   32.601842]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.603030]  kthread+0x24c/0x2d0
[   32.603413]  ret_from_fork+0x10/0x20
[   32.604160] 
[   32.604845] The buggy address belongs to the object at fff00000c5b31d20
[   32.604845]  which belongs to the cache kmalloc-16 of size 16
[   32.606657] The buggy address is located 0 bytes inside of
[   32.606657]  freed 16-byte region [fff00000c5b31d20, fff00000c5b31d30)
[   32.608048] 
[   32.608362] The buggy address belongs to the physical page:
[   32.609242] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105b31
[   32.610179] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   32.611310] page_type: f5(slab)
[   32.612281] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   32.613723] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   32.615459] page dumped because: kasan: bad access detected
[   32.616509] 
[   32.617027] Memory state around the buggy address:
[   32.617820]  fff00000c5b31c00: 00 06 fc fc 00 06 fc fc fa fb fc fc 00 06 fc fc
[   32.618800]  fff00000c5b31c80: 00 06 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   32.619834] >fff00000c5b31d00: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   32.622279]                                ^
[   32.623085]  fff00000c5b31d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.624149]  fff00000c5b31e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.625105] ==================================================================

[   23.377089] ==================================================================
[   23.378600] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x19d/0x360
[   23.380216] Read of size 1 at addr ffff888101adf0e0 by task kunit_try_catch/200
[   23.380996] 
[   23.381287] CPU: 0 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   23.382574] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.383000] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   23.384856] Call Trace:
[   23.385259]  <TASK>
[   23.385555]  dump_stack_lvl+0x73/0xb0
[   23.386544]  print_report+0xd1/0x640
[   23.386845]  ? __virt_addr_valid+0x1db/0x2d0
[   23.387979]  ? kasan_complete_mode_report_info+0x64/0x200
[   23.388958]  kasan_report+0x102/0x140
[   23.389400]  ? kmalloc_double_kzfree+0x19d/0x360
[   23.389942]  ? kmalloc_double_kzfree+0x19d/0x360
[   23.391152]  ? kmalloc_double_kzfree+0x19d/0x360
[   23.391967]  __kasan_check_byte+0x3d/0x50
[   23.392605]  kfree_sensitive+0x22/0x90
[   23.393001]  kmalloc_double_kzfree+0x19d/0x360
[   23.393400]  ? __pfx_kmalloc_double_kzfree+0x10/0x10
[   23.393841]  ? __schedule+0xc3e/0x2790
[   23.394829]  ? __pfx_read_tsc+0x10/0x10
[   23.395287]  ? ktime_get_ts64+0x86/0x230
[   23.396254]  kunit_try_run_case+0x1b3/0x490
[   23.397026]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.397874]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   23.398477]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   23.399272]  ? __kthread_parkme+0x82/0x160
[   23.399993]  ? preempt_count_sub+0x50/0x80
[   23.401021]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.401446]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   23.402085]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.403219]  kthread+0x257/0x310
[   23.403756]  ? __pfx_kthread+0x10/0x10
[   23.404031]  ret_from_fork+0x41/0x80
[   23.404348]  ? __pfx_kthread+0x10/0x10
[   23.404751]  ret_from_fork_asm+0x1a/0x30
[   23.405255]  </TASK>
[   23.405467] 
[   23.405622] Allocated by task 200:
[   23.406074]  kasan_save_stack+0x3d/0x60
[   23.406566]  kasan_save_track+0x18/0x40
[   23.407020]  kasan_save_alloc_info+0x3b/0x50
[   23.407593]  __kasan_kmalloc+0xb7/0xc0
[   23.408019]  __kmalloc_cache_noprof+0x184/0x410
[   23.408546]  kmalloc_double_kzfree+0xaa/0x360
[   23.408843]  kunit_try_run_case+0x1b3/0x490
[   23.409378]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.410065]  kthread+0x257/0x310
[   23.410567]  ret_from_fork+0x41/0x80
[   23.410885]  ret_from_fork_asm+0x1a/0x30
[   23.411576] 
[   23.411724] Freed by task 200:
[   23.412116]  kasan_save_stack+0x3d/0x60
[   23.412486]  kasan_save_track+0x18/0x40
[   23.412843]  kasan_save_free_info+0x3f/0x60
[   23.413174]  __kasan_slab_free+0x56/0x70
[   23.413645]  kfree+0x123/0x3f0
[   23.414111]  kfree_sensitive+0x67/0x90
[   23.414598]  kmalloc_double_kzfree+0x12c/0x360
[   23.415036]  kunit_try_run_case+0x1b3/0x490
[   23.415410]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.416332]  kthread+0x257/0x310
[   23.416713]  ret_from_fork+0x41/0x80
[   23.417306]  ret_from_fork_asm+0x1a/0x30
[   23.417588] 
[   23.417743] The buggy address belongs to the object at ffff888101adf0e0
[   23.417743]  which belongs to the cache kmalloc-16 of size 16
[   23.418780] The buggy address is located 0 bytes inside of
[   23.418780]  freed 16-byte region [ffff888101adf0e0, ffff888101adf0f0)
[   23.419966] 
[   23.420128] The buggy address belongs to the physical page:
[   23.420753] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101adf
[   23.421702] flags: 0x200000000000000(node=0|zone=2)
[   23.422228] page_type: f5(slab)
[   23.422620] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   23.423319] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   23.423854] page dumped because: kasan: bad access detected
[   23.424191] 
[   23.424437] Memory state around the buggy address:
[   23.425063]  ffff888101adef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.425758]  ffff888101adf000: fa fb fc fc 00 04 fc fc 00 05 fc fc fa fb fc fc
[   23.426393] >ffff888101adf080: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   23.427148]                                                        ^
[   23.427574]  ffff888101adf100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.428420]  ffff888101adf180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.429218] ==================================================================