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

Environment
qemu-arm64
qemu-x86_64

[   50.900709] ==================================================================
[   50.902844] BUG: KASAN: slab-use-after-free in strchr+0xcc/0xd8
[   50.903649] Read of size 1 at addr fff00000c616c150 by task kunit_try_catch/248
[   50.904463] 
[   50.904924] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   50.906820] Tainted: [B]=BAD_PAGE, [N]=TEST
[   50.907593] Hardware name: linux,dummy-virt (DT)
[   50.908392] Call trace:
[   50.908938]  show_stack+0x20/0x38 (C)
[   50.909515]  dump_stack_lvl+0x8c/0xd0
[   50.910852]  print_report+0x118/0x5e0
[   50.911982]  kasan_report+0xc8/0x118
[   50.912755]  __asan_report_load1_noabort+0x20/0x30
[   50.913552]  strchr+0xcc/0xd8
[   50.914524]  kasan_strings+0x180/0x8f8
[   50.915059]  kunit_try_run_case+0x14c/0x3d0
[   50.915723]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   50.916502]  kthread+0x24c/0x2d0
[   50.917312]  ret_from_fork+0x10/0x20
[   50.918207] 
[   50.918522] Allocated by task 248:
[   50.919063]  kasan_save_stack+0x3c/0x68
[   50.919694]  kasan_save_track+0x20/0x40
[   50.920517]  kasan_save_alloc_info+0x40/0x58
[   50.921245]  __kasan_kmalloc+0xd4/0xd8
[   50.921980]  __kmalloc_cache_noprof+0x15c/0x3c0
[   50.922638]  kasan_strings+0xb4/0x8f8
[   50.923284]  kunit_try_run_case+0x14c/0x3d0
[   50.923865]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   50.924666]  kthread+0x24c/0x2d0
[   50.925361]  ret_from_fork+0x10/0x20
[   50.925791] 
[   50.926149] Freed by task 248:
[   50.926760]  kasan_save_stack+0x3c/0x68
[   50.928016]  kasan_save_track+0x20/0x40
[   50.928614]  kasan_save_free_info+0x4c/0x78
[   50.929184]  __kasan_slab_free+0x6c/0x98
[   50.929826]  kfree+0x114/0x3c8
[   50.930711]  kasan_strings+0x128/0x8f8
[   50.931258]  kunit_try_run_case+0x14c/0x3d0
[   50.931877]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   50.932506]  kthread+0x24c/0x2d0
[   50.933559]  ret_from_fork+0x10/0x20
[   50.934004] 
[   50.934377] The buggy address belongs to the object at fff00000c616c140
[   50.934377]  which belongs to the cache kmalloc-32 of size 32
[   50.935859] The buggy address is located 16 bytes inside of
[   50.935859]  freed 32-byte region [fff00000c616c140, fff00000c616c160)
[   50.938036] 
[   50.938282] The buggy address belongs to the physical page:
[   50.939030] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10616c
[   50.939915] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   50.940827] page_type: f5(slab)
[   50.942065] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   50.943014] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   50.943932] page dumped because: kasan: bad access detected
[   50.944617] 
[   50.944904] Memory state around the buggy address:
[   50.945570]  fff00000c616c000: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   50.946384]  fff00000c616c080: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   50.947261] >fff00000c616c100: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   50.948533]                                                  ^
[   50.949617]  fff00000c616c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   50.950502]  fff00000c616c200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   50.951835] ==================================================================

