Hay
Date
Nov. 28, 2024, 2:36 a.m.

Environment
qemu-arm64
qemu-x86_64

[   33.749770] ==================================================================
[   33.750506] BUG: KASAN: slab-use-after-free in strnlen+0x80/0x88
[   33.751314] Read of size 1 at addr fff00000c4081c10 by task kunit_try_catch/247
[   33.751677] 
[   33.751847] CPU: 1 UID: 0 PID: 247 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   33.752895] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.754619] Hardware name: linux,dummy-virt (DT)
[   33.755373] Call trace:
[   33.755865]  show_stack+0x20/0x38 (C)
[   33.756550]  dump_stack_lvl+0x8c/0xd0
[   33.757335]  print_report+0x118/0x5e0
[   33.757940]  kasan_report+0xc8/0x118
[   33.758511]  __asan_report_load1_noabort+0x20/0x30
[   33.759225]  strnlen+0x80/0x88
[   33.759777]  kasan_strings+0x380/0x8f8
[   33.760419]  kunit_try_run_case+0x14c/0x3d0
[   33.761157]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.762051]  kthread+0x24c/0x2d0
[   33.762624]  ret_from_fork+0x10/0x20
[   33.763232] 
[   33.763618] Allocated by task 247:
[   33.764083]  kasan_save_stack+0x3c/0x68
[   33.764733]  kasan_save_track+0x20/0x40
[   33.765524]  kasan_save_alloc_info+0x40/0x58
[   33.766165]  __kasan_kmalloc+0xd4/0xd8
[   33.766734]  __kmalloc_cache_noprof+0x15c/0x3c0
[   33.767395]  kasan_strings+0xb4/0x8f8
[   33.767958]  kunit_try_run_case+0x14c/0x3d0
[   33.768600]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.769629]  kthread+0x24c/0x2d0
[   33.770046]  ret_from_fork+0x10/0x20
[   33.770486] 
[   33.770722] Freed by task 247:
[   33.771079]  kasan_save_stack+0x3c/0x68
[   33.771676]  kasan_save_track+0x20/0x40
[   33.772491]  kasan_save_free_info+0x4c/0x78
[   33.773690]  __kasan_slab_free+0x6c/0x98
[   33.774405]  kfree+0x114/0x3c8
[   33.774919]  kasan_strings+0x128/0x8f8
[   33.775512]  kunit_try_run_case+0x14c/0x3d0
[   33.776221]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.776936]  kthread+0x24c/0x2d0
[   33.777721]  ret_from_fork+0x10/0x20
[   33.778212] 
[   33.778565] The buggy address belongs to the object at fff00000c4081c00
[   33.778565]  which belongs to the cache kmalloc-32 of size 32
[   33.779796] The buggy address is located 16 bytes inside of
[   33.779796]  freed 32-byte region [fff00000c4081c00, fff00000c4081c20)
[   33.781320] 
[   33.781663] The buggy address belongs to the physical page:
[   33.782417] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104081
[   33.783303] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.784036] page_type: f5(slab)
[   33.784579] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   33.785740] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   33.786598] page dumped because: kasan: bad access detected
[   33.787240] 
[   33.787654] Memory state around the buggy address:
[   33.788266]  fff00000c4081b00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   33.789263]  fff00000c4081b80: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   33.789975] >fff00000c4081c00: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   33.790831]                          ^
[   33.791383]  fff00000c4081c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.792386]  fff00000c4081d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.793338] ==================================================================

