Hay
Date
July 4, 2025, 11:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   29.656152] ==================================================================
[   29.656212] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   29.656262] Read of size 1 at addr fff00000c5a48a28 by task kunit_try_catch/217
[   29.656311] 
[   29.656341] CPU: 0 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4-next-20250704 #1 PREEMPT 
[   29.656426] Tainted: [B]=BAD_PAGE, [N]=TEST
[   29.656452] Hardware name: linux,dummy-virt (DT)
[   29.656484] Call trace:
[   29.656507]  show_stack+0x20/0x38 (C)
[   29.656554]  dump_stack_lvl+0x8c/0xd0
[   29.656597]  print_report+0x118/0x608
[   29.656644]  kasan_report+0xdc/0x128
[   29.656688]  __asan_report_load1_noabort+0x20/0x30
[   29.656735]  kmalloc_uaf+0x300/0x338
[   29.656779]  kunit_try_run_case+0x170/0x3f0
[   29.656833]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.656886]  kthread+0x328/0x630
[   29.656940]  ret_from_fork+0x10/0x20
[   29.656988] 
[   29.657040] Allocated by task 217:
[   29.657080]  kasan_save_stack+0x3c/0x68
[   29.657133]  kasan_save_track+0x20/0x40
[   29.657172]  kasan_save_alloc_info+0x40/0x58
[   29.657210]  __kasan_kmalloc+0xd4/0xd8
[   29.657246]  __kmalloc_cache_noprof+0x16c/0x3c0
[   29.657286]  kmalloc_uaf+0xb8/0x338
[   29.657322]  kunit_try_run_case+0x170/0x3f0
[   29.657359]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.657414]  kthread+0x328/0x630
[   29.657446]  ret_from_fork+0x10/0x20
[   29.657486] 
[   29.657507] Freed by task 217:
[   29.657533]  kasan_save_stack+0x3c/0x68
[   29.657571]  kasan_save_track+0x20/0x40
[   29.657608]  kasan_save_free_info+0x4c/0x78
[   29.657645]  __kasan_slab_free+0x6c/0x98
[   29.657683]  kfree+0x214/0x3c8
[   29.657716]  kmalloc_uaf+0x11c/0x338
[   29.657752]  kunit_try_run_case+0x170/0x3f0
[   29.657790]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.657835]  kthread+0x328/0x630
[   29.657869]  ret_from_fork+0x10/0x20
[   29.657915] 
[   29.657933] The buggy address belongs to the object at fff00000c5a48a20
[   29.657933]  which belongs to the cache kmalloc-16 of size 16
[   29.657990] The buggy address is located 8 bytes inside of
[   29.657990]  freed 16-byte region [fff00000c5a48a20, fff00000c5a48a30)
[   29.658050] 
[   29.658071] The buggy address belongs to the physical page:
[   29.658111] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105a48
[   29.658163] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   29.658216] page_type: f5(slab)
[   29.658253] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   29.658302] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   29.658343] page dumped because: kasan: bad access detected
[   29.658375] 
[   29.658408] Memory state around the buggy address:
[   29.658441]  fff00000c5a48900: fa fb fc fc fa fb fc fc fa fb fc fc 00 04 fc fc
[   29.658484]  fff00000c5a48980: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   29.658526] >fff00000c5a48a00: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   29.658564]                                   ^
[   29.658595]  fff00000c5a48a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.658637]  fff00000c5a48b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.658674] ==================================================================

