Hay
Date
Dec. 3, 2024, 11:38 p.m.

Environment
qemu-arm64
qemu-x86_64

[   33.695446] ==================================================================
[   33.696609] BUG: KASAN: slab-use-after-free in strnlen+0x80/0x88
[   33.697396] Read of size 1 at addr fff00000c5921b90 by task kunit_try_catch/248
[   33.698142] 
[   33.698666] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   33.700202] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.701105] Hardware name: linux,dummy-virt (DT)
[   33.701787] Call trace:
[   33.702276]  show_stack+0x20/0x38 (C)
[   33.703277]  dump_stack_lvl+0x8c/0xd0
[   33.703851]  print_report+0x118/0x5e0
[   33.704515]  kasan_report+0xc8/0x118
[   33.705130]  __asan_report_load1_noabort+0x20/0x30
[   33.705892]  strnlen+0x80/0x88
[   33.706496]  kasan_strings+0x364/0x8d8
[   33.707412]  kunit_try_run_case+0x14c/0x3d0
[   33.708126]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.708937]  kthread+0x24c/0x2d0
[   33.709555]  ret_from_fork+0x10/0x20
[   33.710198] 
[   33.710534] Allocated by task 248:
[   33.711191]  kasan_save_stack+0x3c/0x68
[   33.711958]  kasan_save_track+0x20/0x40
[   33.712518]  kasan_save_alloc_info+0x40/0x58
[   33.713318]  __kasan_kmalloc+0xd4/0xd8
[   33.713950]  __kmalloc_cache_noprof+0x15c/0x3c0
[   33.714671]  kasan_strings+0xb0/0x8d8
[   33.715478]  kunit_try_run_case+0x14c/0x3d0
[   33.716263]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.716949]  kthread+0x24c/0x2d0
[   33.717544]  ret_from_fork+0x10/0x20
[   33.718400] 
[   33.718923] Freed by task 248:
[   33.719423]  kasan_save_stack+0x3c/0x68
[   33.720272]  kasan_save_track+0x20/0x40
[   33.720707]  kasan_save_free_info+0x4c/0x78
[   33.721149]  __kasan_slab_free+0x6c/0x98
[   33.721624]  kfree+0x114/0x3c8
[   33.722296]  kasan_strings+0x124/0x8d8
[   33.723013]  kunit_try_run_case+0x14c/0x3d0
[   33.723994]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.724827]  kthread+0x24c/0x2d0
[   33.725300]  ret_from_fork+0x10/0x20
[   33.725817] 
[   33.726114] The buggy address belongs to the object at fff00000c5921b80
[   33.726114]  which belongs to the cache kmalloc-32 of size 32
[   33.727302] The buggy address is located 16 bytes inside of
[   33.727302]  freed 32-byte region [fff00000c5921b80, fff00000c5921ba0)
[   33.729353] 
[   33.729845] The buggy address belongs to the physical page:
[   33.730746] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105921
[   33.731861] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.732854] page_type: f5(slab)
[   33.733538] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   33.734664] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   33.735798] page dumped because: kasan: bad access detected
[   33.736624] 
[   33.737009] Memory state around the buggy address:
[   33.737739]  fff00000c5921a80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.738886]  fff00000c5921b00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.739874] >fff00000c5921b80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.740891]                          ^
[   33.741572]  fff00000c5921c00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   33.742636]  fff00000c5921c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.743592] ==================================================================

