Hay
Date
July 1, 2025, 12:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   17.405671] ==================================================================
[   17.405766] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x3bc/0x438
[   17.405840] Read of size 16 at addr fff00000c4551880 by task kunit_try_catch/168
[   17.405891] 
[   17.405922] CPU: 1 UID: 0 PID: 168 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   17.406067] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.406101] Hardware name: linux,dummy-virt (DT)
[   17.406133] Call trace:
[   17.406193]  show_stack+0x20/0x38 (C)
[   17.406242]  dump_stack_lvl+0x8c/0xd0
[   17.406289]  print_report+0x118/0x608
[   17.406470]  kasan_report+0xdc/0x128
[   17.406523]  __asan_report_load16_noabort+0x20/0x30
[   17.406803]  kmalloc_uaf_16+0x3bc/0x438
[   17.406912]  kunit_try_run_case+0x170/0x3f0
[   17.407197]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.407288]  kthread+0x328/0x630
[   17.407329]  ret_from_fork+0x10/0x20
[   17.407376] 
[   17.407394] Allocated by task 168:
[   17.407421]  kasan_save_stack+0x3c/0x68
[   17.407472]  kasan_save_track+0x20/0x40
[   17.407857]  kasan_save_alloc_info+0x40/0x58
[   17.407963]  __kasan_kmalloc+0xd4/0xd8
[   17.408091]  __kmalloc_cache_noprof+0x16c/0x3c0
[   17.408129]  kmalloc_uaf_16+0x140/0x438
[   17.408223]  kunit_try_run_case+0x170/0x3f0
[   17.408410]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.408576]  kthread+0x328/0x630
[   17.408631]  ret_from_fork+0x10/0x20
[   17.408667] 
[   17.408686] Freed by task 168:
[   17.408733]  kasan_save_stack+0x3c/0x68
[   17.408780]  kasan_save_track+0x20/0x40
[   17.408815]  kasan_save_free_info+0x4c/0x78
[   17.408853]  __kasan_slab_free+0x6c/0x98
[   17.408889]  kfree+0x214/0x3c8
[   17.408921]  kmalloc_uaf_16+0x190/0x438
[   17.408967]  kunit_try_run_case+0x170/0x3f0
[   17.409003]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.409050]  kthread+0x328/0x630
[   17.409082]  ret_from_fork+0x10/0x20
[   17.409116] 
[   17.409135] The buggy address belongs to the object at fff00000c4551880
[   17.409135]  which belongs to the cache kmalloc-16 of size 16
[   17.409193] The buggy address is located 0 bytes inside of
[   17.409193]  freed 16-byte region [fff00000c4551880, fff00000c4551890)
[   17.409273] 
[   17.409293] The buggy address belongs to the physical page:
[   17.409346] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104551
[   17.409400] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.409537] page_type: f5(slab)
[   17.409580] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   17.409629] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   17.409678] page dumped because: kasan: bad access detected
[   17.409709] 
[   17.409727] Memory state around the buggy address:
[   17.409766]  fff00000c4551780: fa fb fc fc fa fb fc fc 00 05 fc fc fa fb fc fc
[   17.409811]  fff00000c4551800: fa fb fc fc fa fb fc fc fa fb fc fc 00 00 fc fc
[   17.409864] >fff00000c4551880: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.409913]                    ^
[   17.409940]  fff00000c4551900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.409982]  fff00000c4551980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.410020] ==================================================================