[   25.164676] ==================================================================
[   25.165255] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   25.165735] Read of size 1 at addr ffff888102b9b568 by task kunit_try_catch/233
[   25.166133] 
[   25.166332] CPU: 0 UID: 0 PID: 233 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4-next-20250704 #1 PREEMPT(voluntary) 
[   25.166399] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.166412] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.166436] Call Trace:
[   25.166449]  <TASK>
[   25.166480]  dump_stack_lvl+0x73/0xb0
[   25.166511]  print_report+0xd1/0x650
[   25.166535]  ? __virt_addr_valid+0x1db/0x2d0
[   25.166573]  ? kmalloc_uaf+0x320/0x380
[   25.166593]  ? kasan_complete_mode_report_info+0x64/0x200
[   25.166619]  ? kmalloc_uaf+0x320/0x380
[   25.166649]  kasan_report+0x141/0x180
[   25.166672]  ? kmalloc_uaf+0x320/0x380
[   25.166697]  __asan_report_load1_noabort+0x18/0x20
[   25.166733]  kmalloc_uaf+0x320/0x380
[   25.166754]  ? __pfx_kmalloc_uaf+0x10/0x10
[   25.166775]  ? __schedule+0x10cc/0x2b60
[   25.166801]  ? __pfx_read_tsc+0x10/0x10
[   25.166824]  ? ktime_get_ts64+0x86/0x230
[   25.166851]  kunit_try_run_case+0x1a5/0x480
[   25.166878]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.166904]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   25.166929]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.166954]  ? __kthread_parkme+0x82/0x180
[   25.166976]  ? preempt_count_sub+0x50/0x80
[   25.167000]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.167026]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.167051]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.167077]  kthread+0x337/0x6f0
[   25.167107]  ? trace_preempt_on+0x20/0xc0
[   25.167132]  ? __pfx_kthread+0x10/0x10
[   25.167154]  ? _raw_spin_unlock_irq+0x47/0x80
[   25.167188]  ? calculate_sigpending+0x7b/0xa0
[   25.167213]  ? __pfx_kthread+0x10/0x10
[   25.167236]  ret_from_fork+0x116/0x1d0
[   25.167268]  ? __pfx_kthread+0x10/0x10
[   25.167289]  ret_from_fork_asm+0x1a/0x30
[   25.167322]  </TASK>
[   25.167335] 
[   25.179293] Allocated by task 233:
[   25.179489]  kasan_save_stack+0x45/0x70
[   25.179687]  kasan_save_track+0x18/0x40
[   25.179873]  kasan_save_alloc_info+0x3b/0x50
[   25.180724]  __kasan_kmalloc+0xb7/0xc0
[   25.181069]  __kmalloc_cache_noprof+0x189/0x420
[   25.181611]  kmalloc_uaf+0xaa/0x380
[   25.181804]  kunit_try_run_case+0x1a5/0x480
[   25.182331]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.182799]  kthread+0x337/0x6f0
[   25.183387]  ret_from_fork+0x116/0x1d0
[   25.183686]  ret_from_fork_asm+0x1a/0x30
[   25.184061] 
[   25.184477] Freed by task 233:
[   25.184646]  kasan_save_stack+0x45/0x70
[   25.184833]  kasan_save_track+0x18/0x40
[   25.185475]  kasan_save_free_info+0x3f/0x60
[   25.185777]  __kasan_slab_free+0x56/0x70
[   25.186327]  kfree+0x222/0x3f0
[   25.186583]  kmalloc_uaf+0x12c/0x380
[   25.186757]  kunit_try_run_case+0x1a5/0x480
[   25.187203]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.187658]  kthread+0x337/0x6f0
[   25.188134]  ret_from_fork+0x116/0x1d0
[   25.188721]  ret_from_fork_asm+0x1a/0x30
[   25.189181] 
[   25.189412] The buggy address belongs to the object at ffff888102b9b560
[   25.189412]  which belongs to the cache kmalloc-16 of size 16
[   25.190502] The buggy address is located 8 bytes inside of
[   25.190502]  freed 16-byte region [ffff888102b9b560, ffff888102b9b570)
[   25.191463] 
[   25.191663] The buggy address belongs to the physical page:
[   25.192368] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102b9b
[   25.192818] flags: 0x200000000000000(node=0|zone=2)
[   25.193550] page_type: f5(slab)
[   25.194202] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   25.194555] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   25.194854] page dumped because: kasan: bad access detected
[   25.195086] 
[   25.195796] Memory state around the buggy address:
[   25.196136]  ffff888102b9b400: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   25.196918]  ffff888102b9b480: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   25.198168] >ffff888102b9b500: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   25.198598]                                                           ^
[   25.198879]  ffff888102b9b580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.199472]  ffff888102b9b600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.199940] ==================================================================