Hay
Date
May 12, 2025, 11:48 a.m.

Environment
qemu-arm64
qemu-x86_64

[   16.907161] ==================================================================
[   16.907276] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   16.907388] Write of size 33 at addr fff00000c78cbe80 by task kunit_try_catch/186
[   16.907497] 
[   16.907559] CPU: 1 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT 
[   16.907736] Tainted: [B]=BAD_PAGE, [N]=TEST
[   16.907793] Hardware name: linux,dummy-virt (DT)
[   16.907858] Call trace:
[   16.907901]  show_stack+0x20/0x38 (C)
[   16.908008]  dump_stack_lvl+0x8c/0xd0
[   16.908276]  print_report+0x118/0x608
[   16.908386]  kasan_report+0xdc/0x128
[   16.908481]  kasan_check_range+0x100/0x1a8
[   16.908585]  __asan_memset+0x34/0x78
[   16.908683]  kmalloc_uaf_memset+0x170/0x310
[   16.908780]  kunit_try_run_case+0x170/0x3f0
[   16.908886]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.909786]  kthread+0x328/0x630
[   16.910143]  ret_from_fork+0x10/0x20
[   16.910555] 
[   16.910621] Allocated by task 186:
[   16.910684]  kasan_save_stack+0x3c/0x68
[   16.910757]  kasan_save_track+0x20/0x40
[   16.910828]  kasan_save_alloc_info+0x40/0x58
[   16.910899]  __kasan_kmalloc+0xd4/0xd8
[   16.910969]  __kmalloc_cache_noprof+0x15c/0x3c0
[   16.911991]  kmalloc_uaf_memset+0xb8/0x310
[   16.912582]  kunit_try_run_case+0x170/0x3f0
[   16.912830]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.913074]  kthread+0x328/0x630
[   16.913153]  ret_from_fork+0x10/0x20
[   16.913231] 
[   16.913272] Freed by task 186:
[   16.913335]  kasan_save_stack+0x3c/0x68
[   16.913929]  kasan_save_track+0x20/0x40
[   16.914548]  kasan_save_free_info+0x4c/0x78
[   16.914648]  __kasan_slab_free+0x6c/0x98
[   16.915125]  kfree+0x214/0x3c8
[   16.915646]  kmalloc_uaf_memset+0x11c/0x310
[   16.915828]  kunit_try_run_case+0x170/0x3f0
[   16.915908]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.916657]  kthread+0x328/0x630
[   16.916740]  ret_from_fork+0x10/0x20
[   16.916813] 
[   16.916854] The buggy address belongs to the object at fff00000c78cbe80
[   16.916854]  which belongs to the cache kmalloc-64 of size 64
[   16.916983] The buggy address is located 0 bytes inside of
[   16.916983]  freed 64-byte region [fff00000c78cbe80, fff00000c78cbec0)
[   16.918751] 
[   16.918843] The buggy address belongs to the physical page:
[   16.918926] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1078cb
[   16.919179] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   16.919394] page_type: f5(slab)
[   16.919526] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   16.919708] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   16.919878] page dumped because: kasan: bad access detected
[   16.919951] 
[   16.920062] Memory state around the buggy address:
[   16.920151]  fff00000c78cbd80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   16.920391]  fff00000c78cbe00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   16.920746] >fff00000c78cbe80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   16.920832]                    ^
[   16.920904]  fff00000c78cbf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.921275]  fff00000c78cbf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.921404] ==================================================================

