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

Environment
qemu-arm64
qemu-x86_64

[   50.953219] ==================================================================
[   50.955085] BUG: KASAN: slab-use-after-free in strrchr+0x6c/0x78
[   50.955836] Read of size 1 at addr fff00000c616c150 by task kunit_try_catch/248
[   50.956706] 
[   50.957051] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   50.958262] Tainted: [B]=BAD_PAGE, [N]=TEST
[   50.959540] Hardware name: linux,dummy-virt (DT)
[   50.960187] Call trace:
[   50.960589]  show_stack+0x20/0x38 (C)
[   50.961681]  dump_stack_lvl+0x8c/0xd0
[   50.962250]  print_report+0x118/0x5e0
[   50.962822]  kasan_report+0xc8/0x118
[   50.963650]  __asan_report_load1_noabort+0x20/0x30
[   50.964330]  strrchr+0x6c/0x78
[   50.964801]  kasan_strings+0x1e0/0x8f8
[   50.965603]  kunit_try_run_case+0x14c/0x3d0
[   50.966361]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   50.967110]  kthread+0x24c/0x2d0
[   50.967877]  ret_from_fork+0x10/0x20
[   50.968526] 
[   50.968917] Allocated by task 248:
[   50.969507]  kasan_save_stack+0x3c/0x68
[   50.970148]  kasan_save_track+0x20/0x40
[   50.970892]  kasan_save_alloc_info+0x40/0x58
[   50.972091]  __kasan_kmalloc+0xd4/0xd8
[   50.972660]  __kmalloc_cache_noprof+0x15c/0x3c0
[   50.973251]  kasan_strings+0xb4/0x8f8
[   50.973760]  kunit_try_run_case+0x14c/0x3d0
[   50.974860]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   50.975532]  kthread+0x24c/0x2d0
[   50.976096]  ret_from_fork+0x10/0x20
[   50.976638] 
[   50.976996] Freed by task 248:
[   50.977592]  kasan_save_stack+0x3c/0x68
[   50.978131]  kasan_save_track+0x20/0x40
[   50.978845]  kasan_save_free_info+0x4c/0x78
[   50.979862]  __kasan_slab_free+0x6c/0x98
[   50.980489]  kfree+0x114/0x3c8
[   50.981190]  kasan_strings+0x128/0x8f8
[   50.982213]  kunit_try_run_case+0x14c/0x3d0
[   50.983022]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   50.983748]  kthread+0x24c/0x2d0
[   50.984584]  ret_from_fork+0x10/0x20
[   50.985151] 
[   50.985776] The buggy address belongs to the object at fff00000c616c140
[   50.985776]  which belongs to the cache kmalloc-32 of size 32
[   50.987683] The buggy address is located 16 bytes inside of
[   50.987683]  freed 32-byte region [fff00000c616c140, fff00000c616c160)
[   50.988988] 
[   50.989669] The buggy address belongs to the physical page:
[   50.990321] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10616c
[   50.991596] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   50.992544] page_type: f5(slab)
[   50.993338] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   50.994866] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   50.995940] page dumped because: kasan: bad access detected
[   50.996856] 
[   50.997222] Memory state around the buggy address:
[   50.998359]  fff00000c616c000: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   50.999619]  fff00000c616c080: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   51.000757] >fff00000c616c100: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   51.001798]                                                  ^
[   51.002904]  fff00000c616c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   51.003734]  fff00000c616c200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   51.004517] ==================================================================

