Hay
Date
Nov. 22, 2024, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   37.240275] ==================================================================
[   37.241855] BUG: KASAN: slab-use-after-free in strrchr+0x6c/0x78
[   37.242894] Read of size 1 at addr fff00000c6a4c550 by task kunit_try_catch/248
[   37.244013] 
[   37.244885] CPU: 1 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   37.246091] Tainted: [B]=BAD_PAGE, [N]=TEST
[   37.247316] Hardware name: linux,dummy-virt (DT)
[   37.247909] Call trace:
[   37.248362]  show_stack+0x20/0x38 (C)
[   37.249043]  dump_stack_lvl+0x8c/0xd0
[   37.250747]  print_report+0x118/0x5e0
[   37.251293]  kasan_report+0xc8/0x118
[   37.251943]  __asan_report_load1_noabort+0x20/0x30
[   37.253502]  strrchr+0x6c/0x78
[   37.254260]  kasan_strings+0x1e0/0x8f8
[   37.255094]  kunit_try_run_case+0x14c/0x3d0
[   37.255761]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.256917]  kthread+0x24c/0x2d0
[   37.258303]  ret_from_fork+0x10/0x20
[   37.259208] 
[   37.259633] Allocated by task 248:
[   37.260213]  kasan_save_stack+0x3c/0x68
[   37.261139]  kasan_save_track+0x20/0x40
[   37.262408]  kasan_save_alloc_info+0x40/0x58
[   37.263133]  __kasan_kmalloc+0xd4/0xd8
[   37.263865]  __kmalloc_cache_noprof+0x15c/0x3c8
[   37.264772]  kasan_strings+0xb4/0x8f8
[   37.265614]  kunit_try_run_case+0x14c/0x3d0
[   37.266972]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.268621]  kthread+0x24c/0x2d0
[   37.269430]  ret_from_fork+0x10/0x20
[   37.270231] 
[   37.271065] Freed by task 248:
[   37.271526]  kasan_save_stack+0x3c/0x68
[   37.272235]  kasan_save_track+0x20/0x40
[   37.273975]  kasan_save_free_info+0x4c/0x78
[   37.274762]  __kasan_slab_free+0x6c/0x98
[   37.275480]  kfree+0x114/0x3d0
[   37.276109]  kasan_strings+0x128/0x8f8
[   37.277190]  kunit_try_run_case+0x14c/0x3d0
[   37.278023]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.278918]  kthread+0x24c/0x2d0
[   37.279481]  ret_from_fork+0x10/0x20
[   37.280090] 
[   37.280468] The buggy address belongs to the object at fff00000c6a4c540
[   37.280468]  which belongs to the cache kmalloc-32 of size 32
[   37.282393] The buggy address is located 16 bytes inside of
[   37.282393]  freed 32-byte region [fff00000c6a4c540, fff00000c6a4c560)
[   37.283747] 
[   37.284153] The buggy address belongs to the physical page:
[   37.285561] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106a4c
[   37.286640] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   37.287604] page_type: f5(slab)
[   37.288106] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   37.289461] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   37.290294] page dumped because: kasan: bad access detected
[   37.290842] 
[   37.291466] Memory state around the buggy address:
[   37.292591]  fff00000c6a4c400: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   37.293763]  fff00000c6a4c480: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   37.295174] >fff00000c6a4c500: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   37.296601]                                                  ^
[   37.298305]  fff00000c6a4c580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.299318]  fff00000c6a4c600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.300285] ==================================================================