[   24.683496] ==================================================================
[   24.684559] BUG: KASAN: slab-use-after-free in strnlen+0x73/0x80
[   24.685231] Read of size 1 at addr ffff888102a34190 by task kunit_try_catch/267
[   24.686609] 
[   24.687032] CPU: 0 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   24.687918] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.688457] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.689400] Call Trace:
[   24.689786]  <TASK>
[   24.690092]  dump_stack_lvl+0x73/0xb0
[   24.690727]  print_report+0xd1/0x640
[   24.691195]  ? __virt_addr_valid+0x1db/0x2d0
[   24.691784]  ? kasan_complete_mode_report_info+0x64/0x200
[   24.692409]  kasan_report+0x102/0x140
[   24.692986]  ? strnlen+0x73/0x80
[   24.693448]  ? strnlen+0x73/0x80
[   24.694022]  __asan_report_load1_noabort+0x18/0x20
[   24.694537]  strnlen+0x73/0x80
[   24.695098]  kasan_strings+0x4cc/0xb60
[   24.695525]  ? __pfx_kasan_strings+0x10/0x10
[   24.696304]  ? __schedule+0xc3e/0x2790
[   24.696646]  ? __pfx_read_tsc+0x10/0x10
[   24.697127]  ? ktime_get_ts64+0x84/0x230
[   24.697692]  kunit_try_run_case+0x1b3/0x490
[   24.698097]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.699234]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.699623]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.701176]  ? __kthread_parkme+0x82/0x160
[   24.701696]  ? preempt_count_sub+0x50/0x80
[   24.702302]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.702793]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.703434]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.704126]  kthread+0x257/0x310
[   24.704511]  ? __pfx_kthread+0x10/0x10
[   24.705026]  ret_from_fork+0x41/0x80
[   24.705517]  ? __pfx_kthread+0x10/0x10
[   24.705984]  ret_from_fork_asm+0x1a/0x30
[   24.706572]  </TASK>
[   24.706928] 
[   24.707276] Allocated by task 267:
[   24.707597]  kasan_save_stack+0x3d/0x60
[   24.708153]  kasan_save_track+0x18/0x40
[   24.708537]  kasan_save_alloc_info+0x3b/0x50
[   24.709113]  __kasan_kmalloc+0xb7/0xc0
[   24.709617]  __kmalloc_cache_noprof+0x184/0x410
[   24.710276]  kasan_strings+0xb3/0xb60
[   24.710752]  kunit_try_run_case+0x1b3/0x490
[   24.711101]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.711713]  kthread+0x257/0x310
[   24.712043]  ret_from_fork+0x41/0x80
[   24.712306]  ret_from_fork_asm+0x1a/0x30
[   24.713606] 
[   24.713860] Freed by task 267:
[   24.715273]  kasan_save_stack+0x3d/0x60
[   24.715568]  kasan_save_track+0x18/0x40
[   24.716490]  kasan_save_free_info+0x3f/0x60
[   24.716766]  __kasan_slab_free+0x56/0x70
[   24.717022]  kfree+0x123/0x3f0
[   24.717234]  kasan_strings+0x13a/0xb60
[   24.717521]  kunit_try_run_case+0x1b3/0x490
[   24.717822]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.718153]  kthread+0x257/0x310
[   24.719449]  ret_from_fork+0x41/0x80
[   24.719882]  ret_from_fork_asm+0x1a/0x30
[   24.720441] 
[   24.720715] The buggy address belongs to the object at ffff888102a34180
[   24.720715]  which belongs to the cache kmalloc-32 of size 32
[   24.722134] The buggy address is located 16 bytes inside of
[   24.722134]  freed 32-byte region [ffff888102a34180, ffff888102a341a0)
[   24.722883] 
[   24.723038] The buggy address belongs to the physical page:
[   24.723432] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a34
[   24.724495] flags: 0x200000000000000(node=0|zone=2)
[   24.725136] page_type: f5(slab)
[   24.725595] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   24.726462] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   24.727231] page dumped because: kasan: bad access detected
[   24.727573] 
[   24.727723] Memory state around the buggy address:
[   24.728018]  ffff888102a34080: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   24.728583]  ffff888102a34100: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   24.729663] >ffff888102a34180: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   24.730494]                          ^
[   24.730894]  ffff888102a34200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.731638]  ffff888102a34280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.732035] ==================================================================