Hay
Date
July 9, 2025, 12:11 a.m.

Environment
qemu-arm64
qemu-x86_64

[   19.829238] ==================================================================
[   19.829361] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   19.829645] Write of size 33 at addr fff00000c63a2480 by task kunit_try_catch/187
[   19.829775] 
[   19.829836] CPU: 1 UID: 0 PID: 187 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT 
[   19.829940] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.829980] Hardware name: linux,dummy-virt (DT)
[   19.830016] Call trace:
[   19.830081]  show_stack+0x20/0x38 (C)
[   19.830156]  dump_stack_lvl+0x8c/0xd0
[   19.830215]  print_report+0x118/0x608
[   19.830317]  kasan_report+0xdc/0x128
[   19.830366]  kasan_check_range+0x100/0x1a8
[   19.830423]  __asan_memset+0x34/0x78
[   19.830477]  kmalloc_uaf_memset+0x170/0x310
[   19.830525]  kunit_try_run_case+0x170/0x3f0
[   19.830576]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.830630]  kthread+0x328/0x630
[   19.830682]  ret_from_fork+0x10/0x20
[   19.830733] 
[   19.830753] Allocated by task 187:
[   19.830791]  kasan_save_stack+0x3c/0x68
[   19.830844]  kasan_save_track+0x20/0x40
[   19.830883]  kasan_save_alloc_info+0x40/0x58
[   19.830930]  __kasan_kmalloc+0xd4/0xd8
[   19.830966]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.831006]  kmalloc_uaf_memset+0xb8/0x310
[   19.831051]  kunit_try_run_case+0x170/0x3f0
[   19.831093]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.831138]  kthread+0x328/0x630
[   19.831173]  ret_from_fork+0x10/0x20
[   19.831209] 
[   19.831235] Freed by task 187:
[   19.831263]  kasan_save_stack+0x3c/0x68
[   19.831307]  kasan_save_track+0x20/0x40
[   19.831345]  kasan_save_free_info+0x4c/0x78
[   19.831394]  __kasan_slab_free+0x6c/0x98
[   19.831441]  kfree+0x214/0x3c8
[   19.831475]  kmalloc_uaf_memset+0x11c/0x310
[   19.831511]  kunit_try_run_case+0x170/0x3f0
[   19.831559]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.831611]  kthread+0x328/0x630
[   19.831645]  ret_from_fork+0x10/0x20
[   19.831679] 
[   19.831705] The buggy address belongs to the object at fff00000c63a2480
[   19.831705]  which belongs to the cache kmalloc-64 of size 64
[   19.831772] The buggy address is located 0 bytes inside of
[   19.831772]  freed 64-byte region [fff00000c63a2480, fff00000c63a24c0)
[   19.831835] 
[   19.831854] The buggy address belongs to the physical page:
[   19.831888] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1063a2
[   19.831947] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.831999] page_type: f5(slab)
[   19.832320] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   19.832390] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   19.832446] page dumped because: kasan: bad access detected
[   19.832480] 
[   19.832498] Memory state around the buggy address:
[   19.832531]  fff00000c63a2380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.832576]  fff00000c63a2400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.832711] >fff00000c63a2480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.832789]                    ^
[   19.832900]  fff00000c63a2500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.832954]  fff00000c63a2580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.833104] ==================================================================

