Hay
Date
July 9, 2025, 1:08 p.m.

Environment
qemu-arm64
qemu-x86_64

[   29.453290] ==================================================================
[   29.453405] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   29.453459] Write of size 33 at addr fff00000c598cc80 by task kunit_try_catch/218
[   29.453548] 
[   29.453623] CPU: 0 UID: 0 PID: 218 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5-next-20250709 #1 PREEMPT 
[   29.453793] Tainted: [B]=BAD_PAGE, [N]=TEST
[   29.453822] Hardware name: linux,dummy-virt (DT)
[   29.453852] Call trace:
[   29.453875]  show_stack+0x20/0x38 (C)
[   29.453923]  dump_stack_lvl+0x8c/0xd0
[   29.454092]  print_report+0x118/0x5d0
[   29.454275]  kasan_report+0xdc/0x128
[   29.454395]  kasan_check_range+0x100/0x1a8
[   29.454442]  __asan_memset+0x34/0x78
[   29.454487]  kmalloc_uaf_memset+0x170/0x310
[   29.454681]  kunit_try_run_case+0x170/0x3f0
[   29.454736]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.454920]  kthread+0x328/0x630
[   29.454998]  ret_from_fork+0x10/0x20
[   29.455066] 
[   29.455087] Allocated by task 218:
[   29.455116]  kasan_save_stack+0x3c/0x68
[   29.455308]  kasan_save_track+0x20/0x40
[   29.455358]  kasan_save_alloc_info+0x40/0x58
[   29.455435]  __kasan_kmalloc+0xd4/0xd8
[   29.455472]  __kmalloc_cache_noprof+0x16c/0x3c0
[   29.455586]  kmalloc_uaf_memset+0xb8/0x310
[   29.455763]  kunit_try_run_case+0x170/0x3f0
[   29.455899]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.455980]  kthread+0x328/0x630
[   29.456091]  ret_from_fork+0x10/0x20
[   29.456138] 
[   29.456158] Freed by task 218:
[   29.456185]  kasan_save_stack+0x3c/0x68
[   29.456233]  kasan_save_track+0x20/0x40
[   29.456272]  kasan_save_free_info+0x4c/0x78
[   29.456307]  __kasan_slab_free+0x6c/0x98
[   29.456344]  kfree+0x214/0x3c8
[   29.456379]  kmalloc_uaf_memset+0x11c/0x310
[   29.456416]  kunit_try_run_case+0x170/0x3f0
[   29.456455]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.456497]  kthread+0x328/0x630
[   29.456530]  ret_from_fork+0x10/0x20
[   29.456564] 
[   29.456584] The buggy address belongs to the object at fff00000c598cc80
[   29.456584]  which belongs to the cache kmalloc-64 of size 64
[   29.456829] The buggy address is located 0 bytes inside of
[   29.456829]  freed 64-byte region [fff00000c598cc80, fff00000c598ccc0)
[   29.456935] 
[   29.456985] The buggy address belongs to the physical page:
[   29.457064] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10598c
[   29.457140] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   29.457242] page_type: f5(slab)
[   29.457282] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   29.457606] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   29.457724] page dumped because: kasan: bad access detected
[   29.457859] 
[   29.457949] Memory state around the buggy address:
[   29.457981]  fff00000c598cb80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   29.458247]  fff00000c598cc00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   29.458424] >fff00000c598cc80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   29.458581]                    ^
[   29.458679]  fff00000c598cd00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.458741]  fff00000c598cd80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.458948] ==================================================================

