Hay
Date
May 15, 2025, 10:38 a.m.

Environment
qemu-arm64
qemu-x86_64

[   18.003610] ==================================================================
[   18.003711] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x3bc/0x438
[   18.003765] Read of size 16 at addr fff00000c5ccd2e0 by task kunit_try_catch/168
[   18.003825] 
[   18.004067] CPU: 1 UID: 0 PID: 168 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250515 #1 PREEMPT 
[   18.004177] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.004204] Hardware name: linux,dummy-virt (DT)
[   18.004341] Call trace:
[   18.004399]  show_stack+0x20/0x38 (C)
[   18.004452]  dump_stack_lvl+0x8c/0xd0
[   18.004779]  print_report+0x118/0x608
[   18.004892]  kasan_report+0xdc/0x128
[   18.004942]  __asan_report_load16_noabort+0x20/0x30
[   18.005227]  kmalloc_uaf_16+0x3bc/0x438
[   18.005323]  kunit_try_run_case+0x170/0x3f0
[   18.005388]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.005441]  kthread+0x328/0x630
[   18.005683]  ret_from_fork+0x10/0x20
[   18.006213] 
[   18.006234] Allocated by task 168:
[   18.006285]  kasan_save_stack+0x3c/0x68
[   18.006646]  kasan_save_track+0x20/0x40
[   18.006740]  kasan_save_alloc_info+0x40/0x58
[   18.006782]  __kasan_kmalloc+0xd4/0xd8
[   18.006826]  __kmalloc_cache_noprof+0x15c/0x3c0
[   18.006864]  kmalloc_uaf_16+0x140/0x438
[   18.006897]  kunit_try_run_case+0x170/0x3f0
[   18.006941]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.006989]  kthread+0x328/0x630
[   18.007023]  ret_from_fork+0x10/0x20
[   18.007057] 
[   18.007076] Freed by task 168:
[   18.007102]  kasan_save_stack+0x3c/0x68
[   18.007138]  kasan_save_track+0x20/0x40
[   18.007185]  kasan_save_free_info+0x4c/0x78
[   18.007222]  __kasan_slab_free+0x6c/0x98
[   18.007258]  kfree+0x214/0x3c8
[   18.007298]  kmalloc_uaf_16+0x190/0x438
[   18.007339]  kunit_try_run_case+0x170/0x3f0
[   18.007374]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.007429]  kthread+0x328/0x630
[   18.007462]  ret_from_fork+0x10/0x20
[   18.007496] 
[   18.007525] The buggy address belongs to the object at fff00000c5ccd2e0
[   18.007525]  which belongs to the cache kmalloc-16 of size 16
[   18.007580] The buggy address is located 0 bytes inside of
[   18.007580]  freed 16-byte region [fff00000c5ccd2e0, fff00000c5ccd2f0)
[   18.007637] 
[   18.007656] The buggy address belongs to the physical page:
[   18.007686] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105ccd
[   18.007743] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.007790] page_type: f5(slab)
[   18.007833] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   18.007903] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   18.007951] page dumped because: kasan: bad access detected
[   18.007989] 
[   18.008007] Memory state around the buggy address:
[   18.008037]  fff00000c5ccd180: 00 02 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   18.008077]  fff00000c5ccd200: fa fb fc fc fa fb fc fc 00 04 fc fc fa fb fc fc
[   18.008132] >fff00000c5ccd280: fa fb fc fc fa fb fc fc 00 00 fc fc fa fb fc fc
[   18.008917]                                                        ^
[   18.009011]  fff00000c5ccd300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.009077]  fff00000c5ccd380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.009131] ==================================================================