[   12.913225] ==================================================================
[   12.913685] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   12.914053] Write of size 33 at addr ffff888102aaa580 by task kunit_try_catch/203
[   12.914626] 
[   12.914763] CPU: 1 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   12.914814] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.914826] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.914848] Call Trace:
[   12.914862]  <TASK>
[   12.914883]  dump_stack_lvl+0x73/0xb0
[   12.914920]  print_report+0xd1/0x650
[   12.914958]  ? __virt_addr_valid+0x1db/0x2d0
[   12.914983]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.915005]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.915028]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.915049]  kasan_report+0x141/0x180
[   12.915072]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.915098]  kasan_check_range+0x10c/0x1c0
[   12.915122]  __asan_memset+0x27/0x50
[   12.915141]  kmalloc_uaf_memset+0x1a3/0x360
[   12.915162]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.915184]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   12.915210]  ? trace_hardirqs_on+0x37/0xe0
[   12.915235]  ? __pfx_read_tsc+0x10/0x10
[   12.915257]  ? ktime_get_ts64+0x86/0x230
[   12.915283]  kunit_try_run_case+0x1a5/0x480
[   12.915311]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.915336]  ? queued_spin_lock_slowpath+0x116/0xb40
[   12.915576]  ? __kthread_parkme+0x82/0x180
[   12.915602]  ? preempt_count_sub+0x50/0x80
[   12.915628]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.915653]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.915677]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.915702]  kthread+0x337/0x6f0
[   12.915721]  ? trace_preempt_on+0x20/0xc0
[   12.915743]  ? __pfx_kthread+0x10/0x10
[   12.915764]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.915786]  ? calculate_sigpending+0x7b/0xa0
[   12.915811]  ? __pfx_kthread+0x10/0x10
[   12.915832]  ret_from_fork+0x116/0x1d0
[   12.915851]  ? __pfx_kthread+0x10/0x10
[   12.915872]  ret_from_fork_asm+0x1a/0x30
[   12.915903]  </TASK>
[   12.915915] 
[   12.925408] Allocated by task 203:
[   12.925554]  kasan_save_stack+0x45/0x70
[   12.925705]  kasan_save_track+0x18/0x40
[   12.927897]  kasan_save_alloc_info+0x3b/0x50
[   12.928486]  __kasan_kmalloc+0xb7/0xc0
[   12.928691]  __kmalloc_cache_noprof+0x189/0x420
[   12.928961]  kmalloc_uaf_memset+0xa9/0x360
[   12.929178]  kunit_try_run_case+0x1a5/0x480
[   12.929386]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.929639]  kthread+0x337/0x6f0
[   12.929809]  ret_from_fork+0x116/0x1d0
[   12.930549]  ret_from_fork_asm+0x1a/0x30
[   12.930841] 
[   12.931743] Freed by task 203:
[   12.932600]  kasan_save_stack+0x45/0x70
[   12.933145]  kasan_save_track+0x18/0x40
[   12.933531]  kasan_save_free_info+0x3f/0x60
[   12.934234]  __kasan_slab_free+0x56/0x70
[   12.934751]  kfree+0x222/0x3f0
[   12.935589]  kmalloc_uaf_memset+0x12b/0x360
[   12.936237]  kunit_try_run_case+0x1a5/0x480
[   12.936468]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.936709]  kthread+0x337/0x6f0
[   12.936867]  ret_from_fork+0x116/0x1d0
[   12.937702]  ret_from_fork_asm+0x1a/0x30
[   12.938180] 
[   12.938555] The buggy address belongs to the object at ffff888102aaa580
[   12.938555]  which belongs to the cache kmalloc-64 of size 64
[   12.939483] The buggy address is located 0 bytes inside of
[   12.939483]  freed 64-byte region [ffff888102aaa580, ffff888102aaa5c0)
[   12.940848] 
[   12.941043] The buggy address belongs to the physical page:
[   12.941443] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102aaa
[   12.941786] flags: 0x200000000000000(node=0|zone=2)
[   12.942082] page_type: f5(slab)
[   12.942251] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.942569] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.942881] page dumped because: kasan: bad access detected
[   12.943992] 
[   12.944079] Memory state around the buggy address:
[   12.944274]  ffff888102aaa480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.945079]  ffff888102aaa500: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.945752] >ffff888102aaa580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.946489]                    ^
[   12.946662]  ffff888102aaa600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.947391]  ffff888102aaa680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.947606] ==================================================================