Hay
Date
June 23, 2025, 1:39 p.m.

Environment
qemu-arm64
qemu-x86_64

[   24.936332] ==================================================================
[   24.936496] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   24.936637] Write of size 33 at addr fff00000c76ce700 by task kunit_try_catch/188
[   24.936953] 
[   24.937195] CPU: 0 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.15.4-rc1 #1 PREEMPT 
[   24.937454] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.937529] Hardware name: linux,dummy-virt (DT)
[   24.938331] Call trace:
[   24.938607]  show_stack+0x20/0x38 (C)
[   24.938860]  dump_stack_lvl+0x8c/0xd0
[   24.939070]  print_report+0x118/0x608
[   24.939358]  kasan_report+0xdc/0x128
[   24.939519]  kasan_check_range+0x100/0x1a8
[   24.939646]  __asan_memset+0x34/0x78
[   24.939765]  kmalloc_uaf_memset+0x170/0x310
[   24.939882]  kunit_try_run_case+0x170/0x3f0
[   24.939998]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.940123]  kthread+0x328/0x630
[   24.940234]  ret_from_fork+0x10/0x20
[   24.940384] 
[   24.940454] Allocated by task 188:
[   24.940535]  kasan_save_stack+0x3c/0x68
[   24.941081]  kasan_save_track+0x20/0x40
[   24.941189]  kasan_save_alloc_info+0x40/0x58
[   24.941293]  __kasan_kmalloc+0xd4/0xd8
[   24.941413]  __kmalloc_cache_noprof+0x16c/0x3c0
[   24.941513]  kmalloc_uaf_memset+0xb8/0x310
[   24.941609]  kunit_try_run_case+0x170/0x3f0
[   24.942240]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.942448]  kthread+0x328/0x630
[   24.942662]  ret_from_fork+0x10/0x20
[   24.942954] 
[   24.943031] Freed by task 188:
[   24.943098]  kasan_save_stack+0x3c/0x68
[   24.943187]  kasan_save_track+0x20/0x40
[   24.943312]  kasan_save_free_info+0x4c/0x78
[   24.943573]  __kasan_slab_free+0x6c/0x98
[   24.943831]  kfree+0x214/0x3c8
[   24.944036]  kmalloc_uaf_memset+0x11c/0x310
[   24.944160]  kunit_try_run_case+0x170/0x3f0
[   24.944266]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.944568]  kthread+0x328/0x630
[   24.944676]  ret_from_fork+0x10/0x20
[   24.944787] 
[   24.944835] The buggy address belongs to the object at fff00000c76ce700
[   24.944835]  which belongs to the cache kmalloc-64 of size 64
[   24.944962] The buggy address is located 0 bytes inside of
[   24.944962]  freed 64-byte region [fff00000c76ce700, fff00000c76ce740)
[   24.945143] 
[   24.945212] The buggy address belongs to the physical page:
[   24.945284] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1076ce
[   24.945422] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   24.945551] page_type: f5(slab)
[   24.946080] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   24.946521] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   24.947011] page dumped because: kasan: bad access detected
[   24.947098] 
[   24.947149] Memory state around the buggy address:
[   24.947228]  fff00000c76ce600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.947537]  fff00000c76ce680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.947686] >fff00000c76ce700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.947774]                    ^
[   24.947895]  fff00000c76ce780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.948058]  fff00000c76ce800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.948249] ==================================================================

