Hay
Date
Nov. 27, 2024, 3:37 a.m.

Environment
qemu-arm64
qemu-x86_64

[   51.167889] ==================================================================
[   51.170211] BUG: KASAN: slab-use-after-free in strnlen+0x80/0x88
[   51.170728] Read of size 1 at addr fff00000c616c150 by task kunit_try_catch/248
[   51.171268] 
[   51.173981] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   51.175936] Tainted: [B]=BAD_PAGE, [N]=TEST
[   51.176723] Hardware name: linux,dummy-virt (DT)
[   51.177401] Call trace:
[   51.178037]  show_stack+0x20/0x38 (C)
[   51.179338]  dump_stack_lvl+0x8c/0xd0
[   51.179922]  print_report+0x118/0x5e0
[   51.180523]  kasan_report+0xc8/0x118
[   51.181130]  __asan_report_load1_noabort+0x20/0x30
[   51.181826]  strnlen+0x80/0x88
[   51.182445]  kasan_strings+0x380/0x8f8
[   51.182993]  kunit_try_run_case+0x14c/0x3d0
[   51.184085]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   51.184755]  kthread+0x24c/0x2d0
[   51.185649]  ret_from_fork+0x10/0x20
[   51.186211] 
[   51.186594] Allocated by task 248:
[   51.187097]  kasan_save_stack+0x3c/0x68
[   51.187664]  kasan_save_track+0x20/0x40
[   51.188382]  kasan_save_alloc_info+0x40/0x58
[   51.189133]  __kasan_kmalloc+0xd4/0xd8
[   51.190133]  __kmalloc_cache_noprof+0x15c/0x3c0
[   51.190923]  kasan_strings+0xb4/0x8f8
[   51.191854]  kunit_try_run_case+0x14c/0x3d0
[   51.192387]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   51.193352]  kthread+0x24c/0x2d0
[   51.193942]  ret_from_fork+0x10/0x20
[   51.194639] 
[   51.195161] Freed by task 248:
[   51.195658]  kasan_save_stack+0x3c/0x68
[   51.196391]  kasan_save_track+0x20/0x40
[   51.197271]  kasan_save_free_info+0x4c/0x78
[   51.198525]  __kasan_slab_free+0x6c/0x98
[   51.199468]  kfree+0x114/0x3c8
[   51.199992]  kasan_strings+0x128/0x8f8
[   51.200499]  kunit_try_run_case+0x14c/0x3d0
[   51.200807]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   51.201558]  kthread+0x24c/0x2d0
[   51.202633]  ret_from_fork+0x10/0x20
[   51.203603] 
[   51.203930] The buggy address belongs to the object at fff00000c616c140
[   51.203930]  which belongs to the cache kmalloc-32 of size 32
[   51.205819] The buggy address is located 16 bytes inside of
[   51.205819]  freed 32-byte region [fff00000c616c140, fff00000c616c160)
[   51.208163] 
[   51.208636] The buggy address belongs to the physical page:
[   51.209391] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10616c
[   51.210700] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   51.211464] page_type: f5(slab)
[   51.212284] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   51.213440] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   51.214264] page dumped because: kasan: bad access detected
[   51.215007] 
[   51.215414] Memory state around the buggy address:
[   51.216095]  fff00000c616c000: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   51.216842]  fff00000c616c080: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   51.218183] >fff00000c616c100: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   51.219012]                                                  ^
[   51.219766]  fff00000c616c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   51.220672]  fff00000c616c200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   51.222108] ==================================================================

