Hay
Date
July 5, 2025, 11:09 a.m.

Environment
qemu-arm64
qemu-x86_64

[   19.152155] ==================================================================
[   19.152338] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   19.152574] Write of size 33 at addr fff00000c78aa700 by task kunit_try_catch/187
[   19.152692] 
[   19.152764] CPU: 0 UID: 0 PID: 187 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   19.152927] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.153133] Hardware name: linux,dummy-virt (DT)
[   19.153200] Call trace:
[   19.153248]  show_stack+0x20/0x38 (C)
[   19.153370]  dump_stack_lvl+0x8c/0xd0
[   19.153482]  print_report+0x118/0x608
[   19.153581]  kasan_report+0xdc/0x128
[   19.153682]  kasan_check_range+0x100/0x1a8
[   19.153782]  __asan_memset+0x34/0x78
[   19.153875]  kmalloc_uaf_memset+0x170/0x310
[   19.153980]  kunit_try_run_case+0x170/0x3f0
[   19.154072]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.154268]  kthread+0x328/0x630
[   19.154384]  ret_from_fork+0x10/0x20
[   19.154519] 
[   19.154560] Allocated by task 187:
[   19.154672]  kasan_save_stack+0x3c/0x68
[   19.155382]  kasan_save_track+0x20/0x40
[   19.155537]  kasan_save_alloc_info+0x40/0x58
[   19.155638]  __kasan_kmalloc+0xd4/0xd8
[   19.155720]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.155810]  kmalloc_uaf_memset+0xb8/0x310
[   19.155893]  kunit_try_run_case+0x170/0x3f0
[   19.155981]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.156078]  kthread+0x328/0x630
[   19.156150]  ret_from_fork+0x10/0x20
[   19.156231] 
[   19.156272] Freed by task 187:
[   19.156335]  kasan_save_stack+0x3c/0x68
[   19.156439]  kasan_save_track+0x20/0x40
[   19.156526]  kasan_save_free_info+0x4c/0x78
[   19.156616]  __kasan_slab_free+0x6c/0x98
[   19.156697]  kfree+0x214/0x3c8
[   19.156776]  kmalloc_uaf_memset+0x11c/0x310
[   19.156860]  kunit_try_run_case+0x170/0x3f0
[   19.156947]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.157044]  kthread+0x328/0x630
[   19.157116]  ret_from_fork+0x10/0x20
[   19.157201] 
[   19.158193] The buggy address belongs to the object at fff00000c78aa700
[   19.158193]  which belongs to the cache kmalloc-64 of size 64
[   19.159045] The buggy address is located 0 bytes inside of
[   19.159045]  freed 64-byte region [fff00000c78aa700, fff00000c78aa740)
[   19.159187] 
[   19.159234] The buggy address belongs to the physical page:
[   19.159306] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1078aa
[   19.159421] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.159512] page_type: f5(slab)
[   19.159581] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   19.159681] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   19.159840] page dumped because: kasan: bad access detected
[   19.159913] 
[   19.159956] Memory state around the buggy address:
[   19.160050]  fff00000c78aa600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.160143]  fff00000c78aa680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.160234] >fff00000c78aa700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.160315]                    ^
[   19.160606]  fff00000c78aa780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.160700]  fff00000c78aa800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.160809] ==================================================================