[   28.969597] ==================================================================
[   28.970606] BUG: KASAN: slab-use-after-free in strnlen+0x73/0x80
[   28.971266] Read of size 1 at addr ffff888102a07b90 by task kunit_try_catch/268
[   28.972133] 
[   28.972430] CPU: 1 UID: 0 PID: 268 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   28.973448] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.973893] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.974851] Call Trace:
[   28.975142]  <TASK>
[   28.975418]  dump_stack_lvl+0x73/0xb0
[   28.975866]  print_report+0xd1/0x640
[   28.976360]  ? __virt_addr_valid+0x1db/0x2d0
[   28.977015]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.977778]  kasan_report+0x102/0x140
[   28.978279]  ? strnlen+0x73/0x80
[   28.978510]  ? strnlen+0x73/0x80
[   28.978879]  __asan_report_load1_noabort+0x18/0x20
[   28.979372]  strnlen+0x73/0x80
[   28.979718]  kasan_strings+0x4c3/0xb60
[   28.979990]  ? __pfx_kasan_strings+0x10/0x10
[   28.980427]  ? __schedule+0xc3e/0x2790
[   28.980996]  ? __pfx_read_tsc+0x10/0x10
[   28.981425]  ? ktime_get_ts64+0x86/0x230
[   28.981826]  kunit_try_run_case+0x1b3/0x490
[   28.982185]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.982898]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.983378]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.983941]  ? __kthread_parkme+0x82/0x160
[   28.984450]  ? preempt_count_sub+0x50/0x80
[   28.984964]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.985377]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.986018]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.986488]  kthread+0x257/0x310
[   28.986935]  ? __pfx_kthread+0x10/0x10
[   28.987350]  ret_from_fork+0x41/0x80
[   28.987699]  ? __pfx_kthread+0x10/0x10
[   28.988151]  ret_from_fork_asm+0x1a/0x30
[   28.988651]  </TASK>
[   28.988847] 
[   28.989137] Allocated by task 268:
[   28.989511]  kasan_save_stack+0x3d/0x60
[   28.989981]  kasan_save_track+0x18/0x40
[   28.990410]  kasan_save_alloc_info+0x3b/0x50
[   28.990821]  __kasan_kmalloc+0xb7/0xc0
[   28.991283]  __kmalloc_cache_noprof+0x184/0x410
[   28.991939]  kasan_strings+0xb9/0xb60
[   28.992348]  kunit_try_run_case+0x1b3/0x490
[   28.992796]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.993278]  kthread+0x257/0x310
[   28.993822]  ret_from_fork+0x41/0x80
[   28.994179]  ret_from_fork_asm+0x1a/0x30
[   28.994747] 
[   28.995065] Freed by task 268:
[   28.995300]  kasan_save_stack+0x3d/0x60
[   28.995775]  kasan_save_track+0x18/0x40
[   28.996179]  kasan_save_free_info+0x3f/0x60
[   28.996460]  __kasan_slab_free+0x56/0x70
[   28.996861]  kfree+0x123/0x3f0
[   28.997302]  kasan_strings+0x13c/0xb60
[   28.997795]  kunit_try_run_case+0x1b3/0x490
[   28.998244]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.998721]  kthread+0x257/0x310
[   28.999155]  ret_from_fork+0x41/0x80
[   28.999625]  ret_from_fork_asm+0x1a/0x30
[   29.000022] 
[   29.000204] The buggy address belongs to the object at ffff888102a07b80
[   29.000204]  which belongs to the cache kmalloc-32 of size 32
[   29.001173] The buggy address is located 16 bytes inside of
[   29.001173]  freed 32-byte region [ffff888102a07b80, ffff888102a07ba0)
[   29.002195] 
[   29.002440] The buggy address belongs to the physical page:
[   29.002846] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a07
[   29.003606] flags: 0x200000000000000(node=0|zone=2)
[   29.004019] page_type: f5(slab)
[   29.004368] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   29.005108] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   29.005723] page dumped because: kasan: bad access detected
[   29.006096] 
[   29.006298] Memory state around the buggy address:
[   29.006631]  ffff888102a07a80: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   29.007090]  ffff888102a07b00: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   29.007811] >ffff888102a07b80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   29.008426]                          ^
[   29.009004]  ffff888102a07c00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   29.009739]  ffff888102a07c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   29.010398] ==================================================================