[   16.955767] ==================================================================
[   16.956619] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   16.956982] Write of size 33 at addr ffff888102b4c980 by task kunit_try_catch/203
[   16.957788] 
[   16.958466] CPU: 1 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT(voluntary) 
[   16.958535] Tainted: [B]=BAD_PAGE, [N]=TEST
[   16.958548] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   16.958572] Call Trace:
[   16.958587]  <TASK>
[   16.958609]  dump_stack_lvl+0x73/0xb0
[   16.958646]  print_report+0xd1/0x650
[   16.958693]  ? __virt_addr_valid+0x1db/0x2d0
[   16.958729]  ? kmalloc_uaf_memset+0x1a3/0x360
[   16.958764]  ? kasan_complete_mode_report_info+0x64/0x200
[   16.958804]  ? kmalloc_uaf_memset+0x1a3/0x360
[   16.958843]  kasan_report+0x141/0x180
[   16.958879]  ? kmalloc_uaf_memset+0x1a3/0x360
[   16.958974]  kasan_check_range+0x10c/0x1c0
[   16.959047]  __asan_memset+0x27/0x50
[   16.959092]  kmalloc_uaf_memset+0x1a3/0x360
[   16.959133]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   16.959178]  ? __schedule+0x10cc/0x2b60
[   16.959214]  ? __pfx_read_tsc+0x10/0x10
[   16.959247]  ? ktime_get_ts64+0x86/0x230
[   16.959299]  kunit_try_run_case+0x1a5/0x480
[   16.959328]  ? __pfx_kunit_try_run_case+0x10/0x10
[   16.959351]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   16.959375]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   16.959397]  ? __kthread_parkme+0x82/0x180
[   16.959419]  ? preempt_count_sub+0x50/0x80
[   16.959443]  ? __pfx_kunit_try_run_case+0x10/0x10
[   16.959466]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   16.959489]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   16.959512]  kthread+0x337/0x6f0
[   16.959532]  ? trace_preempt_on+0x20/0xc0
[   16.959557]  ? __pfx_kthread+0x10/0x10
[   16.959578]  ? _raw_spin_unlock_irq+0x47/0x80
[   16.959598]  ? calculate_sigpending+0x7b/0xa0
[   16.959623]  ? __pfx_kthread+0x10/0x10
[   16.959644]  ret_from_fork+0x116/0x1d0
[   16.959668]  ? __pfx_kthread+0x10/0x10
[   16.959712]  ret_from_fork_asm+0x1a/0x30
[   16.959745]  </TASK>
[   16.959759] 
[   16.972087] Allocated by task 203:
[   16.972468]  kasan_save_stack+0x45/0x70
[   16.972901]  kasan_save_track+0x18/0x40
[   16.973472]  kasan_save_alloc_info+0x3b/0x50
[   16.973930]  __kasan_kmalloc+0xb7/0xc0
[   16.974290]  __kmalloc_cache_noprof+0x189/0x420
[   16.974714]  kmalloc_uaf_memset+0xa9/0x360
[   16.975065]  kunit_try_run_case+0x1a5/0x480
[   16.975450]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   16.976009]  kthread+0x337/0x6f0
[   16.976403]  ret_from_fork+0x116/0x1d0
[   16.976578]  ret_from_fork_asm+0x1a/0x30
[   16.976802] 
[   16.976991] Freed by task 203:
[   16.977182]  kasan_save_stack+0x45/0x70
[   16.977486]  kasan_save_track+0x18/0x40
[   16.977855]  kasan_save_free_info+0x3f/0x60
[   16.978113]  __kasan_slab_free+0x56/0x70
[   16.978465]  kfree+0x222/0x3f0
[   16.978743]  kmalloc_uaf_memset+0x12b/0x360
[   16.979130]  kunit_try_run_case+0x1a5/0x480
[   16.979489]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   16.979871]  kthread+0x337/0x6f0
[   16.980165]  ret_from_fork+0x116/0x1d0
[   16.980507]  ret_from_fork_asm+0x1a/0x30
[   16.980655] 
[   16.980738] The buggy address belongs to the object at ffff888102b4c980
[   16.980738]  which belongs to the cache kmalloc-64 of size 64
[   16.981495] The buggy address is located 0 bytes inside of
[   16.981495]  freed 64-byte region [ffff888102b4c980, ffff888102b4c9c0)
[   16.982123] 
[   16.982365] The buggy address belongs to the physical page:
[   16.982648] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102b4c
[   16.982971] flags: 0x200000000000000(node=0|zone=2)
[   16.983204] page_type: f5(slab)
[   16.983543] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   16.984166] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   16.984998] page dumped because: kasan: bad access detected
[   16.985361] 
[   16.985478] Memory state around the buggy address:
[   16.985694]  ffff888102b4c880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   16.985954]  ffff888102b4c900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   16.986697] >ffff888102b4c980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   16.987091]                    ^
[   16.987409]  ffff888102b4ca00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.987803]  ffff888102b4ca80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.988266] ==================================================================