Hay
Date
June 17, 2025, 3:40 p.m.

Environment
qemu-arm64
qemu-x86_64

[   22.011717] ==================================================================
[   22.013528] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x3f4/0x468
[   22.013683] Read of size 1 at addr fff00000c58df328 by task kunit_try_catch/190
[   22.013821] 
[   22.013907] CPU: 0 UID: 0 PID: 190 Comm: kunit_try_catch Tainted: G    B            N  6.15.3-rc1 #1 PREEMPT 
[   22.014070] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.014129] Hardware name: linux,dummy-virt (DT)
[   22.014190] Call trace:
[   22.014237]  show_stack+0x20/0x38 (C)
[   22.014351]  dump_stack_lvl+0x8c/0xd0
[   22.014460]  print_report+0x118/0x608
[   22.014557]  kasan_report+0xdc/0x128
[   22.014646]  __asan_report_load1_noabort+0x20/0x30
[   22.014770]  kmalloc_uaf2+0x3f4/0x468
[   22.014871]  kunit_try_run_case+0x170/0x3f0
[   22.014985]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.015102]  kthread+0x328/0x630
[   22.015205]  ret_from_fork+0x10/0x20
[   22.015320] 
[   22.015362] Allocated by task 190:
[   22.015427]  kasan_save_stack+0x3c/0x68
[   22.015519]  kasan_save_track+0x20/0x40
[   22.015602]  kasan_save_alloc_info+0x40/0x58
[   22.015687]  __kasan_kmalloc+0xd4/0xd8
[   22.017131]  __kmalloc_cache_noprof+0x16c/0x3c0
[   22.017268]  kmalloc_uaf2+0xc4/0x468
[   22.017377]  kunit_try_run_case+0x170/0x3f0
[   22.017502]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.017596]  kthread+0x328/0x630
[   22.017674]  ret_from_fork+0x10/0x20
[   22.017775] 
[   22.017817] Freed by task 190:
[   22.017875]  kasan_save_stack+0x3c/0x68
[   22.017947]  kasan_save_track+0x20/0x40
[   22.018022]  kasan_save_free_info+0x4c/0x78
[   22.018105]  __kasan_slab_free+0x6c/0x98
[   22.018190]  kfree+0x214/0x3c8
[   22.018270]  kmalloc_uaf2+0x134/0x468
[   22.018364]  kunit_try_run_case+0x170/0x3f0
[   22.018457]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.018550]  kthread+0x328/0x630
[   22.018628]  ret_from_fork+0x10/0x20
[   22.018710] 
[   22.018775] The buggy address belongs to the object at fff00000c58df300
[   22.018775]  which belongs to the cache kmalloc-64 of size 64
[   22.018930] The buggy address is located 40 bytes inside of
[   22.018930]  freed 64-byte region [fff00000c58df300, fff00000c58df340)
[   22.019091] 
[   22.019157] The buggy address belongs to the physical page:
[   22.019253] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1058df
[   22.019415] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   22.019541] page_type: f5(slab)
[   22.019694] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   22.020040] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   22.020162] page dumped because: kasan: bad access detected
[   22.020225] 
[   22.020269] Memory state around the buggy address:
[   22.020336]  fff00000c58df200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   22.020497]  fff00000c58df280: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   22.020595] >fff00000c58df300: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   22.020681]                                   ^
[   22.020827]  fff00000c58df380: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   22.020941]  fff00000c58df400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.021037] ==================================================================