[   11.487848] ==================================================================
[   11.488390] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x47b/0x4c0
[   11.488691] Read of size 16 at addr ffff8881027a10a0 by task kunit_try_catch/185
[   11.489020] 
[   11.489198] CPU: 0 UID: 0 PID: 185 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   11.489241] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.489252] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.489274] Call Trace:
[   11.489285]  <TASK>
[   11.489300]  dump_stack_lvl+0x73/0xb0
[   11.489328]  print_report+0xd1/0x650
[   11.489349]  ? __virt_addr_valid+0x1db/0x2d0
[   11.489384]  ? kmalloc_uaf_16+0x47b/0x4c0
[   11.489404]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.489425]  ? kmalloc_uaf_16+0x47b/0x4c0
[   11.489460]  kasan_report+0x141/0x180
[   11.489481]  ? kmalloc_uaf_16+0x47b/0x4c0
[   11.489519]  __asan_report_load16_noabort+0x18/0x20
[   11.489542]  kmalloc_uaf_16+0x47b/0x4c0
[   11.489563]  ? __pfx_kmalloc_uaf_16+0x10/0x10
[   11.489596]  ? __schedule+0x10cc/0x2b60
[   11.489617]  ? __pfx_read_tsc+0x10/0x10
[   11.489638]  ? ktime_get_ts64+0x86/0x230
[   11.489673]  kunit_try_run_case+0x1a5/0x480
[   11.489698]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.489720]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.489754]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.489775]  ? __kthread_parkme+0x82/0x180
[   11.489795]  ? preempt_count_sub+0x50/0x80
[   11.489828]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.489850]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.489872]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.489894]  kthread+0x337/0x6f0
[   11.489912]  ? trace_preempt_on+0x20/0xc0
[   11.489935]  ? __pfx_kthread+0x10/0x10
[   11.489955]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.489974]  ? calculate_sigpending+0x7b/0xa0
[   11.490005]  ? __pfx_kthread+0x10/0x10
[   11.490056]  ret_from_fork+0x116/0x1d0
[   11.490075]  ? __pfx_kthread+0x10/0x10
[   11.490094]  ret_from_fork_asm+0x1a/0x30
[   11.490124]  </TASK>
[   11.490150] 
[   11.497637] Allocated by task 185:
[   11.497852]  kasan_save_stack+0x45/0x70
[   11.498357]  kasan_save_track+0x18/0x40
[   11.498586]  kasan_save_alloc_info+0x3b/0x50
[   11.498804]  __kasan_kmalloc+0xb7/0xc0
[   11.499006]  __kmalloc_cache_noprof+0x189/0x420
[   11.499338]  kmalloc_uaf_16+0x15b/0x4c0
[   11.499537]  kunit_try_run_case+0x1a5/0x480
[   11.499744]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.499982]  kthread+0x337/0x6f0
[   11.500234]  ret_from_fork+0x116/0x1d0
[   11.500431]  ret_from_fork_asm+0x1a/0x30
[   11.500609] 
[   11.500679] Freed by task 185:
[   11.500858]  kasan_save_stack+0x45/0x70
[   11.501100]  kasan_save_track+0x18/0x40
[   11.501265]  kasan_save_free_info+0x3f/0x60
[   11.501414]  __kasan_slab_free+0x56/0x70
[   11.501614]  kfree+0x222/0x3f0
[   11.501801]  kmalloc_uaf_16+0x1d6/0x4c0
[   11.501992]  kunit_try_run_case+0x1a5/0x480
[   11.502293]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.502473]  kthread+0x337/0x6f0
[   11.502617]  ret_from_fork+0x116/0x1d0
[   11.502805]  ret_from_fork_asm+0x1a/0x30
[   11.503031] 
[   11.503348] The buggy address belongs to the object at ffff8881027a10a0
[   11.503348]  which belongs to the cache kmalloc-16 of size 16
[   11.503853] The buggy address is located 0 bytes inside of
[   11.503853]  freed 16-byte region [ffff8881027a10a0, ffff8881027a10b0)
[   11.504430] 
[   11.504509] The buggy address belongs to the physical page:
[   11.504732] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1027a1
[   11.505178] flags: 0x200000000000000(node=0|zone=2)
[   11.505422] page_type: f5(slab)
[   11.505587] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   11.505931] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   11.506289] page dumped because: kasan: bad access detected
[   11.506573] 
[   11.506667] Memory state around the buggy address:
[   11.506874]  ffff8881027a0f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.507267]  ffff8881027a1000: fa fb fc fc fa fb fc fc 00 05 fc fc fa fb fc fc
[   11.507587] >ffff8881027a1080: 00 00 fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   11.507924]                                ^
[   11.508358]  ffff8881027a1100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.508616]  ffff8881027a1180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.508828] ==================================================================