[   28.293898] ==================================================================
[   28.295111] BUG: KASAN: slab-use-after-free in strchr+0x9c/0xc0
[   28.296123] Read of size 1 at addr ffff888101ab9950 by task kunit_try_catch/267
[   28.296727] 
[   28.297708] CPU: 1 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   28.298692] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.299457] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.300553] Call Trace:
[   28.301312]  <TASK>
[   28.301625]  dump_stack_lvl+0x73/0xb0
[   28.302535]  print_report+0xd1/0x640
[   28.303191]  ? __virt_addr_valid+0x1db/0x2d0
[   28.304261]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.305001]  kasan_report+0x102/0x140
[   28.305623]  ? strchr+0x9c/0xc0
[   28.306417]  ? strchr+0x9c/0xc0
[   28.306938]  __asan_report_load1_noabort+0x18/0x20
[   28.307720]  strchr+0x9c/0xc0
[   28.308114]  kasan_strings+0x1b1/0xb60
[   28.308515]  ? __pfx_kasan_strings+0x10/0x10
[   28.308958]  ? __schedule+0xc3e/0x2790
[   28.309589]  ? __pfx_read_tsc+0x10/0x10
[   28.309882]  ? ktime_get_ts64+0x84/0x230
[   28.310575]  kunit_try_run_case+0x1b3/0x490
[   28.311451]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.312207]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.312736]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.313612]  ? __kthread_parkme+0x82/0x160
[   28.314444]  ? preempt_count_sub+0x50/0x80
[   28.314968]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.315839]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.316594]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.317584]  kthread+0x257/0x310
[   28.317928]  ? __pfx_kthread+0x10/0x10
[   28.318804]  ret_from_fork+0x41/0x80
[   28.319419]  ? __pfx_kthread+0x10/0x10
[   28.320040]  ret_from_fork_asm+0x1a/0x30
[   28.320786]  </TASK>
[   28.321214] 
[   28.321388] Allocated by task 267:
[   28.321917]  kasan_save_stack+0x3d/0x60
[   28.322636]  kasan_save_track+0x18/0x40
[   28.323526]  kasan_save_alloc_info+0x3b/0x50
[   28.324105]  __kasan_kmalloc+0xb7/0xc0
[   28.324719]  __kmalloc_cache_noprof+0x184/0x410
[   28.325422]  kasan_strings+0xb3/0xb60
[   28.326246]  kunit_try_run_case+0x1b3/0x490
[   28.326910]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.327465]  kthread+0x257/0x310
[   28.327934]  ret_from_fork+0x41/0x80
[   28.328576]  ret_from_fork_asm+0x1a/0x30
[   28.329026] 
[   28.329612] Freed by task 267:
[   28.329960]  kasan_save_stack+0x3d/0x60
[   28.330604]  kasan_save_track+0x18/0x40
[   28.331265]  kasan_save_free_info+0x3f/0x60
[   28.331835]  __kasan_slab_free+0x56/0x70
[   28.332373]  kfree+0x123/0x3f0
[   28.333047]  kasan_strings+0x13a/0xb60
[   28.333509]  kunit_try_run_case+0x1b3/0x490
[   28.334068]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.334687]  kthread+0x257/0x310
[   28.335747]  ret_from_fork+0x41/0x80
[   28.336297]  ret_from_fork_asm+0x1a/0x30
[   28.336848] 
[   28.337151] The buggy address belongs to the object at ffff888101ab9940
[   28.337151]  which belongs to the cache kmalloc-32 of size 32
[   28.338680] The buggy address is located 16 bytes inside of
[   28.338680]  freed 32-byte region [ffff888101ab9940, ffff888101ab9960)
[   28.340116] 
[   28.340516] The buggy address belongs to the physical page:
[   28.340998] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ab9
[   28.341818] flags: 0x200000000000000(node=0|zone=2)
[   28.342776] page_type: f5(slab)
[   28.343259] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.344069] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   28.345265] page dumped because: kasan: bad access detected
[   28.345846] 
[   28.346100] Memory state around the buggy address:
[   28.346847]  ffff888101ab9800: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.348100]  ffff888101ab9880: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   28.348854] >ffff888101ab9900: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   28.349616]                                                  ^
[   28.350325]  ffff888101ab9980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.351346]  ffff888101ab9a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.352307] ==================================================================