Hay
Date
June 7, 2025, 10:40 a.m.

Environment
qemu-arm64
qemu-x86_64

[   22.817730] ==================================================================
[   22.817961] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   22.818129] Read of size 1 at addr fff00000c57223a8 by task kunit_try_catch/188
[   22.818266] 
[   22.818371] CPU: 1 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.15.2-rc1 #1 PREEMPT 
[   22.818861] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.818937] Hardware name: linux,dummy-virt (DT)
[   22.819009] Call trace:
[   22.819074]  show_stack+0x20/0x38 (C)
[   22.819218]  dump_stack_lvl+0x8c/0xd0
[   22.819350]  print_report+0x118/0x608
[   22.819480]  kasan_report+0xdc/0x128
[   22.819574]  __asan_report_load1_noabort+0x20/0x30
[   22.819671]  kmalloc_uaf+0x300/0x338
[   22.819765]  kunit_try_run_case+0x170/0x3f0
[   22.819877]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.820014]  kthread+0x328/0x630
[   22.820128]  ret_from_fork+0x10/0x20
[   22.820265] 
[   22.820305] Allocated by task 188:
[   22.820377]  kasan_save_stack+0x3c/0x68
[   22.820515]  kasan_save_track+0x20/0x40
[   22.820600]  kasan_save_alloc_info+0x40/0x58
[   22.820694]  __kasan_kmalloc+0xd4/0xd8
[   22.820781]  __kmalloc_cache_noprof+0x16c/0x3c0
[   22.820908]  kmalloc_uaf+0xb8/0x338
[   22.821015]  kunit_try_run_case+0x170/0x3f0
[   22.821163]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.821329]  kthread+0x328/0x630
[   22.821471]  ret_from_fork+0x10/0x20
[   22.821608] 
[   22.821665] Freed by task 188:
[   22.821727]  kasan_save_stack+0x3c/0x68
[   22.821836]  kasan_save_track+0x20/0x40
[   22.821935]  kasan_save_free_info+0x4c/0x78
[   22.822044]  __kasan_slab_free+0x6c/0x98
[   22.822181]  kfree+0x214/0x3c8
[   22.822277]  kmalloc_uaf+0x11c/0x338
[   22.822414]  kunit_try_run_case+0x170/0x3f0
[   22.822506]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.822670]  kthread+0x328/0x630
[   22.822756]  ret_from_fork+0x10/0x20
[   22.822848] 
[   22.822901] The buggy address belongs to the object at fff00000c57223a0
[   22.822901]  which belongs to the cache kmalloc-16 of size 16
[   22.823050] The buggy address is located 8 bytes inside of
[   22.823050]  freed 16-byte region [fff00000c57223a0, fff00000c57223b0)
[   22.823203] 
[   22.823281] The buggy address belongs to the physical page:
[   22.823377] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105722
[   22.823531] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   22.823645] page_type: f5(slab)
[   22.823730] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   22.824084] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   22.824188] page dumped because: kasan: bad access detected
[   22.824268] 
[   22.824316] Memory state around the buggy address:
[   22.824441]  fff00000c5722280: fa fb fc fc fa fb fc fc fa fb fc fc 00 04 fc fc
[   22.824549]  fff00000c5722300: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   22.824659] >fff00000c5722380: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   22.824767]                                   ^
[   22.824887]  fff00000c5722400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.825051]  fff00000c5722480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.825163] ==================================================================

