Hay
Date
July 23, 2025, 3:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   31.174354] ==================================================================
[   31.174419] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   31.174472] Write of size 33 at addr fff00000c9a6f900 by task kunit_try_catch/219
[   31.174672] 
[   31.174718] CPU: 0 UID: 0 PID: 219 Comm: kunit_try_catch Tainted: G    B   W        N  6.16.0-rc7-next-20250723 #1 PREEMPT 
[   31.174809] Tainted: [B]=BAD_PAGE, [W]=WARN, [N]=TEST
[   31.175202] Hardware name: linux,dummy-virt (DT)
[   31.175258] Call trace:
[   31.175303]  show_stack+0x20/0x38 (C)
[   31.175357]  dump_stack_lvl+0x8c/0xd0
[   31.175403]  print_report+0x118/0x5e8
[   31.175448]  kasan_report+0xdc/0x128
[   31.175564]  kasan_check_range+0x100/0x1a8
[   31.175641]  __asan_memset+0x34/0x78
[   31.175687]  kmalloc_uaf_memset+0x170/0x310
[   31.175826]  kunit_try_run_case+0x170/0x3f0
[   31.175894]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.175965]  kthread+0x328/0x630
[   31.176157]  ret_from_fork+0x10/0x20
[   31.176346] 
[   31.176373] Allocated by task 219:
[   31.176479]  kasan_save_stack+0x3c/0x68
[   31.176541]  kasan_save_track+0x20/0x40
[   31.176617]  kasan_save_alloc_info+0x40/0x58
[   31.176735]  __kasan_kmalloc+0xd4/0xd8
[   31.176768]  __kmalloc_cache_noprof+0x16c/0x3c0
[   31.177089]  kmalloc_uaf_memset+0xb8/0x310
[   31.177320]  kunit_try_run_case+0x170/0x3f0
[   31.177539]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.177616]  kthread+0x328/0x630
[   31.177766]  ret_from_fork+0x10/0x20
[   31.177850] 
[   31.177875] Freed by task 219:
[   31.178212]  kasan_save_stack+0x3c/0x68
[   31.178283]  kasan_save_track+0x20/0x40
[   31.178397]  kasan_save_free_info+0x4c/0x78
[   31.178478]  __kasan_slab_free+0x6c/0x98
[   31.178565]  kfree+0x214/0x3c8
[   31.178678]  kmalloc_uaf_memset+0x11c/0x310
[   31.178767]  kunit_try_run_case+0x170/0x3f0
[   31.178824]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.179187]  kthread+0x328/0x630
[   31.179252]  ret_from_fork+0x10/0x20
[   31.179360] 
[   31.179420] The buggy address belongs to the object at fff00000c9a6f900
[   31.179420]  which belongs to the cache kmalloc-64 of size 64
[   31.179529] The buggy address is located 0 bytes inside of
[   31.179529]  freed 64-byte region [fff00000c9a6f900, fff00000c9a6f940)
[   31.179698] 
[   31.179756] The buggy address belongs to the physical page:
[   31.179792] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109a6f
[   31.180010] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.180193] page_type: f5(slab)
[   31.180277] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   31.180379] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   31.180478] page dumped because: kasan: bad access detected
[   31.180533] 
[   31.180644] Memory state around the buggy address:
[   31.180704]  fff00000c9a6f800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   31.180768]  fff00000c9a6f880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   31.180816] >fff00000c9a6f900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   31.180854]                    ^
[   31.181070]  fff00000c9a6f980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.181259]  fff00000c9a6fa00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.181332] ==================================================================