[   28.574431] ==================================================================
[   28.575651] BUG: KASAN: slab-use-after-free in strnlen+0x73/0x80
[   28.576769] Read of size 1 at addr ffff888101ab9950 by task kunit_try_catch/267
[   28.577401] 
[   28.577670] CPU: 1 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   28.578776] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.580050] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.580808] Call Trace:
[   28.581473]  <TASK>
[   28.581659]  dump_stack_lvl+0x73/0xb0
[   28.582408]  print_report+0xd1/0x640
[   28.583049]  ? __virt_addr_valid+0x1db/0x2d0
[   28.583687]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.584461]  kasan_report+0x102/0x140
[   28.584880]  ? strnlen+0x73/0x80
[   28.585574]  ? strnlen+0x73/0x80
[   28.586373]  __asan_report_load1_noabort+0x18/0x20
[   28.587236]  strnlen+0x73/0x80
[   28.587638]  kasan_strings+0x4cc/0xb60
[   28.588275]  ? __pfx_kasan_strings+0x10/0x10
[   28.588742]  ? __schedule+0xc3e/0x2790
[   28.589341]  ? __pfx_read_tsc+0x10/0x10
[   28.589839]  ? ktime_get_ts64+0x84/0x230
[   28.590445]  kunit_try_run_case+0x1b3/0x490
[   28.591268]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.591806]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.592552]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.593504]  ? __kthread_parkme+0x82/0x160
[   28.594035]  ? preempt_count_sub+0x50/0x80
[   28.594771]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.595610]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.596386]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.597053]  kthread+0x257/0x310
[   28.597641]  ? __pfx_kthread+0x10/0x10
[   28.598811]  ret_from_fork+0x41/0x80
[   28.599267]  ? __pfx_kthread+0x10/0x10
[   28.599766]  ret_from_fork_asm+0x1a/0x30
[   28.600315]  </TASK>
[   28.600674] 
[   28.601061] Allocated by task 267:
[   28.601347]  kasan_save_stack+0x3d/0x60
[   28.601868]  kasan_save_track+0x18/0x40
[   28.602828]  kasan_save_alloc_info+0x3b/0x50
[   28.603433]  __kasan_kmalloc+0xb7/0xc0
[   28.604223]  __kmalloc_cache_noprof+0x184/0x410
[   28.605195]  kasan_strings+0xb3/0xb60
[   28.605628]  kunit_try_run_case+0x1b3/0x490
[   28.606481]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.607520]  kthread+0x257/0x310
[   28.607900]  ret_from_fork+0x41/0x80
[   28.608674]  ret_from_fork_asm+0x1a/0x30
[   28.609167] 
[   28.609433] Freed by task 267:
[   28.610259]  kasan_save_stack+0x3d/0x60
[   28.610790]  kasan_save_track+0x18/0x40
[   28.611464]  kasan_save_free_info+0x3f/0x60
[   28.612446]  __kasan_slab_free+0x56/0x70
[   28.613399]  kfree+0x123/0x3f0
[   28.613873]  kasan_strings+0x13a/0xb60
[   28.614212]  kunit_try_run_case+0x1b3/0x490
[   28.615262]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.616325]  kthread+0x257/0x310
[   28.616691]  ret_from_fork+0x41/0x80
[   28.617258]  ret_from_fork_asm+0x1a/0x30
[   28.617557] 
[   28.617923] The buggy address belongs to the object at ffff888101ab9940
[   28.617923]  which belongs to the cache kmalloc-32 of size 32
[   28.619366] The buggy address is located 16 bytes inside of
[   28.619366]  freed 32-byte region [ffff888101ab9940, ffff888101ab9960)
[   28.621298] 
[   28.621491] The buggy address belongs to the physical page:
[   28.622079] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ab9
[   28.623047] flags: 0x200000000000000(node=0|zone=2)
[   28.623692] page_type: f5(slab)
[   28.624184] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.624905] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   28.625694] page dumped because: kasan: bad access detected
[   28.626459] 
[   28.626659] Memory state around the buggy address:
[   28.627152]  ffff888101ab9800: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.627567]  ffff888101ab9880: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   28.629015] >ffff888101ab9900: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   28.629604]                                                  ^
[   28.629962]  ffff888101ab9980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.631265]  ffff888101ab9a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.631924] ==================================================================