Hay
Date
May 12, 2025, 11:48 a.m.

Environment
qemu-arm64
qemu-x86_64

[   16.937257] ==================================================================
[   16.937403] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x3f4/0x468
[   16.937513] Read of size 1 at addr fff00000c7941028 by task kunit_try_catch/188
[   16.937611] 
[   16.937669] CPU: 1 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT 
[   16.937899] Tainted: [B]=BAD_PAGE, [N]=TEST
[   16.938092] Hardware name: linux,dummy-virt (DT)
[   16.938131] Call trace:
[   16.938156]  show_stack+0x20/0x38 (C)
[   16.938214]  dump_stack_lvl+0x8c/0xd0
[   16.938569]  print_report+0x118/0x608
[   16.938669]  kasan_report+0xdc/0x128
[   16.938758]  __asan_report_load1_noabort+0x20/0x30
[   16.938861]  kmalloc_uaf2+0x3f4/0x468
[   16.939010]  kunit_try_run_case+0x170/0x3f0
[   16.939128]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.939246]  kthread+0x328/0x630
[   16.939344]  ret_from_fork+0x10/0x20
[   16.939449] 
[   16.939504] Allocated by task 188:
[   16.939571]  kasan_save_stack+0x3c/0x68
[   16.939654]  kasan_save_track+0x20/0x40
[   16.939748]  kasan_save_alloc_info+0x40/0x58
[   16.939836]  __kasan_kmalloc+0xd4/0xd8
[   16.939915]  __kmalloc_cache_noprof+0x15c/0x3c0
[   16.940017]  kmalloc_uaf2+0xc4/0x468
[   16.941069]  kunit_try_run_case+0x170/0x3f0
[   16.941166]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.941259]  kthread+0x328/0x630
[   16.941337]  ret_from_fork+0x10/0x20
[   16.941418] 
[   16.941458] Freed by task 188:
[   16.941829]  kasan_save_stack+0x3c/0x68
[   16.941939]  kasan_save_track+0x20/0x40
[   16.942477]  kasan_save_free_info+0x4c/0x78
[   16.942683]  __kasan_slab_free+0x6c/0x98
[   16.942769]  kfree+0x214/0x3c8
[   16.942862]  kmalloc_uaf2+0x134/0x468
[   16.942949]  kunit_try_run_case+0x170/0x3f0
[   16.943236]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.943510]  kthread+0x328/0x630
[   16.943689]  ret_from_fork+0x10/0x20
[   16.943843] 
[   16.943907] The buggy address belongs to the object at fff00000c7941000
[   16.943907]  which belongs to the cache kmalloc-64 of size 64
[   16.944109] The buggy address is located 40 bytes inside of
[   16.944109]  freed 64-byte region [fff00000c7941000, fff00000c7941040)
[   16.944455] 
[   16.944534] The buggy address belongs to the physical page:
[   16.944754] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107941
[   16.944956] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   16.945127] page_type: f5(slab)
[   16.945204] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   16.945509] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   16.945649] page dumped because: kasan: bad access detected
[   16.945919] 
[   16.946006] Memory state around the buggy address:
[   16.946244]  fff00000c7940f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.946433]  fff00000c7940f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.946535] >fff00000c7941000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   16.946802]                                   ^
[   16.946882]  fff00000c7941080: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   16.946982]  fff00000c7941100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.947185] ==================================================================

