Hay
Date
March 19, 2025, 10:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   34.123367] ==================================================================
[   34.123581] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x3bc/0x438
[   34.123737] Read of size 16 at addr fff00000c5d8b020 by task kunit_try_catch/170
[   34.123892] 
[   34.124044] CPU: 1 UID: 0 PID: 170 Comm: kunit_try_catch Tainted: G    B            N  6.14.0-rc7-next-20250319 #1 PREEMPT 
[   34.124419] Tainted: [B]=BAD_PAGE, [N]=TEST
[   34.124556] Hardware name: linux,dummy-virt (DT)
[   34.124671] Call trace:
[   34.124778]  show_stack+0x20/0x38 (C)
[   34.124979]  dump_stack_lvl+0x8c/0xd0
[   34.125193]  print_report+0x118/0x5f0
[   34.125375]  kasan_report+0xc8/0x118
[   34.125558]  __asan_report_load16_noabort+0x20/0x30
[   34.125719]  kmalloc_uaf_16+0x3bc/0x438
[   34.125859]  kunit_try_run_case+0x14c/0x3d0
[   34.126006]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.126204]  kthread+0x318/0x618
[   34.126365]  ret_from_fork+0x10/0x20
[   34.126509] 
[   34.126642] Allocated by task 170:
[   34.126763]  kasan_save_stack+0x3c/0x68
[   34.126899]  kasan_save_track+0x20/0x40
[   34.127173]  kasan_save_alloc_info+0x40/0x58
[   34.127312]  __kasan_kmalloc+0xd4/0xd8
[   34.127439]  __kmalloc_cache_noprof+0x15c/0x3c0
[   34.127631]  kmalloc_uaf_16+0x140/0x438
[   34.127750]  kunit_try_run_case+0x14c/0x3d0
[   34.127890]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.128026]  kthread+0x318/0x618
[   34.128205]  ret_from_fork+0x10/0x20
[   34.128383] 
[   34.128444] Freed by task 170:
[   34.128519]  kasan_save_stack+0x3c/0x68
[   34.128708]  kasan_save_track+0x20/0x40
[   34.128860]  kasan_save_free_info+0x4c/0x78
[   34.129040]  __kasan_slab_free+0x6c/0x98
[   34.129179]  kfree+0x214/0x3c8
[   34.129287]  kmalloc_uaf_16+0x190/0x438
[   34.129402]  kunit_try_run_case+0x14c/0x3d0
[   34.129619]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.129771]  kthread+0x318/0x618
[   34.129884]  ret_from_fork+0x10/0x20
[   34.130161] 
[   34.130278] The buggy address belongs to the object at fff00000c5d8b020
[   34.130278]  which belongs to the cache kmalloc-16 of size 16
[   34.131010] The buggy address is located 0 bytes inside of
[   34.131010]  freed 16-byte region [fff00000c5d8b020, fff00000c5d8b030)
[   34.131721] 
[   34.131973] The buggy address belongs to the physical page:
[   34.132320] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105d8b
[   34.133298] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   34.133576] page_type: f5(slab)
[   34.133777] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   34.133944] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   34.134091] page dumped because: kasan: bad access detected
[   34.134195] 
[   34.134816] Memory state around the buggy address:
[   34.135295]  fff00000c5d8af00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.136168]  fff00000c5d8af80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.136483] >fff00000c5d8b000: 00 00 fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   34.136981]                                ^
[   34.137507]  fff00000c5d8b080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.137667]  fff00000c5d8b100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.138103] ==================================================================