[   28.353433] ==================================================================
[   28.354509] BUG: KASAN: slab-use-after-free in strrchr+0x64/0x70
[   28.355597] Read of size 1 at addr ffff888101ab9950 by task kunit_try_catch/267
[   28.356377] 
[   28.356803] CPU: 1 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   28.357902] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.358507] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.359250] Call Trace:
[   28.359612]  <TASK>
[   28.359830]  dump_stack_lvl+0x73/0xb0
[   28.360469]  print_report+0xd1/0x640
[   28.360755]  ? __virt_addr_valid+0x1db/0x2d0
[   28.361137]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.363013]  kasan_report+0x102/0x140
[   28.363819]  ? strrchr+0x64/0x70
[   28.364469]  ? strrchr+0x64/0x70
[   28.364885]  __asan_report_load1_noabort+0x18/0x20
[   28.365601]  strrchr+0x64/0x70
[   28.366086]  kasan_strings+0x24c/0xb60
[   28.366450]  ? __pfx_kasan_strings+0x10/0x10
[   28.366958]  ? __schedule+0xc3e/0x2790
[   28.367494]  ? __pfx_read_tsc+0x10/0x10
[   28.368323]  ? ktime_get_ts64+0x84/0x230
[   28.368876]  kunit_try_run_case+0x1b3/0x490
[   28.369354]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.370286]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.371060]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.371556]  ? __kthread_parkme+0x82/0x160
[   28.372183]  ? preempt_count_sub+0x50/0x80
[   28.372727]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.373397]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.374074]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.374768]  kthread+0x257/0x310
[   28.375178]  ? __pfx_kthread+0x10/0x10
[   28.375904]  ret_from_fork+0x41/0x80
[   28.376465]  ? __pfx_kthread+0x10/0x10
[   28.376896]  ret_from_fork_asm+0x1a/0x30
[   28.377678]  </TASK>
[   28.378031] 
[   28.378317] Allocated by task 267:
[   28.378818]  kasan_save_stack+0x3d/0x60
[   28.379211]  kasan_save_track+0x18/0x40
[   28.379832]  kasan_save_alloc_info+0x3b/0x50
[   28.380509]  __kasan_kmalloc+0xb7/0xc0
[   28.380800]  __kmalloc_cache_noprof+0x184/0x410
[   28.381580]  kasan_strings+0xb3/0xb60
[   28.382167]  kunit_try_run_case+0x1b3/0x490
[   28.383141]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.383699]  kthread+0x257/0x310
[   28.384144]  ret_from_fork+0x41/0x80
[   28.384562]  ret_from_fork_asm+0x1a/0x30
[   28.385440] 
[   28.385653] Freed by task 267:
[   28.386175]  kasan_save_stack+0x3d/0x60
[   28.386765]  kasan_save_track+0x18/0x40
[   28.387311]  kasan_save_free_info+0x3f/0x60
[   28.388224]  __kasan_slab_free+0x56/0x70
[   28.388559]  kfree+0x123/0x3f0
[   28.389113]  kasan_strings+0x13a/0xb60
[   28.389490]  kunit_try_run_case+0x1b3/0x490
[   28.389918]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.390810]  kthread+0x257/0x310
[   28.391246]  ret_from_fork+0x41/0x80
[   28.391778]  ret_from_fork_asm+0x1a/0x30
[   28.392360] 
[   28.392754] The buggy address belongs to the object at ffff888101ab9940
[   28.392754]  which belongs to the cache kmalloc-32 of size 32
[   28.393763] The buggy address is located 16 bytes inside of
[   28.393763]  freed 32-byte region [ffff888101ab9940, ffff888101ab9960)
[   28.395074] 
[   28.395580] The buggy address belongs to the physical page:
[   28.396111] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ab9
[   28.397054] flags: 0x200000000000000(node=0|zone=2)
[   28.397653] page_type: f5(slab)
[   28.398199] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.398971] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   28.399798] page dumped because: kasan: bad access detected
[   28.400497] 
[   28.400738] Memory state around the buggy address:
[   28.401528]  ffff888101ab9800: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.402115]  ffff888101ab9880: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   28.403365] >ffff888101ab9900: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   28.404162]                                                  ^
[   28.404812]  ffff888101ab9980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.405711]  ffff888101ab9a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.406478] ==================================================================