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

Environment
qemu-arm64
qemu-x86_64

[   18.145457] ==================================================================
[   18.145772] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   18.146132] Read of size 1 at addr fff00000c5ccd308 by task kunit_try_catch/184
[   18.146690] 
[   18.147052] CPU: 1 UID: 0 PID: 184 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250515 #1 PREEMPT 
[   18.147193] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.147488] Hardware name: linux,dummy-virt (DT)
[   18.147600] Call trace:
[   18.147625]  show_stack+0x20/0x38 (C)
[   18.147956]  dump_stack_lvl+0x8c/0xd0
[   18.148108]  print_report+0x118/0x608
[   18.148510]  kasan_report+0xdc/0x128
[   18.148650]  __asan_report_load1_noabort+0x20/0x30
[   18.148878]  kmalloc_uaf+0x300/0x338
[   18.149125]  kunit_try_run_case+0x170/0x3f0
[   18.149253]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.149311]  kthread+0x328/0x630
[   18.149519]  ret_from_fork+0x10/0x20
[   18.149753] 
[   18.149839] Allocated by task 184:
[   18.149869]  kasan_save_stack+0x3c/0x68
[   18.150055]  kasan_save_track+0x20/0x40
[   18.150314]  kasan_save_alloc_info+0x40/0x58
[   18.150486]  __kasan_kmalloc+0xd4/0xd8
[   18.150578]  __kmalloc_cache_noprof+0x15c/0x3c0
[   18.150895]  kmalloc_uaf+0xb8/0x338
[   18.151039]  kunit_try_run_case+0x170/0x3f0
[   18.151222]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.151469]  kthread+0x328/0x630
[   18.151580]  ret_from_fork+0x10/0x20
[   18.151621] 
[   18.151686] Freed by task 184:
[   18.152136]  kasan_save_stack+0x3c/0x68
[   18.152262]  kasan_save_track+0x20/0x40
[   18.152302]  kasan_save_free_info+0x4c/0x78
[   18.152406]  __kasan_slab_free+0x6c/0x98
[   18.152625]  kfree+0x214/0x3c8
[   18.152795]  kmalloc_uaf+0x11c/0x338
[   18.152966]  kunit_try_run_case+0x170/0x3f0
[   18.153095]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.153274]  kthread+0x328/0x630
[   18.153650]  ret_from_fork+0x10/0x20
[   18.153857] 
[   18.153882] The buggy address belongs to the object at fff00000c5ccd300
[   18.153882]  which belongs to the cache kmalloc-16 of size 16
[   18.153965] The buggy address is located 8 bytes inside of
[   18.153965]  freed 16-byte region [fff00000c5ccd300, fff00000c5ccd310)
[   18.154302] 
[   18.154479] The buggy address belongs to the physical page:
[   18.154524] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105ccd
[   18.154854] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.155012] page_type: f5(slab)
[   18.155218] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   18.155453] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   18.155540] page dumped because: kasan: bad access detected
[   18.155736] 
[   18.155949] Memory state around the buggy address:
[   18.156100]  fff00000c5ccd200: fa fb fc fc fa fb fc fc 00 04 fc fc fa fb fc fc
[   18.156343]  fff00000c5ccd280: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   18.156576] >fff00000c5ccd300: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.156686]                       ^
[   18.156826]  fff00000c5ccd380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.156973]  fff00000c5ccd400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.157109] ==================================================================