[   14.068884] ==================================================================
[   14.069367] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x47b/0x4c0
[   14.069866] Read of size 16 at addr ffff888102817b40 by task kunit_try_catch/186
[   14.070080] 
[   14.070185] CPU: 0 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250515 #1 PREEMPT(voluntary) 
[   14.070266] Tainted: [B]=BAD_PAGE, [N]=TEST
[   14.070286] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   14.070324] Call Trace:
[   14.070357]  <TASK>
[   14.070391]  dump_stack_lvl+0x73/0xb0
[   14.070795]  print_report+0xd1/0x650
[   14.070908]  ? __virt_addr_valid+0x1db/0x2d0
[   14.070972]  ? kmalloc_uaf_16+0x47b/0x4c0
[   14.071026]  ? kasan_complete_mode_report_info+0x64/0x200
[   14.071077]  ? kmalloc_uaf_16+0x47b/0x4c0
[   14.071124]  kasan_report+0x141/0x180
[   14.071167]  ? kmalloc_uaf_16+0x47b/0x4c0
[   14.071218]  __asan_report_load16_noabort+0x18/0x20
[   14.071272]  kmalloc_uaf_16+0x47b/0x4c0
[   14.071334]  ? __pfx_kmalloc_uaf_16+0x10/0x10
[   14.071384]  ? __pfx_kmalloc_uaf_16+0x10/0x10
[   14.071435]  kunit_try_run_case+0x1a5/0x480
[   14.071521]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.071562]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   14.071741]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   14.071781]  ? __kthread_parkme+0x82/0x180
[   14.071813]  ? preempt_count_sub+0x50/0x80
[   14.071842]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.071866]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.071938]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   14.071963]  kthread+0x337/0x6f0
[   14.071983]  ? trace_preempt_on+0x20/0xc0
[   14.072009]  ? __pfx_kthread+0x10/0x10
[   14.072029]  ? _raw_spin_unlock_irq+0x47/0x80
[   14.072050]  ? calculate_sigpending+0x7b/0xa0
[   14.072074]  ? __pfx_kthread+0x10/0x10
[   14.072095]  ret_from_fork+0x116/0x1d0
[   14.072115]  ? __pfx_kthread+0x10/0x10
[   14.072135]  ret_from_fork_asm+0x1a/0x30
[   14.072167]  </TASK>
[   14.072180] 
[   14.083314] Allocated by task 186:
[   14.083676]  kasan_save_stack+0x45/0x70
[   14.084078]  kasan_save_track+0x18/0x40
[   14.084406]  kasan_save_alloc_info+0x3b/0x50
[   14.084813]  __kasan_kmalloc+0xb7/0xc0
[   14.085153]  __kmalloc_cache_noprof+0x189/0x420
[   14.085682]  kmalloc_uaf_16+0x15b/0x4c0
[   14.086028]  kunit_try_run_case+0x1a5/0x480
[   14.086479]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.086947]  kthread+0x337/0x6f0
[   14.087252]  ret_from_fork+0x116/0x1d0
[   14.087620]  ret_from_fork_asm+0x1a/0x30
[   14.087969] 
[   14.088249] Freed by task 186:
[   14.088511]  kasan_save_stack+0x45/0x70
[   14.088859]  kasan_save_track+0x18/0x40
[   14.089155]  kasan_save_free_info+0x3f/0x60
[   14.089570]  __kasan_slab_free+0x56/0x70
[   14.089785]  kfree+0x222/0x3f0
[   14.089973]  kmalloc_uaf_16+0x1d6/0x4c0
[   14.090358]  kunit_try_run_case+0x1a5/0x480
[   14.090786]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.091198]  kthread+0x337/0x6f0
[   14.091603]  ret_from_fork+0x116/0x1d0
[   14.092067]  ret_from_fork_asm+0x1a/0x30
[   14.092398] 
[   14.092609] The buggy address belongs to the object at ffff888102817b40
[   14.092609]  which belongs to the cache kmalloc-16 of size 16
[   14.093446] The buggy address is located 0 bytes inside of
[   14.093446]  freed 16-byte region [ffff888102817b40, ffff888102817b50)
[   14.094091] 
[   14.094293] The buggy address belongs to the physical page:
[   14.094779] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102817
[   14.095644] flags: 0x200000000000000(node=0|zone=2)
[   14.096026] page_type: f5(slab)
[   14.096386] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   14.096899] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   14.097879] page dumped because: kasan: bad access detected
[   14.098247] 
[   14.098404] Memory state around the buggy address:
[   14.098691]  ffff888102817a00: 00 02 fc fc 00 05 fc fc 00 02 fc fc 00 02 fc fc
[   14.099910]  ffff888102817a80: 00 02 fc fc 00 02 fc fc fa fb fc fc fa fb fc fc
[   14.100268] >ffff888102817b00: fa fb fc fc 00 00 fc fc fa fb fc fc fc fc fc fc
[   14.100723]                                            ^
[   14.100952]  ffff888102817b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.103435]  ffff888102817c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.104005] ==================================================================