[   16.995502] ==================================================================
[   16.996013] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   16.996683] Read of size 1 at addr ffff888102316428 by task kunit_try_catch/205
[   16.997223] 
[   16.997678] CPU: 0 UID: 0 PID: 205 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT(voluntary) 
[   16.998157] Tainted: [B]=BAD_PAGE, [N]=TEST
[   16.998194] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   16.998240] Call Trace:
[   16.998281]  <TASK>
[   16.998318]  dump_stack_lvl+0x73/0xb0
[   16.998380]  print_report+0xd1/0x650
[   16.998419]  ? __virt_addr_valid+0x1db/0x2d0
[   16.998448]  ? kmalloc_uaf2+0x4a8/0x520
[   16.998470]  ? kasan_complete_mode_report_info+0x64/0x200
[   16.998493]  ? kmalloc_uaf2+0x4a8/0x520
[   16.998515]  kasan_report+0x141/0x180
[   16.998538]  ? kmalloc_uaf2+0x4a8/0x520
[   16.998564]  __asan_report_load1_noabort+0x18/0x20
[   16.998585]  kmalloc_uaf2+0x4a8/0x520
[   16.998607]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   16.998628]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   16.998664]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   16.998717]  kunit_try_run_case+0x1a5/0x480
[   16.998749]  ? __pfx_kunit_try_run_case+0x10/0x10
[   16.998772]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   16.998798]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   16.998821]  ? __kthread_parkme+0x82/0x180
[   16.998844]  ? preempt_count_sub+0x50/0x80
[   16.998870]  ? __pfx_kunit_try_run_case+0x10/0x10
[   16.998894]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   16.998918]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   16.998942]  kthread+0x337/0x6f0
[   16.998963]  ? trace_preempt_on+0x20/0xc0
[   16.998997]  ? __pfx_kthread+0x10/0x10
[   16.999024]  ? _raw_spin_unlock_irq+0x47/0x80
[   16.999055]  ? calculate_sigpending+0x7b/0xa0
[   16.999095]  ? __pfx_kthread+0x10/0x10
[   16.999128]  ret_from_fork+0x116/0x1d0
[   16.999159]  ? __pfx_kthread+0x10/0x10
[   16.999192]  ret_from_fork_asm+0x1a/0x30
[   16.999227]  </TASK>
[   16.999242] 
[   17.012330] Allocated by task 205:
[   17.012728]  kasan_save_stack+0x45/0x70
[   17.013300]  kasan_save_track+0x18/0x40
[   17.013713]  kasan_save_alloc_info+0x3b/0x50
[   17.014218]  __kasan_kmalloc+0xb7/0xc0
[   17.014663]  __kmalloc_cache_noprof+0x189/0x420
[   17.015245]  kmalloc_uaf2+0xc6/0x520
[   17.015464]  kunit_try_run_case+0x1a5/0x480
[   17.016066]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.016409]  kthread+0x337/0x6f0
[   17.016618]  ret_from_fork+0x116/0x1d0
[   17.016901]  ret_from_fork_asm+0x1a/0x30
[   17.017182] 
[   17.017355] Freed by task 205:
[   17.017610]  kasan_save_stack+0x45/0x70
[   17.017803]  kasan_save_track+0x18/0x40
[   17.018113]  kasan_save_free_info+0x3f/0x60
[   17.018603]  __kasan_slab_free+0x56/0x70
[   17.018901]  kfree+0x222/0x3f0
[   17.019358]  kmalloc_uaf2+0x14c/0x520
[   17.019613]  kunit_try_run_case+0x1a5/0x480
[   17.019943]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.020412]  kthread+0x337/0x6f0
[   17.020607]  ret_from_fork+0x116/0x1d0
[   17.020942]  ret_from_fork_asm+0x1a/0x30
[   17.021449] 
[   17.021641] The buggy address belongs to the object at ffff888102316400
[   17.021641]  which belongs to the cache kmalloc-64 of size 64
[   17.022483] The buggy address is located 40 bytes inside of
[   17.022483]  freed 64-byte region [ffff888102316400, ffff888102316440)
[   17.023341] 
[   17.023527] The buggy address belongs to the physical page:
[   17.023990] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102316
[   17.024548] flags: 0x200000000000000(node=0|zone=2)
[   17.024982] page_type: f5(slab)
[   17.025426] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   17.025838] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   17.026527] page dumped because: kasan: bad access detected
[   17.026971] 
[   17.027326] Memory state around the buggy address:
[   17.027573]  ffff888102316300: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.028185]  ffff888102316380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.028728] >ffff888102316400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.029208]                                   ^
[   17.029591]  ffff888102316480: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   17.030295]  ffff888102316500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.030724] ==================================================================