Hay
Date
Dec. 4, 2024, 3:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   35.363796] ==================================================================
[   35.365133] BUG: KASAN: slab-use-after-free in strnlen+0x80/0x88
[   35.365805] Read of size 1 at addr fff00000c6643a90 by task kunit_try_catch/247
[   35.367178] 
[   35.367652] CPU: 0 UID: 0 PID: 247 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   35.368962] Tainted: [B]=BAD_PAGE, [N]=TEST
[   35.369569] Hardware name: linux,dummy-virt (DT)
[   35.370346] Call trace:
[   35.370977]  show_stack+0x20/0x38 (C)
[   35.371644]  dump_stack_lvl+0x8c/0xd0
[   35.372286]  print_report+0x118/0x5e0
[   35.372964]  kasan_report+0xc8/0x118
[   35.373599]  __asan_report_load1_noabort+0x20/0x30
[   35.374375]  strnlen+0x80/0x88
[   35.375016]  kasan_strings+0x364/0x8d8
[   35.375675]  kunit_try_run_case+0x14c/0x3d0
[   35.376397]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   35.377282]  kthread+0x24c/0x2d0
[   35.377910]  ret_from_fork+0x10/0x20
[   35.378572] 
[   35.378960] Allocated by task 247:
[   35.379648]  kasan_save_stack+0x3c/0x68
[   35.380391]  kasan_save_track+0x20/0x40
[   35.381090]  kasan_save_alloc_info+0x40/0x58
[   35.381864]  __kasan_kmalloc+0xd4/0xd8
[   35.382503]  __kmalloc_cache_noprof+0x15c/0x3c0
[   35.383160]  kasan_strings+0xb0/0x8d8
[   35.383886]  kunit_try_run_case+0x14c/0x3d0
[   35.384688]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   35.385468]  kthread+0x24c/0x2d0
[   35.386052]  ret_from_fork+0x10/0x20
[   35.386998] 
[   35.387775] Freed by task 247:
[   35.388898]  kasan_save_stack+0x3c/0x68
[   35.389693]  kasan_save_track+0x20/0x40
[   35.390666]  kasan_save_free_info+0x4c/0x78
[   35.392130]  __kasan_slab_free+0x6c/0x98
[   35.392868]  kfree+0x114/0x3c8
[   35.393571]  kasan_strings+0x124/0x8d8
[   35.394279]  kunit_try_run_case+0x14c/0x3d0
[   35.395236]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   35.395955]  kthread+0x24c/0x2d0
[   35.396438]  ret_from_fork+0x10/0x20
[   35.397062] 
[   35.397432] The buggy address belongs to the object at fff00000c6643a80
[   35.397432]  which belongs to the cache kmalloc-32 of size 32
[   35.398872] The buggy address is located 16 bytes inside of
[   35.398872]  freed 32-byte region [fff00000c6643a80, fff00000c6643aa0)
[   35.400185] 
[   35.400521] The buggy address belongs to the physical page:
[   35.401356] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106643
[   35.402397] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   35.403411] page_type: f5(slab)
[   35.403934] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   35.404988] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   35.405889] page dumped because: kasan: bad access detected
[   35.406647] 
[   35.407045] Memory state around the buggy address:
[   35.407616]  fff00000c6643980: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   35.408613]  fff00000c6643a00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   35.409583] >fff00000c6643a80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   35.410408]                          ^
[   35.411063]  fff00000c6643b00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   35.411888]  fff00000c6643b80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   35.412735] ==================================================================

