Hay
Date
May 13, 2025, 12:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   19.431588] ==================================================================
[   19.432242] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   19.432350] Read of size 1 at addr fff00000c4035108 by task kunit_try_catch/184
[   19.432447] 
[   19.432505] CPU: 1 UID: 0 PID: 184 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250513 #1 PREEMPT 
[   19.432608] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.432735] Hardware name: linux,dummy-virt (DT)
[   19.432928] Call trace:
[   19.433088]  show_stack+0x20/0x38 (C)
[   19.433239]  dump_stack_lvl+0x8c/0xd0
[   19.433450]  print_report+0x118/0x608
[   19.433517]  kasan_report+0xdc/0x128
[   19.433697]  __asan_report_load1_noabort+0x20/0x30
[   19.433770]  kmalloc_uaf+0x300/0x338
[   19.434156]  kunit_try_run_case+0x170/0x3f0
[   19.434240]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.434349]  kthread+0x328/0x630
[   19.435230]  ret_from_fork+0x10/0x20
[   19.435381] 
[   19.435506] Allocated by task 184:
[   19.435609]  kasan_save_stack+0x3c/0x68
[   19.435665]  kasan_save_track+0x20/0x40
[   19.435706]  kasan_save_alloc_info+0x40/0x58
[   19.435881]  __kasan_kmalloc+0xd4/0xd8
[   19.436245]  __kmalloc_cache_noprof+0x15c/0x3c0
[   19.436359]  kmalloc_uaf+0xb8/0x338
[   19.436400]  kunit_try_run_case+0x170/0x3f0
[   19.436496]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.436543]  kthread+0x328/0x630
[   19.436795]  ret_from_fork+0x10/0x20
[   19.436935] 
[   19.437046] Freed by task 184:
[   19.437353]  kasan_save_stack+0x3c/0x68
[   19.437504]  kasan_save_track+0x20/0x40
[   19.437624]  kasan_save_free_info+0x4c/0x78
[   19.437671]  __kasan_slab_free+0x6c/0x98
[   19.437710]  kfree+0x214/0x3c8
[   19.438499]  kmalloc_uaf+0x11c/0x338
[   19.438894]  kunit_try_run_case+0x170/0x3f0
[   19.438946]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.439107]  kthread+0x328/0x630
[   19.439243]  ret_from_fork+0x10/0x20
[   19.439425] 
[   19.439481] The buggy address belongs to the object at fff00000c4035100
[   19.439481]  which belongs to the cache kmalloc-16 of size 16
[   19.439747] The buggy address is located 8 bytes inside of
[   19.439747]  freed 16-byte region [fff00000c4035100, fff00000c4035110)
[   19.439823] 
[   19.439851] The buggy address belongs to the physical page:
[   19.439892] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104035
[   19.439955] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.440025] page_type: f5(slab)
[   19.440125] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   19.440218] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   19.440261] page dumped because: kasan: bad access detected
[   19.440296] 
[   19.440316] Memory state around the buggy address:
[   19.440351]  fff00000c4035000: 00 02 fc fc 00 05 fc fc fa fb fc fc fa fb fc fc
[   19.440406]  fff00000c4035080: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.440554] >fff00000c4035100: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.440657]                       ^
[   19.440817]  fff00000c4035180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.441098]  fff00000c4035200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.441147] ==================================================================