[   25.457713] ==================================================================
[   25.458523] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   25.458940] Write of size 33 at addr ffff8881055e7000 by task kunit_try_catch/235
[   25.459460] 
[   25.459567] CPU: 1 UID: 0 PID: 235 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc7-next-20250723 #1 PREEMPT(voluntary) 
[   25.459628] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.459641] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.459663] Call Trace:
[   25.459676]  <TASK>
[   25.459694]  dump_stack_lvl+0x73/0xb0
[   25.459725]  print_report+0xd1/0x640
[   25.459749]  ? __virt_addr_valid+0x1db/0x2d0
[   25.459774]  ? kmalloc_uaf_memset+0x1a3/0x360
[   25.459795]  ? kasan_complete_mode_report_info+0x64/0x200
[   25.459820]  ? kmalloc_uaf_memset+0x1a3/0x360
[   25.459841]  kasan_report+0x141/0x180
[   25.459863]  ? kmalloc_uaf_memset+0x1a3/0x360
[   25.459888]  kasan_check_range+0x10c/0x1c0
[   25.459911]  __asan_memset+0x27/0x50
[   25.459935]  kmalloc_uaf_memset+0x1a3/0x360
[   25.460166]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   25.460191]  ? __schedule+0x10da/0x2b60
[   25.460217]  ? __pfx_read_tsc+0x10/0x10
[   25.460240]  ? ktime_get_ts64+0x86/0x230
[   25.460265]  kunit_try_run_case+0x1a5/0x480
[   25.460290]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.460312]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   25.460337]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.460361]  ? __kthread_parkme+0x82/0x180
[   25.460383]  ? preempt_count_sub+0x50/0x80
[   25.460406]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.460503]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.460530]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.460553]  kthread+0x337/0x6f0
[   25.460574]  ? trace_preempt_on+0x20/0xc0
[   25.460598]  ? __pfx_kthread+0x10/0x10
[   25.460619]  ? _raw_spin_unlock_irq+0x47/0x80
[   25.460642]  ? calculate_sigpending+0x7b/0xa0
[   25.460666]  ? __pfx_kthread+0x10/0x10
[   25.460687]  ret_from_fork+0x116/0x1d0
[   25.460707]  ? __pfx_kthread+0x10/0x10
[   25.460728]  ret_from_fork_asm+0x1a/0x30
[   25.460759]  </TASK>
[   25.460770] 
[   25.474643] Allocated by task 235:
[   25.474855]  kasan_save_stack+0x45/0x70
[   25.475169]  kasan_save_track+0x18/0x40
[   25.475548]  kasan_save_alloc_info+0x3b/0x50
[   25.476175]  __kasan_kmalloc+0xb7/0xc0
[   25.476320]  __kmalloc_cache_noprof+0x189/0x420
[   25.476513]  kmalloc_uaf_memset+0xa9/0x360
[   25.476923]  kunit_try_run_case+0x1a5/0x480
[   25.477302]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.477869]  kthread+0x337/0x6f0
[   25.478227]  ret_from_fork+0x116/0x1d0
[   25.478572]  ret_from_fork_asm+0x1a/0x30
[   25.478832] 
[   25.478901] Freed by task 235:
[   25.479131]  kasan_save_stack+0x45/0x70
[   25.479471]  kasan_save_track+0x18/0x40
[   25.479950]  kasan_save_free_info+0x3f/0x60
[   25.480258]  __kasan_slab_free+0x56/0x70
[   25.480414]  kfree+0x222/0x3f0
[   25.480758]  kmalloc_uaf_memset+0x12b/0x360
[   25.481189]  kunit_try_run_case+0x1a5/0x480
[   25.481606]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.481860]  kthread+0x337/0x6f0
[   25.482041]  ret_from_fork+0x116/0x1d0
[   25.482386]  ret_from_fork_asm+0x1a/0x30
[   25.482786] 
[   25.482948] The buggy address belongs to the object at ffff8881055e7000
[   25.482948]  which belongs to the cache kmalloc-64 of size 64
[   25.483784] The buggy address is located 0 bytes inside of
[   25.483784]  freed 64-byte region [ffff8881055e7000, ffff8881055e7040)
[   25.484862] 
[   25.484937] The buggy address belongs to the physical page:
[   25.485114] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1055e7
[   25.485365] flags: 0x200000000000000(node=0|zone=2)
[   25.485859] page_type: f5(slab)
[   25.486169] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   25.486997] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   25.487878] page dumped because: kasan: bad access detected
[   25.488407] 
[   25.488562] Memory state around the buggy address:
[   25.489021]  ffff8881055e6f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.489249]  ffff8881055e6f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.489674] >ffff8881055e7000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.490298]                    ^
[   25.490630]  ffff8881055e7080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.491318]  ffff8881055e7100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.492015] ==================================================================