Hay
Date
July 4, 2025, 11:11 p.m.

Environment
qemu-arm64
qemu-x86_64

[   18.217159] ==================================================================
[   18.217227] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   18.217290] Write of size 33 at addr fff00000c7747980 by task kunit_try_catch/186
[   18.217341] 
[   18.217378] CPU: 0 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   18.217460] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.217487] Hardware name: linux,dummy-virt (DT)
[   18.217521] Call trace:
[   18.217544]  show_stack+0x20/0x38 (C)
[   18.217596]  dump_stack_lvl+0x8c/0xd0
[   18.217645]  print_report+0x118/0x608
[   18.217692]  kasan_report+0xdc/0x128
[   18.217739]  kasan_check_range+0x100/0x1a8
[   18.217787]  __asan_memset+0x34/0x78
[   18.217864]  kmalloc_uaf_memset+0x170/0x310
[   18.217910]  kunit_try_run_case+0x170/0x3f0
[   18.217956]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.218008]  kthread+0x328/0x630
[   18.218051]  ret_from_fork+0x10/0x20
[   18.218098] 
[   18.218116] Allocated by task 186:
[   18.218144]  kasan_save_stack+0x3c/0x68
[   18.218183]  kasan_save_track+0x20/0x40
[   18.218219]  kasan_save_alloc_info+0x40/0x58
[   18.218258]  __kasan_kmalloc+0xd4/0xd8
[   18.218293]  __kmalloc_cache_noprof+0x16c/0x3c0
[   18.218332]  kmalloc_uaf_memset+0xb8/0x310
[   18.218368]  kunit_try_run_case+0x170/0x3f0
[   18.218403]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.218445]  kthread+0x328/0x630
[   18.218475]  ret_from_fork+0x10/0x20
[   18.218511] 
[   18.218528] Freed by task 186:
[   18.218553]  kasan_save_stack+0x3c/0x68
[   18.218588]  kasan_save_track+0x20/0x40
[   18.218624]  kasan_save_free_info+0x4c/0x78
[   18.218661]  __kasan_slab_free+0x6c/0x98
[   18.218698]  kfree+0x214/0x3c8
[   18.218729]  kmalloc_uaf_memset+0x11c/0x310
[   18.218763]  kunit_try_run_case+0x170/0x3f0
[   18.218800]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.218861]  kthread+0x328/0x630
[   18.218892]  ret_from_fork+0x10/0x20
[   18.218952] 
[   18.218971] The buggy address belongs to the object at fff00000c7747980
[   18.218971]  which belongs to the cache kmalloc-64 of size 64
[   18.219028] The buggy address is located 0 bytes inside of
[   18.219028]  freed 64-byte region [fff00000c7747980, fff00000c77479c0)
[   18.219088] 
[   18.219108] The buggy address belongs to the physical page:
[   18.219140] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107747
[   18.219194] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.219246] page_type: f5(slab)
[   18.219286] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   18.219334] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   18.219376] page dumped because: kasan: bad access detected
[   18.219431] 
[   18.219449] Memory state around the buggy address:
[   18.219484]  fff00000c7747880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.219526]  fff00000c7747900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.219568] >fff00000c7747980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.220913]                    ^
[   18.220952]  fff00000c7747a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.221255]  fff00000c7747a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.221300] ==================================================================

[   12.208665] ==================================================================
[   12.209763] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   12.210808] Write of size 33 at addr ffff888102639c80 by task kunit_try_catch/203
[   12.211192] 
[   12.211517] CPU: 0 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   12.211687] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.211702] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.211725] Call Trace:
[   12.211751]  <TASK>
[   12.211771]  dump_stack_lvl+0x73/0xb0
[   12.211986]  print_report+0xd1/0x650
[   12.212018]  ? __virt_addr_valid+0x1db/0x2d0
[   12.212041]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.212063]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.212083]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.212104]  kasan_report+0x141/0x180
[   12.212124]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.212148]  kasan_check_range+0x10c/0x1c0
[   12.212170]  __asan_memset+0x27/0x50
[   12.212188]  kmalloc_uaf_memset+0x1a3/0x360
[   12.212208]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.212243]  ? __schedule+0x10cc/0x2b60
[   12.212264]  ? __pfx_read_tsc+0x10/0x10
[   12.212284]  ? ktime_get_ts64+0x86/0x230
[   12.212309]  kunit_try_run_case+0x1a5/0x480
[   12.212333]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.212353]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.212375]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.212398]  ? __kthread_parkme+0x82/0x180
[   12.212417]  ? preempt_count_sub+0x50/0x80
[   12.212439]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.212461]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.212482]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.212503]  kthread+0x337/0x6f0
[   12.212521]  ? trace_preempt_on+0x20/0xc0
[   12.212543]  ? __pfx_kthread+0x10/0x10
[   12.212562]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.212581]  ? calculate_sigpending+0x7b/0xa0
[   12.212604]  ? __pfx_kthread+0x10/0x10
[   12.212624]  ret_from_fork+0x116/0x1d0
[   12.212641]  ? __pfx_kthread+0x10/0x10
[   12.212660]  ret_from_fork_asm+0x1a/0x30
[   12.212689]  </TASK>
[   12.212700] 
[   12.228666] Allocated by task 203:
[   12.229212]  kasan_save_stack+0x45/0x70
[   12.229858]  kasan_save_track+0x18/0x40
[   12.230450]  kasan_save_alloc_info+0x3b/0x50
[   12.230930]  __kasan_kmalloc+0xb7/0xc0
[   12.231076]  __kmalloc_cache_noprof+0x189/0x420
[   12.231495]  kmalloc_uaf_memset+0xa9/0x360
[   12.232068]  kunit_try_run_case+0x1a5/0x480
[   12.232751]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.233523]  kthread+0x337/0x6f0
[   12.233955]  ret_from_fork+0x116/0x1d0
[   12.234098]  ret_from_fork_asm+0x1a/0x30
[   12.234634] 
[   12.234873] Freed by task 203:
[   12.235329]  kasan_save_stack+0x45/0x70
[   12.235880]  kasan_save_track+0x18/0x40
[   12.236428]  kasan_save_free_info+0x3f/0x60
[   12.236920]  __kasan_slab_free+0x56/0x70
[   12.237074]  kfree+0x222/0x3f0
[   12.237191]  kmalloc_uaf_memset+0x12b/0x360
[   12.237348]  kunit_try_run_case+0x1a5/0x480
[   12.237770]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.238481]  kthread+0x337/0x6f0
[   12.238951]  ret_from_fork+0x116/0x1d0
[   12.239554]  ret_from_fork_asm+0x1a/0x30
[   12.240137] 
[   12.240540] The buggy address belongs to the object at ffff888102639c80
[   12.240540]  which belongs to the cache kmalloc-64 of size 64
[   12.242129] The buggy address is located 0 bytes inside of
[   12.242129]  freed 64-byte region [ffff888102639c80, ffff888102639cc0)
[   12.243253] 
[   12.243563] The buggy address belongs to the physical page:
[   12.243784] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102639
[   12.244035] flags: 0x200000000000000(node=0|zone=2)
[   12.244487] page_type: f5(slab)
[   12.244945] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.245958] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.246996] page dumped because: kasan: bad access detected
[   12.247833] 
[   12.248199] Memory state around the buggy address:
[   12.248678]  ffff888102639b80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.249208]  ffff888102639c00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.249679] >ffff888102639c80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.250545]                    ^
[   12.251033]  ffff888102639d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.252072]  ffff888102639d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.252823] ==================================================================