[   28.154943] ==================================================================
[   28.155565] BUG: KASAN: slab-use-after-free in strrchr+0x64/0x70
[   28.156458] Read of size 1 at addr ffff888102a18a90 by task kunit_try_catch/267
[   28.157333] 
[   28.157644] CPU: 1 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   28.159009] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.159565] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.160217] Call Trace:
[   28.160540]  <TASK>
[   28.160955]  dump_stack_lvl+0x73/0xb0
[   28.161965]  print_report+0xd1/0x640
[   28.162586]  ? __virt_addr_valid+0x1db/0x2d0
[   28.163125]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.163793]  kasan_report+0x102/0x140
[   28.164464]  ? strrchr+0x64/0x70
[   28.164941]  ? strrchr+0x64/0x70
[   28.165242]  __asan_report_load1_noabort+0x18/0x20
[   28.166254]  strrchr+0x64/0x70
[   28.167141]  kasan_strings+0x24c/0xb60
[   28.167722]  ? __pfx_kasan_strings+0x10/0x10
[   28.168566]  ? __schedule+0xc3e/0x2790
[   28.169535]  ? __pfx_read_tsc+0x10/0x10
[   28.169888]  ? ktime_get_ts64+0x84/0x230
[   28.170377]  kunit_try_run_case+0x1b3/0x490
[   28.170770]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.171049]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.171765]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.172674]  ? __kthread_parkme+0x82/0x160
[   28.173067]  ? preempt_count_sub+0x50/0x80
[   28.174176]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.174653]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.175271]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.175853]  kthread+0x257/0x310
[   28.176406]  ? __pfx_kthread+0x10/0x10
[   28.176845]  ret_from_fork+0x41/0x80
[   28.177412]  ? __pfx_kthread+0x10/0x10
[   28.177867]  ret_from_fork_asm+0x1a/0x30
[   28.178487]  </TASK>
[   28.178736] 
[   28.179493] Allocated by task 267:
[   28.179844]  kasan_save_stack+0x3d/0x60
[   28.180393]  kasan_save_track+0x18/0x40
[   28.180671]  kasan_save_alloc_info+0x3b/0x50
[   28.181085]  __kasan_kmalloc+0xb7/0xc0
[   28.181531]  __kmalloc_cache_noprof+0x184/0x410
[   28.182243]  kasan_strings+0xb3/0xb60
[   28.182614]  kunit_try_run_case+0x1b3/0x490
[   28.183208]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.183626]  kthread+0x257/0x310
[   28.184210]  ret_from_fork+0x41/0x80
[   28.184611]  ret_from_fork_asm+0x1a/0x30
[   28.185014] 
[   28.185240] Freed by task 267:
[   28.185635]  kasan_save_stack+0x3d/0x60
[   28.186083]  kasan_save_track+0x18/0x40
[   28.186565]  kasan_save_free_info+0x3f/0x60
[   28.186940]  __kasan_slab_free+0x56/0x70
[   28.187206]  kfree+0x123/0x3f0
[   28.187756]  kasan_strings+0x13a/0xb60
[   28.188726]  kunit_try_run_case+0x1b3/0x490
[   28.189422]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.190034]  kthread+0x257/0x310
[   28.190527]  ret_from_fork+0x41/0x80
[   28.190852]  ret_from_fork_asm+0x1a/0x30
[   28.191348] 
[   28.192775] The buggy address belongs to the object at ffff888102a18a80
[   28.192775]  which belongs to the cache kmalloc-32 of size 32
[   28.194530] The buggy address is located 16 bytes inside of
[   28.194530]  freed 32-byte region [ffff888102a18a80, ffff888102a18aa0)
[   28.195773] 
[   28.196484] The buggy address belongs to the physical page:
[   28.196847] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a18
[   28.197653] flags: 0x200000000000000(node=0|zone=2)
[   28.198203] page_type: f5(slab)
[   28.198625] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.199341] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   28.199717] page dumped because: kasan: bad access detected
[   28.200344] 
[   28.200508] Memory state around the buggy address:
[   28.200781]  ffff888102a18980: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.201602]  ffff888102a18a00: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   28.202491] >ffff888102a18a80: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   28.203355]                          ^
[   28.204373]  ffff888102a18b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.205176]  ffff888102a18b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.205503] ==================================================================