[   11.350982] ==================================================================
[   11.352503] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   11.353294] Read of size 1 at addr ffff888101d83648 by task kunit_try_catch/201
[   11.354009] 
[   11.354211] CPU: 0 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250513 #1 PREEMPT(voluntary) 
[   11.354259] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.354272] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.354292] Call Trace:
[   11.354473]  <TASK>
[   11.354505]  dump_stack_lvl+0x73/0xb0
[   11.354549]  print_report+0xd1/0x650
[   11.354573]  ? __virt_addr_valid+0x1db/0x2d0
[   11.354595]  ? kmalloc_uaf+0x320/0x380
[   11.354624]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.354647]  ? kmalloc_uaf+0x320/0x380
[   11.354668]  kasan_report+0x141/0x180
[   11.354690]  ? kmalloc_uaf+0x320/0x380
[   11.354715]  __asan_report_load1_noabort+0x18/0x20
[   11.354736]  kmalloc_uaf+0x320/0x380
[   11.354756]  ? __pfx_kmalloc_uaf+0x10/0x10
[   11.354777]  ? __schedule+0x10cc/0x2b60
[   11.354799]  ? __pfx_read_tsc+0x10/0x10
[   11.354819]  ? ktime_get_ts64+0x86/0x230
[   11.354843]  kunit_try_run_case+0x1a5/0x480
[   11.354868]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.354889]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.354912]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.354933]  ? __kthread_parkme+0x82/0x180
[   11.354954]  ? preempt_count_sub+0x50/0x80
[   11.354978]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.355002]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.355026]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.355049]  kthread+0x337/0x6f0
[   11.355068]  ? trace_preempt_on+0x20/0xc0
[   11.355091]  ? __pfx_kthread+0x10/0x10
[   11.355112]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.355132]  ? calculate_sigpending+0x7b/0xa0
[   11.355156]  ? __pfx_kthread+0x10/0x10
[   11.355177]  ret_from_fork+0x116/0x1d0
[   11.355195]  ? __pfx_kthread+0x10/0x10
[   11.355216]  ret_from_fork_asm+0x1a/0x30
[   11.355246]  </TASK>
[   11.355257] 
[   11.369515] Allocated by task 201:
[   11.369837]  kasan_save_stack+0x45/0x70
[   11.369997]  kasan_save_track+0x18/0x40
[   11.370132]  kasan_save_alloc_info+0x3b/0x50
[   11.370502]  __kasan_kmalloc+0xb7/0xc0
[   11.370958]  __kmalloc_cache_noprof+0x189/0x420
[   11.371507]  kmalloc_uaf+0xaa/0x380
[   11.372050]  kunit_try_run_case+0x1a5/0x480
[   11.372418]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.372716]  kthread+0x337/0x6f0
[   11.373055]  ret_from_fork+0x116/0x1d0
[   11.373445]  ret_from_fork_asm+0x1a/0x30
[   11.373871] 
[   11.373980] Freed by task 201:
[   11.374140]  kasan_save_stack+0x45/0x70
[   11.374545]  kasan_save_track+0x18/0x40
[   11.374880]  kasan_save_free_info+0x3f/0x60
[   11.375031]  __kasan_slab_free+0x56/0x70
[   11.375171]  kfree+0x222/0x3f0
[   11.375483]  kmalloc_uaf+0x12c/0x380
[   11.376054]  kunit_try_run_case+0x1a5/0x480
[   11.376530]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.377251]  kthread+0x337/0x6f0
[   11.377599]  ret_from_fork+0x116/0x1d0
[   11.377956]  ret_from_fork_asm+0x1a/0x30
[   11.378260] 
[   11.378475] The buggy address belongs to the object at ffff888101d83640
[   11.378475]  which belongs to the cache kmalloc-16 of size 16
[   11.379114] The buggy address is located 8 bytes inside of
[   11.379114]  freed 16-byte region [ffff888101d83640, ffff888101d83650)
[   11.380229] 
[   11.380382] The buggy address belongs to the physical page:
[   11.380733] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101d83
[   11.380977] flags: 0x200000000000000(node=0|zone=2)
[   11.381143] page_type: f5(slab)
[   11.381282] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   11.381734] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   11.382050] page dumped because: kasan: bad access detected
[   11.382377] 
[   11.382449] Memory state around the buggy address:
[   11.382750]  ffff888101d83500: 00 05 fc fc 00 02 fc fc 00 02 fc fc 00 02 fc fc
[   11.383145]  ffff888101d83580: 00 02 fc fc fa fb fc fc fa fb fc fc 00 05 fc fc
[   11.383685] >ffff888101d83600: fa fb fc fc fa fb fc fc fa fb fc fc fc fc fc fc
[   11.383930]                                               ^
[   11.384220]  ffff888101d83680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.384503]  ffff888101d83700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.384903] ==================================================================