[   13.915358] ==================================================================
[   13.916200] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   13.916558] Write of size 33 at addr ffff88810332dc00 by task kunit_try_catch/203
[   13.916920] 
[   13.917221] CPU: 1 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   13.917281] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.917296] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.917321] Call Trace:
[   13.917335]  <TASK>
[   13.917356]  dump_stack_lvl+0x73/0xb0
[   13.917392]  print_report+0xd1/0x650
[   13.917418]  ? __virt_addr_valid+0x1db/0x2d0
[   13.917446]  ? kmalloc_uaf_memset+0x1a3/0x360
[   13.917471]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.917497]  ? kmalloc_uaf_memset+0x1a3/0x360
[   13.917522]  kasan_report+0x141/0x180
[   13.917548]  ? kmalloc_uaf_memset+0x1a3/0x360
[   13.917579]  kasan_check_range+0x10c/0x1c0
[   13.917606]  __asan_memset+0x27/0x50
[   13.917629]  kmalloc_uaf_memset+0x1a3/0x360
[   13.917670]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   13.917696]  ? __schedule+0x10cc/0x2b60
[   13.917722]  ? __pfx_read_tsc+0x10/0x10
[   13.917747]  ? ktime_get_ts64+0x86/0x230
[   13.917776]  kunit_try_run_case+0x1a5/0x480
[   13.917805]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.917830]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.917857]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.917884]  ? __kthread_parkme+0x82/0x180
[   13.917907]  ? preempt_count_sub+0x50/0x80
[   13.918000]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.918030]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.918056]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.918083]  kthread+0x337/0x6f0
[   13.918106]  ? trace_preempt_on+0x20/0xc0
[   13.918134]  ? __pfx_kthread+0x10/0x10
[   13.918158]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.918182]  ? calculate_sigpending+0x7b/0xa0
[   13.918210]  ? __pfx_kthread+0x10/0x10
[   13.918235]  ret_from_fork+0x116/0x1d0
[   13.918257]  ? __pfx_kthread+0x10/0x10
[   13.918282]  ret_from_fork_asm+0x1a/0x30
[   13.918320]  </TASK>
[   13.918333] 
[   13.935610] Allocated by task 203:
[   13.936267]  kasan_save_stack+0x45/0x70
[   13.936500]  kasan_save_track+0x18/0x40
[   13.936735]  kasan_save_alloc_info+0x3b/0x50
[   13.937768]  __kasan_kmalloc+0xb7/0xc0
[   13.938059]  __kmalloc_cache_noprof+0x189/0x420
[   13.938319]  kmalloc_uaf_memset+0xa9/0x360
[   13.938546]  kunit_try_run_case+0x1a5/0x480
[   13.939174]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.939482]  kthread+0x337/0x6f0
[   13.939692]  ret_from_fork+0x116/0x1d0
[   13.940163]  ret_from_fork_asm+0x1a/0x30
[   13.940415] 
[   13.940515] Freed by task 203:
[   13.940718]  kasan_save_stack+0x45/0x70
[   13.940925]  kasan_save_track+0x18/0x40
[   13.941679]  kasan_save_free_info+0x3f/0x60
[   13.941879]  __kasan_slab_free+0x56/0x70
[   13.942353]  kfree+0x222/0x3f0
[   13.942569]  kmalloc_uaf_memset+0x12b/0x360
[   13.942963]  kunit_try_run_case+0x1a5/0x480
[   13.943216]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.943502]  kthread+0x337/0x6f0
[   13.943724]  ret_from_fork+0x116/0x1d0
[   13.944327]  ret_from_fork_asm+0x1a/0x30
[   13.944513] 
[   13.945018] The buggy address belongs to the object at ffff88810332dc00
[   13.945018]  which belongs to the cache kmalloc-64 of size 64
[   13.945616] The buggy address is located 0 bytes inside of
[   13.945616]  freed 64-byte region [ffff88810332dc00, ffff88810332dc40)
[   13.946563] 
[   13.946845] The buggy address belongs to the physical page:
[   13.947160] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10332d
[   13.947720] flags: 0x200000000000000(node=0|zone=2)
[   13.948122] page_type: f5(slab)
[   13.948298] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   13.948706] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   13.949185] page dumped because: kasan: bad access detected
[   13.950151] 
[   13.950263] Memory state around the buggy address:
[   13.950469]  ffff88810332db00: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
[   13.951289]  ffff88810332db80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   13.951677] >ffff88810332dc00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   13.952290]                    ^
[   13.952501]  ffff88810332dc80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.953182]  ffff88810332dd00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.953492] ==================================================================