[   24.362873] ==================================================================
[   24.363373] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   24.363662] Write of size 33 at addr ffff8881058cb580 by task kunit_try_catch/236
[   24.364003] 
[   24.364123] CPU: 0 UID: 0 PID: 236 Comm: kunit_try_catch Tainted: G    B   W        N  6.16.0-rc5-next-20250709 #1 PREEMPT(voluntary) 
[   24.364243] Tainted: [B]=BAD_PAGE, [W]=WARN, [N]=TEST
[   24.364258] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.364280] Call Trace:
[   24.364293]  <TASK>
[   24.364312]  dump_stack_lvl+0x73/0xb0
[   24.364367]  print_report+0xd1/0x610
[   24.364402]  ? __virt_addr_valid+0x1db/0x2d0
[   24.364427]  ? kmalloc_uaf_memset+0x1a3/0x360
[   24.364446]  ? kasan_complete_mode_report_info+0x64/0x200
[   24.364471]  ? kmalloc_uaf_memset+0x1a3/0x360
[   24.364492]  kasan_report+0x141/0x180
[   24.364513]  ? kmalloc_uaf_memset+0x1a3/0x360
[   24.364538]  kasan_check_range+0x10c/0x1c0
[   24.364561]  __asan_memset+0x27/0x50
[   24.364583]  kmalloc_uaf_memset+0x1a3/0x360
[   24.364604]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   24.364625]  ? __schedule+0x10cc/0x2b60
[   24.364649]  ? __pfx_read_tsc+0x10/0x10
[   24.364671]  ? ktime_get_ts64+0x86/0x230
[   24.364708]  kunit_try_run_case+0x1a5/0x480
[   24.364729]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.364749]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   24.364781]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.364805]  ? __kthread_parkme+0x82/0x180
[   24.364825]  ? preempt_count_sub+0x50/0x80
[   24.364850]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.364872]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.364938]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.364964]  kthread+0x337/0x6f0
[   24.364983]  ? trace_preempt_on+0x20/0xc0
[   24.365007]  ? __pfx_kthread+0x10/0x10
[   24.365027]  ? _raw_spin_unlock_irq+0x47/0x80
[   24.365048]  ? calculate_sigpending+0x7b/0xa0
[   24.365072]  ? __pfx_kthread+0x10/0x10
[   24.365093]  ret_from_fork+0x116/0x1d0
[   24.365111]  ? __pfx_kthread+0x10/0x10
[   24.365132]  ret_from_fork_asm+0x1a/0x30
[   24.365162]  </TASK>
[   24.365174] 
[   24.375187] Allocated by task 236:
[   24.375446]  kasan_save_stack+0x45/0x70
[   24.375638]  kasan_save_track+0x18/0x40
[   24.376104]  kasan_save_alloc_info+0x3b/0x50
[   24.376297]  __kasan_kmalloc+0xb7/0xc0
[   24.376453]  __kmalloc_cache_noprof+0x189/0x420
[   24.377036]  kmalloc_uaf_memset+0xa9/0x360
[   24.377218]  kunit_try_run_case+0x1a5/0x480
[   24.377412]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.377740]  kthread+0x337/0x6f0
[   24.378321]  ret_from_fork+0x116/0x1d0
[   24.378482]  ret_from_fork_asm+0x1a/0x30
[   24.378686] 
[   24.378927] Freed by task 236:
[   24.379236]  kasan_save_stack+0x45/0x70
[   24.379410]  kasan_save_track+0x18/0x40
[   24.379580]  kasan_save_free_info+0x3f/0x60
[   24.379777]  __kasan_slab_free+0x56/0x70
[   24.379941]  kfree+0x222/0x3f0
[   24.380410]  kmalloc_uaf_memset+0x12b/0x360
[   24.380566]  kunit_try_run_case+0x1a5/0x480
[   24.380892]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.381308]  kthread+0x337/0x6f0
[   24.381470]  ret_from_fork+0x116/0x1d0
[   24.381639]  ret_from_fork_asm+0x1a/0x30
[   24.381815] 
[   24.382182] The buggy address belongs to the object at ffff8881058cb580
[   24.382182]  which belongs to the cache kmalloc-64 of size 64
[   24.382643] The buggy address is located 0 bytes inside of
[   24.382643]  freed 64-byte region [ffff8881058cb580, ffff8881058cb5c0)
[   24.383370] 
[   24.383480] The buggy address belongs to the physical page:
[   24.383718] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1058cb
[   24.384380] flags: 0x200000000000000(node=0|zone=2)
[   24.384729] page_type: f5(slab)
[   24.385064] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   24.385548] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   24.386220] page dumped because: kasan: bad access detected
[   24.386577] 
[   24.386649] Memory state around the buggy address:
[   24.386866]  ffff8881058cb480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.387778]  ffff8881058cb500: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.388635] >ffff8881058cb580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.389136]                    ^
[   24.389563]  ffff8881058cb600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.390072]  ffff8881058cb680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.390475] ==================================================================