[   14.334777] ==================================================================
[   14.335252] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   14.335702] Read of size 1 at addr ffff8881022a34a8 by task kunit_try_catch/202
[   14.336325] 
[   14.336499] CPU: 1 UID: 0 PID: 202 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250515 #1 PREEMPT(voluntary) 
[   14.336581] Tainted: [B]=BAD_PAGE, [N]=TEST
[   14.337042] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   14.337087] Call Trace:
[   14.337118]  <TASK>
[   14.337162]  dump_stack_lvl+0x73/0xb0
[   14.337252]  print_report+0xd1/0x650
[   14.337314]  ? __virt_addr_valid+0x1db/0x2d0
[   14.337353]  ? kmalloc_uaf+0x320/0x380
[   14.337380]  ? kasan_complete_mode_report_info+0x64/0x200
[   14.337407]  ? kmalloc_uaf+0x320/0x380
[   14.337433]  kasan_report+0x141/0x180
[   14.337466]  ? kmalloc_uaf+0x320/0x380
[   14.337561]  __asan_report_load1_noabort+0x18/0x20
[   14.337636]  kmalloc_uaf+0x320/0x380
[   14.337666]  ? __pfx_kmalloc_uaf+0x10/0x10
[   14.337693]  ? __schedule+0x10cc/0x2b60
[   14.337724]  ? __pfx_read_tsc+0x10/0x10
[   14.337751]  ? ktime_get_ts64+0x86/0x230
[   14.337782]  kunit_try_run_case+0x1a5/0x480
[   14.337814]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.337840]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   14.337867]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   14.337893]  ? __kthread_parkme+0x82/0x180
[   14.337919]  ? preempt_count_sub+0x50/0x80
[   14.337950]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.337977]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.338003]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   14.338030]  kthread+0x337/0x6f0
[   14.338054]  ? trace_preempt_on+0x20/0xc0
[   14.338082]  ? __pfx_kthread+0x10/0x10
[   14.338107]  ? _raw_spin_unlock_irq+0x47/0x80
[   14.338132]  ? calculate_sigpending+0x7b/0xa0
[   14.338162]  ? __pfx_kthread+0x10/0x10
[   14.338188]  ret_from_fork+0x116/0x1d0
[   14.338211]  ? __pfx_kthread+0x10/0x10
[   14.338262]  ret_from_fork_asm+0x1a/0x30
[   14.338298]  </TASK>
[   14.338311] 
[   14.347725] Allocated by task 202:
[   14.347880]  kasan_save_stack+0x45/0x70
[   14.348054]  kasan_save_track+0x18/0x40
[   14.348207]  kasan_save_alloc_info+0x3b/0x50
[   14.348441]  __kasan_kmalloc+0xb7/0xc0
[   14.349043]  __kmalloc_cache_noprof+0x189/0x420
[   14.349426]  kmalloc_uaf+0xaa/0x380
[   14.350586]  kunit_try_run_case+0x1a5/0x480
[   14.351048]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.351346]  kthread+0x337/0x6f0
[   14.352643]  ret_from_fork+0x116/0x1d0
[   14.352935]  ret_from_fork_asm+0x1a/0x30
[   14.353246] 
[   14.353399] Freed by task 202:
[   14.353654]  kasan_save_stack+0x45/0x70
[   14.354306]  kasan_save_track+0x18/0x40
[   14.354651]  kasan_save_free_info+0x3f/0x60
[   14.355179]  __kasan_slab_free+0x56/0x70
[   14.355502]  kfree+0x222/0x3f0
[   14.355772]  kmalloc_uaf+0x12c/0x380
[   14.355969]  kunit_try_run_case+0x1a5/0x480
[   14.356346]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.356878]  kthread+0x337/0x6f0
[   14.357118]  ret_from_fork+0x116/0x1d0
[   14.357309]  ret_from_fork_asm+0x1a/0x30
[   14.357747] 
[   14.357908] The buggy address belongs to the object at ffff8881022a34a0
[   14.357908]  which belongs to the cache kmalloc-16 of size 16
[   14.358506] The buggy address is located 8 bytes inside of
[   14.358506]  freed 16-byte region [ffff8881022a34a0, ffff8881022a34b0)
[   14.359154] 
[   14.359337] The buggy address belongs to the physical page:
[   14.359696] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1022a3
[   14.360672] flags: 0x200000000000000(node=0|zone=2)
[   14.361132] page_type: f5(slab)
[   14.361399] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   14.362159] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   14.362730] page dumped because: kasan: bad access detected
[   14.363118] 
[   14.363504] Memory state around the buggy address:
[   14.363867]  ffff8881022a3380: 00 02 fc fc 00 02 fc fc fa fb fc fc fa fb fc fc
[   14.364151]  ffff8881022a3400: 00 05 fc fc 00 04 fc fc fa fb fc fc fa fb fc fc
[   14.364784] >ffff8881022a3480: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   14.365021]                                   ^
[   14.365310]  ffff8881022a3500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.365815]  ffff8881022a3580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.366268] ==================================================================