[   19.737506] ==================================================================
[   19.738899] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   19.739668] Read of size 1 at addr ffff8881030a1ba8 by task kunit_try_catch/208
[   19.741316] 
[   19.741883] CPU: 0 UID: 0 PID: 208 Comm: kunit_try_catch Tainted: G    B            N  6.15.3-rc1 #1 PREEMPT(voluntary) 
[   19.741999] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.742039] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   19.742099] Call Trace:
[   19.742144]  <TASK>
[   19.742216]  dump_stack_lvl+0x73/0xb0
[   19.742318]  print_report+0xd1/0x650
[   19.742549]  ? __virt_addr_valid+0x1db/0x2d0
[   19.742590]  ? kmalloc_uaf2+0x4a8/0x520
[   19.742622]  ? kasan_complete_mode_report_info+0x64/0x200
[   19.742657]  ? kmalloc_uaf2+0x4a8/0x520
[   19.742690]  kasan_report+0x141/0x180
[   19.742726]  ? kmalloc_uaf2+0x4a8/0x520
[   19.742764]  __asan_report_load1_noabort+0x18/0x20
[   19.742796]  kmalloc_uaf2+0x4a8/0x520
[   19.742830]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   19.742860]  ? finish_task_switch.isra.0+0x153/0x700
[   19.742897]  ? __switch_to+0x5d9/0xf60
[   19.742929]  ? dequeue_task_fair+0x166/0x4e0
[   19.743082]  ? __schedule+0x10cc/0x2b60
[   19.743128]  ? __pfx_read_tsc+0x10/0x10
[   19.743164]  ? ktime_get_ts64+0x86/0x230
[   19.743204]  kunit_try_run_case+0x1a5/0x480
[   19.743245]  ? __pfx_kunit_try_run_case+0x10/0x10
[   19.743279]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   19.743344]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   19.743382]  ? __kthread_parkme+0x82/0x180
[   19.743417]  ? preempt_count_sub+0x50/0x80
[   19.743453]  ? __pfx_kunit_try_run_case+0x10/0x10
[   19.743490]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.743524]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   19.743560]  kthread+0x337/0x6f0
[   19.743586]  ? trace_preempt_on+0x20/0xc0
[   19.743623]  ? __pfx_kthread+0x10/0x10
[   19.743650]  ? _raw_spin_unlock_irq+0x47/0x80
[   19.743682]  ? calculate_sigpending+0x7b/0xa0
[   19.743715]  ? __pfx_kthread+0x10/0x10
[   19.743742]  ret_from_fork+0x41/0x80
[   19.743774]  ? __pfx_kthread+0x10/0x10
[   19.743800]  ret_from_fork_asm+0x1a/0x30
[   19.743847]  </TASK>
[   19.743863] 
[   19.764765] Allocated by task 208:
[   19.765795]  kasan_save_stack+0x45/0x70
[   19.766629]  kasan_save_track+0x18/0x40
[   19.766960]  kasan_save_alloc_info+0x3b/0x50
[   19.767809]  __kasan_kmalloc+0xb7/0xc0
[   19.768158]  __kmalloc_cache_noprof+0x189/0x420
[   19.769087]  kmalloc_uaf2+0xc6/0x520
[   19.769651]  kunit_try_run_case+0x1a5/0x480
[   19.770442]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.770861]  kthread+0x337/0x6f0
[   19.771503]  ret_from_fork+0x41/0x80
[   19.771892]  ret_from_fork_asm+0x1a/0x30
[   19.772431] 
[   19.772646] Freed by task 208:
[   19.773137]  kasan_save_stack+0x45/0x70
[   19.773627]  kasan_save_track+0x18/0x40
[   19.774100]  kasan_save_free_info+0x3f/0x60
[   19.774596]  __kasan_slab_free+0x56/0x70
[   19.775395]  kfree+0x222/0x3f0
[   19.775797]  kmalloc_uaf2+0x14c/0x520
[   19.776175]  kunit_try_run_case+0x1a5/0x480
[   19.776618]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.777134]  kthread+0x337/0x6f0
[   19.777730]  ret_from_fork+0x41/0x80
[   19.778321]  ret_from_fork_asm+0x1a/0x30
[   19.778774] 
[   19.779191] The buggy address belongs to the object at ffff8881030a1b80
[   19.779191]  which belongs to the cache kmalloc-64 of size 64
[   19.780355] The buggy address is located 40 bytes inside of
[   19.780355]  freed 64-byte region [ffff8881030a1b80, ffff8881030a1bc0)
[   19.781565] 
[   19.781851] The buggy address belongs to the physical page:
[   19.782535] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1030a1
[   19.783406] flags: 0x200000000000000(node=0|zone=2)
[   19.783863] page_type: f5(slab)
[   19.784455] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   19.785174] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   19.785898] page dumped because: kasan: bad access detected
[   19.786725] 
[   19.787127] Memory state around the buggy address:
[   19.787574]  ffff8881030a1a80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.788427]  ffff8881030a1b00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.789229] >ffff8881030a1b80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.789868]                                   ^
[   19.790484]  ffff8881030a1c00: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   19.791281]  ffff8881030a1c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.792112] ==================================================================