[   21.740090] ==================================================================
[   21.740870] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x47b/0x4c0
[   21.742030] Read of size 16 at addr ffff888102551980 by task kunit_try_catch/189
[   21.742597] 
[   21.742820] CPU: 1 UID: 0 PID: 189 Comm: kunit_try_catch Tainted: G    B            N  6.14.0-rc7-next-20250319 #1 PREEMPT(voluntary) 
[   21.742940] Tainted: [B]=BAD_PAGE, [N]=TEST
[   21.742973] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   21.743024] Call Trace:
[   21.743056]  <TASK>
[   21.743085]  dump_stack_lvl+0x73/0xb0
[   21.743160]  print_report+0xd1/0x660
[   21.743195]  ? __virt_addr_valid+0x1db/0x2d0
[   21.743286]  ? kasan_complete_mode_report_info+0x64/0x200
[   21.743354]  kasan_report+0x104/0x140
[   21.743406]  ? kmalloc_uaf_16+0x47b/0x4c0
[   21.743467]  ? kmalloc_uaf_16+0x47b/0x4c0
[   21.743539]  __asan_report_load16_noabort+0x18/0x20
[   21.743625]  kmalloc_uaf_16+0x47b/0x4c0
[   21.743687]  ? __pfx_kmalloc_uaf_16+0x10/0x10
[   21.744197]  ? __schedule+0xd46/0x29c0
[   21.744259]  ? __pfx_read_tsc+0x10/0x10
[   21.744293]  ? ktime_get_ts64+0x86/0x240
[   21.744331]  kunit_try_run_case+0x1b2/0x490
[   21.744368]  ? __pfx_kunit_try_run_case+0x10/0x10
[   21.744400]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   21.744430]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   21.744462]  ? __kthread_parkme+0x82/0x160
[   21.744493]  ? preempt_count_sub+0x50/0x80
[   21.744529]  ? __pfx_kunit_try_run_case+0x10/0x10
[   21.744562]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   21.744595]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   21.744627]  kthread+0x323/0x710
[   21.744656]  ? trace_preempt_on+0x20/0xc0
[   21.744689]  ? __pfx_kthread+0x10/0x10
[   21.744772]  ? _raw_spin_unlock_irq+0x47/0x80
[   21.744803]  ? calculate_sigpending+0x7b/0xa0
[   21.744834]  ? __pfx_kthread+0x10/0x10
[   21.744866]  ret_from_fork+0x41/0x80
[   21.744898]  ? __pfx_kthread+0x10/0x10
[   21.744930]  ret_from_fork_asm+0x1a/0x30
[   21.744976]  </TASK>
[   21.744991] 
[   21.758764] Allocated by task 189:
[   21.759209]  kasan_save_stack+0x3d/0x60
[   21.759756]  kasan_save_track+0x18/0x40
[   21.760270]  kasan_save_alloc_info+0x3b/0x50
[   21.760897]  __kasan_kmalloc+0xb7/0xc0
[   21.761365]  __kmalloc_cache_noprof+0x183/0x410
[   21.761662]  kmalloc_uaf_16+0x15b/0x4c0
[   21.762204]  kunit_try_run_case+0x1b2/0x490
[   21.762773]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   21.763473]  kthread+0x323/0x710
[   21.764065]  ret_from_fork+0x41/0x80
[   21.764634]  ret_from_fork_asm+0x1a/0x30
[   21.765276] 
[   21.765559] Freed by task 189:
[   21.765995]  kasan_save_stack+0x3d/0x60
[   21.766462]  kasan_save_track+0x18/0x40
[   21.766994]  kasan_save_free_info+0x3f/0x60
[   21.767435]  __kasan_slab_free+0x56/0x70
[   21.767995]  kfree+0x222/0x3f0
[   21.768448]  kmalloc_uaf_16+0x1d6/0x4c0
[   21.769026]  kunit_try_run_case+0x1b2/0x490
[   21.769652]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   21.770474]  kthread+0x323/0x710
[   21.770935]  ret_from_fork+0x41/0x80
[   21.771238]  ret_from_fork_asm+0x1a/0x30
[   21.771510] 
[   21.771691] The buggy address belongs to the object at ffff888102551980
[   21.771691]  which belongs to the cache kmalloc-16 of size 16
[   21.772624] The buggy address is located 0 bytes inside of
[   21.772624]  freed 16-byte region [ffff888102551980, ffff888102551990)
[   21.773947] 
[   21.774223] The buggy address belongs to the physical page:
[   21.774926] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102551
[   21.775850] flags: 0x200000000000000(node=0|zone=2)
[   21.776460] page_type: f5(slab)
[   21.776942] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   21.777779] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   21.778194] page dumped because: kasan: bad access detected
[   21.778560] 
[   21.778799] Memory state around the buggy address:
[   21.779105]  ffff888102551880: 00 04 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   21.781166]  ffff888102551900: 00 05 fc fc fa fb fc fc fa fb fc fc 00 00 fc fc
[   21.782615] >ffff888102551980: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.784589]                    ^
[   21.785995]  ffff888102551a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.788046]  ffff888102551a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.789324] ==================================================================