[   13.992320] ==================================================================
[   13.993104] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   13.993286] Read of size 1 at addr ffff8881026ac908 by task kunit_try_catch/204
[   13.993420] 
[   13.993499] CPU: 1 UID: 0 PID: 204 Comm: kunit_try_catch Tainted: G    B            N  6.15.2-rc1 #1 PREEMPT(voluntary) 
[   13.993554] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.993592] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.993626] Call Trace:
[   13.993649]  <TASK>
[   13.993683]  dump_stack_lvl+0x73/0xb0
[   13.993729]  print_report+0xd1/0x650
[   13.993777]  ? __virt_addr_valid+0x1db/0x2d0
[   13.993816]  ? kmalloc_uaf+0x320/0x380
[   13.993847]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.993882]  ? kmalloc_uaf+0x320/0x380
[   13.993913]  kasan_report+0x141/0x180
[   13.993947]  ? kmalloc_uaf+0x320/0x380
[   13.993983]  __asan_report_load1_noabort+0x18/0x20
[   13.994015]  kmalloc_uaf+0x320/0x380
[   13.994049]  ? __pfx_kmalloc_uaf+0x10/0x10
[   13.994087]  ? __schedule+0x10cc/0x2b30
[   13.994126]  ? __pfx_read_tsc+0x10/0x10
[   13.994165]  ? ktime_get_ts64+0x86/0x230
[   13.994215]  kunit_try_run_case+0x1a5/0x480
[   13.994265]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.994308]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.994354]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.994416]  ? __kthread_parkme+0x82/0x180
[   13.994454]  ? preempt_count_sub+0x50/0x80
[   13.994501]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.994543]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.994601]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.994645]  kthread+0x337/0x6f0
[   13.994681]  ? trace_preempt_on+0x20/0xc0
[   13.994731]  ? __pfx_kthread+0x10/0x10
[   13.994770]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.994808]  ? calculate_sigpending+0x7b/0xa0
[   13.994854]  ? __pfx_kthread+0x10/0x10
[   13.994886]  ret_from_fork+0x41/0x80
[   13.994928]  ? __pfx_kthread+0x10/0x10
[   13.994957]  ret_from_fork_asm+0x1a/0x30
[   13.995012]  </TASK>
[   13.995036] 
[   14.008115] Allocated by task 204:
[   14.008304]  kasan_save_stack+0x45/0x70
[   14.008475]  kasan_save_track+0x18/0x40
[   14.009293]  kasan_save_alloc_info+0x3b/0x50
[   14.009518]  __kasan_kmalloc+0xb7/0xc0
[   14.009745]  __kmalloc_cache_noprof+0x189/0x420
[   14.010314]  kmalloc_uaf+0xaa/0x380
[   14.011299]  kunit_try_run_case+0x1a5/0x480
[   14.011500]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.011775]  kthread+0x337/0x6f0
[   14.011979]  ret_from_fork+0x41/0x80
[   14.012267]  ret_from_fork_asm+0x1a/0x30
[   14.012500] 
[   14.012664] Freed by task 204:
[   14.012887]  kasan_save_stack+0x45/0x70
[   14.013197]  kasan_save_track+0x18/0x40
[   14.013419]  kasan_save_free_info+0x3f/0x60
[   14.014326]  __kasan_slab_free+0x56/0x70
[   14.014511]  kfree+0x222/0x3f0
[   14.015127]  kmalloc_uaf+0x12c/0x380
[   14.015296]  kunit_try_run_case+0x1a5/0x480
[   14.015947]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.016432]  kthread+0x337/0x6f0
[   14.016604]  ret_from_fork+0x41/0x80
[   14.017225]  ret_from_fork_asm+0x1a/0x30
[   14.017397] 
[   14.017908] The buggy address belongs to the object at ffff8881026ac900
[   14.017908]  which belongs to the cache kmalloc-16 of size 16
[   14.018231] The buggy address is located 8 bytes inside of
[   14.018231]  freed 16-byte region [ffff8881026ac900, ffff8881026ac910)
[   14.019144] 
[   14.019239] The buggy address belongs to the physical page:
[   14.019423] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1026ac
[   14.020661] flags: 0x200000000000000(node=0|zone=2)
[   14.020973] page_type: f5(slab)
[   14.021122] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   14.021518] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   14.022024] page dumped because: kasan: bad access detected
[   14.022318] 
[   14.022446] Memory state around the buggy address:
[   14.023275]  ffff8881026ac800: 00 02 fc fc 00 02 fc fc 00 02 fc fc fa fb fc fc
[   14.024899]  ffff8881026ac880: fa fb fc fc fa fb fc fc 00 04 fc fc fa fb fc fc
[   14.025454] >ffff8881026ac900: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.027087]                       ^
[   14.027286]  ffff8881026ac980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.027526]  ffff8881026aca00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.027767] ==================================================================