[   17.660233] ==================================================================
[   17.661099] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   17.662425] Write of size 33 at addr ffff888102a16700 by task kunit_try_catch/207
[   17.663031] 
[   17.663301] CPU: 0 UID: 0 PID: 207 Comm: kunit_try_catch Tainted: G    B            N  6.15.4-rc1 #1 PREEMPT(voluntary) 
[   17.663425] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.663460] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   17.663512] Call Trace:
[   17.663552]  <TASK>
[   17.663593]  dump_stack_lvl+0x73/0xb0
[   17.663687]  print_report+0xd1/0x650
[   17.663761]  ? __virt_addr_valid+0x1db/0x2d0
[   17.663837]  ? kmalloc_uaf_memset+0x1a3/0x360
[   17.663908]  ? kasan_complete_mode_report_info+0x64/0x200
[   17.663984]  ? kmalloc_uaf_memset+0x1a3/0x360
[   17.664058]  kasan_report+0x141/0x180
[   17.664134]  ? kmalloc_uaf_memset+0x1a3/0x360
[   17.664220]  kasan_check_range+0x10c/0x1c0
[   17.664294]  __asan_memset+0x27/0x50
[   17.664360]  kmalloc_uaf_memset+0x1a3/0x360
[   17.664428]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   17.664617]  ? __schedule+0x10cc/0x2b60
[   17.664706]  ? __pfx_read_tsc+0x10/0x10
[   17.664754]  ? ktime_get_ts64+0x86/0x230
[   17.664794]  kunit_try_run_case+0x1a5/0x480
[   17.664831]  ? __pfx_kunit_try_run_case+0x10/0x10
[   17.664865]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   17.664898]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   17.664931]  ? __kthread_parkme+0x82/0x180
[   17.664961]  ? preempt_count_sub+0x50/0x80
[   17.664995]  ? __pfx_kunit_try_run_case+0x10/0x10
[   17.665028]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.665060]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   17.665091]  kthread+0x337/0x6f0
[   17.665113]  ? trace_preempt_on+0x20/0xc0
[   17.665146]  ? __pfx_kthread+0x10/0x10
[   17.665169]  ? _raw_spin_unlock_irq+0x47/0x80
[   17.665198]  ? calculate_sigpending+0x7b/0xa0
[   17.665260]  ? __pfx_kthread+0x10/0x10
[   17.665290]  ret_from_fork+0x41/0x80
[   17.665322]  ? __pfx_kthread+0x10/0x10
[   17.665345]  ret_from_fork_asm+0x1a/0x30
[   17.665386]  </TASK>
[   17.665400] 
[   17.683903] Allocated by task 207:
[   17.684339]  kasan_save_stack+0x45/0x70
[   17.684875]  kasan_save_track+0x18/0x40
[   17.685243]  kasan_save_alloc_info+0x3b/0x50
[   17.686106]  __kasan_kmalloc+0xb7/0xc0
[   17.686512]  __kmalloc_cache_noprof+0x189/0x420
[   17.687124]  kmalloc_uaf_memset+0xa9/0x360
[   17.687584]  kunit_try_run_case+0x1a5/0x480
[   17.688191]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.688840]  kthread+0x337/0x6f0
[   17.689122]  ret_from_fork+0x41/0x80
[   17.689554]  ret_from_fork_asm+0x1a/0x30
[   17.690099] 
[   17.690330] Freed by task 207:
[   17.690695]  kasan_save_stack+0x45/0x70
[   17.691097]  kasan_save_track+0x18/0x40
[   17.691988]  kasan_save_free_info+0x3f/0x60
[   17.692424]  __kasan_slab_free+0x56/0x70
[   17.692974]  kfree+0x222/0x3f0
[   17.693392]  kmalloc_uaf_memset+0x12b/0x360
[   17.693952]  kunit_try_run_case+0x1a5/0x480
[   17.694380]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.694958]  kthread+0x337/0x6f0
[   17.695342]  ret_from_fork+0x41/0x80
[   17.696102]  ret_from_fork_asm+0x1a/0x30
[   17.696514] 
[   17.696908] The buggy address belongs to the object at ffff888102a16700
[   17.696908]  which belongs to the cache kmalloc-64 of size 64
[   17.697873] The buggy address is located 0 bytes inside of
[   17.697873]  freed 64-byte region [ffff888102a16700, ffff888102a16740)
[   17.698779] 
[   17.699011] The buggy address belongs to the physical page:
[   17.699506] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a16
[   17.700143] flags: 0x200000000000000(node=0|zone=2)
[   17.700802] page_type: f5(slab)
[   17.701182] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   17.703113] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   17.703552] page dumped because: kasan: bad access detected
[   17.704453] 
[   17.704711] Memory state around the buggy address:
[   17.705118]  ffff888102a16600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.705812]  ffff888102a16680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.706921] >ffff888102a16700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.707894]                    ^
[   17.708299]  ffff888102a16780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.708912]  ffff888102a16800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.709494] ==================================================================