[   26.179475] ==================================================================
[   26.180422] BUG: KASAN: slab-use-after-free in strnlen+0x73/0x80
[   26.180982] Read of size 1 at addr ffff88810299ded0 by task kunit_try_catch/267
[   26.181558] 
[   26.181820] CPU: 1 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   26.182968] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.183652] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.184301] Call Trace:
[   26.184513]  <TASK>
[   26.184789]  dump_stack_lvl+0x73/0xb0
[   26.185406]  print_report+0xd1/0x640
[   26.186019]  ? __virt_addr_valid+0x1db/0x2d0
[   26.186784]  ? kasan_complete_mode_report_info+0x64/0x200
[   26.187524]  kasan_report+0x102/0x140
[   26.188297]  ? strnlen+0x73/0x80
[   26.188988]  ? strnlen+0x73/0x80
[   26.189584]  __asan_report_load1_noabort+0x18/0x20
[   26.190183]  strnlen+0x73/0x80
[   26.191133]  kasan_strings+0x4c3/0xb60
[   26.191545]  ? __pfx_kasan_strings+0x10/0x10
[   26.192888]  ? __pfx_kasan_strings+0x10/0x10
[   26.193350]  kunit_try_run_case+0x1b3/0x490
[   26.194234]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.195426]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   26.196045]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   26.196610]  ? __kthread_parkme+0x82/0x160
[   26.197064]  ? preempt_count_sub+0x50/0x80
[   26.197523]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.198006]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   26.199699]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.200184]  kthread+0x257/0x310
[   26.200543]  ? __pfx_kthread+0x10/0x10
[   26.201264]  ret_from_fork+0x41/0x80
[   26.202130]  ? __pfx_kthread+0x10/0x10
[   26.202960]  ret_from_fork_asm+0x1a/0x30
[   26.203347]  </TASK>
[   26.203742] 
[   26.204269] Allocated by task 267:
[   26.204534]  kasan_save_stack+0x3d/0x60
[   26.205591]  kasan_save_track+0x18/0x40
[   26.206413]  kasan_save_alloc_info+0x3b/0x50
[   26.207217]  __kasan_kmalloc+0xb7/0xc0
[   26.207676]  __kmalloc_cache_noprof+0x184/0x410
[   26.208225]  kasan_strings+0xb9/0xb60
[   26.208536]  kunit_try_run_case+0x1b3/0x490
[   26.209023]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.209850]  kthread+0x257/0x310
[   26.210118]  ret_from_fork+0x41/0x80
[   26.210482]  ret_from_fork_asm+0x1a/0x30
[   26.211033] 
[   26.211271] Freed by task 267:
[   26.211546]  kasan_save_stack+0x3d/0x60
[   26.211989]  kasan_save_track+0x18/0x40
[   26.212655]  kasan_save_free_info+0x3f/0x60
[   26.213064]  __kasan_slab_free+0x56/0x70
[   26.213381]  kfree+0x123/0x3f0
[   26.213747]  kasan_strings+0x13c/0xb60
[   26.214220]  kunit_try_run_case+0x1b3/0x490
[   26.215157]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.215574]  kthread+0x257/0x310
[   26.216012]  ret_from_fork+0x41/0x80
[   26.216651]  ret_from_fork_asm+0x1a/0x30
[   26.217066] 
[   26.217314] The buggy address belongs to the object at ffff88810299dec0
[   26.217314]  which belongs to the cache kmalloc-32 of size 32
[   26.218167] The buggy address is located 16 bytes inside of
[   26.218167]  freed 32-byte region [ffff88810299dec0, ffff88810299dee0)
[   26.219152] 
[   26.220466] The buggy address belongs to the physical page:
[   26.221793] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10299d
[   26.222603] flags: 0x200000000000000(node=0|zone=2)
[   26.223079] page_type: f5(slab)
[   26.223954] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   26.225139] raw: 0000000000000000 0000000000400040 00000000f5000000 0000000000000000
[   26.226484] page dumped because: kasan: bad access detected
[   26.227069] 
[   26.227229] Memory state around the buggy address:
[   26.227729]  ffff88810299dd80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   26.228789]  ffff88810299de00: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   26.229332] >ffff88810299de80: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   26.230582]                                                  ^
[   26.231097]  ffff88810299df00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   26.231991]  ffff88810299df80: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   26.233320] ==================================================================