Hay
Date
Nov. 28, 2024, 2:36 a.m.

Environment
qemu-arm64
qemu-x86_64

[   33.703072] ==================================================================
[   33.703800] BUG: KASAN: slab-use-after-free in strlen+0xa8/0xb0
[   33.704556] Read of size 1 at addr fff00000c4081c10 by task kunit_try_catch/247
[   33.705717] 
[   33.706060] CPU: 1 UID: 0 PID: 247 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   33.707072] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.707667] Hardware name: linux,dummy-virt (DT)
[   33.708294] Call trace:
[   33.708707]  show_stack+0x20/0x38 (C)
[   33.709588]  dump_stack_lvl+0x8c/0xd0
[   33.710223]  print_report+0x118/0x5e0
[   33.710818]  kasan_report+0xc8/0x118
[   33.711423]  __asan_report_load1_noabort+0x20/0x30
[   33.712088]  strlen+0xa8/0xb0
[   33.712653]  kasan_strings+0x320/0x8f8
[   33.713473]  kunit_try_run_case+0x14c/0x3d0
[   33.714029]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.714835]  kthread+0x24c/0x2d0
[   33.715385]  ret_from_fork+0x10/0x20
[   33.715890] 
[   33.716214] Allocated by task 247:
[   33.716686]  kasan_save_stack+0x3c/0x68
[   33.717845]  kasan_save_track+0x20/0x40
[   33.718506]  kasan_save_alloc_info+0x40/0x58
[   33.719212]  __kasan_kmalloc+0xd4/0xd8
[   33.719688]  __kmalloc_cache_noprof+0x15c/0x3c0
[   33.720302]  kasan_strings+0xb4/0x8f8
[   33.720778]  kunit_try_run_case+0x14c/0x3d0
[   33.721291]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.721976]  kthread+0x24c/0x2d0
[   33.723622]  ret_from_fork+0x10/0x20
[   33.724251] 
[   33.724638] Freed by task 247:
[   33.725543]  kasan_save_stack+0x3c/0x68
[   33.726206]  kasan_save_track+0x20/0x40
[   33.726844]  kasan_save_free_info+0x4c/0x78
[   33.727464]  __kasan_slab_free+0x6c/0x98
[   33.728108]  kfree+0x114/0x3c8
[   33.728682]  kasan_strings+0x128/0x8f8
[   33.729697]  kunit_try_run_case+0x14c/0x3d0
[   33.730247]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.731058]  kthread+0x24c/0x2d0
[   33.731581]  ret_from_fork+0x10/0x20
[   33.732289] 
[   33.732736] The buggy address belongs to the object at fff00000c4081c00
[   33.732736]  which belongs to the cache kmalloc-32 of size 32
[   33.734170] The buggy address is located 16 bytes inside of
[   33.734170]  freed 32-byte region [fff00000c4081c00, fff00000c4081c20)
[   33.735420] 
[   33.735845] The buggy address belongs to the physical page:
[   33.736585] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104081
[   33.737779] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.738491] page_type: f5(slab)
[   33.738918] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   33.739677] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   33.740640] page dumped because: kasan: bad access detected
[   33.741646] 
[   33.741998] Memory state around the buggy address:
[   33.743085]  fff00000c4081b00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   33.744236]  fff00000c4081b80: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   33.745334] >fff00000c4081c00: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   33.746141]                          ^
[   33.746685]  fff00000c4081c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.747482]  fff00000c4081d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.748391] ==================================================================

[   24.639508] ==================================================================
[   24.640113] BUG: KASAN: slab-use-after-free in strlen+0x8f/0xb0
[   24.641040] Read of size 1 at addr ffff888102a34190 by task kunit_try_catch/267
[   24.642149] 
[   24.642365] CPU: 0 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   24.643536] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.643998] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.644912] Call Trace:
[   24.645203]  <TASK>
[   24.645503]  dump_stack_lvl+0x73/0xb0
[   24.645917]  print_report+0xd1/0x640
[   24.646291]  ? __virt_addr_valid+0x1db/0x2d0
[   24.647374]  ? kasan_complete_mode_report_info+0x64/0x200
[   24.648272]  kasan_report+0x102/0x140
[   24.648886]  ? strlen+0x8f/0xb0
[   24.649247]  ? strlen+0x8f/0xb0
[   24.649605]  __asan_report_load1_noabort+0x18/0x20
[   24.649995]  strlen+0x8f/0xb0
[   24.650240]  kasan_strings+0x432/0xb60
[   24.650804]  ? __pfx_kasan_strings+0x10/0x10
[   24.651394]  ? __schedule+0xc3e/0x2790
[   24.651754]  ? __pfx_read_tsc+0x10/0x10
[   24.652057]  ? ktime_get_ts64+0x84/0x230
[   24.652495]  kunit_try_run_case+0x1b3/0x490
[   24.653056]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.653601]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.654005]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.654684]  ? __kthread_parkme+0x82/0x160
[   24.654968]  ? preempt_count_sub+0x50/0x80
[   24.655396]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.655781]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.656394]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.656836]  kthread+0x257/0x310
[   24.657324]  ? __pfx_kthread+0x10/0x10
[   24.657695]  ret_from_fork+0x41/0x80
[   24.658184]  ? __pfx_kthread+0x10/0x10
[   24.658623]  ret_from_fork_asm+0x1a/0x30
[   24.659015]  </TASK>
[   24.659318] 
[   24.659498] Allocated by task 267:
[   24.659925]  kasan_save_stack+0x3d/0x60
[   24.660314]  kasan_save_track+0x18/0x40
[   24.660804]  kasan_save_alloc_info+0x3b/0x50
[   24.661188]  __kasan_kmalloc+0xb7/0xc0
[   24.661657]  __kmalloc_cache_noprof+0x184/0x410
[   24.662168]  kasan_strings+0xb3/0xb60
[   24.662610]  kunit_try_run_case+0x1b3/0x490
[   24.663135]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.663486]  kthread+0x257/0x310
[   24.663905]  ret_from_fork+0x41/0x80
[   24.664389]  ret_from_fork_asm+0x1a/0x30
[   24.664672] 
[   24.664903] Freed by task 267:
[   24.665409]  kasan_save_stack+0x3d/0x60
[   24.665803]  kasan_save_track+0x18/0x40
[   24.666274]  kasan_save_free_info+0x3f/0x60
[   24.666588]  __kasan_slab_free+0x56/0x70
[   24.667058]  kfree+0x123/0x3f0
[   24.667506]  kasan_strings+0x13a/0xb60
[   24.667976]  kunit_try_run_case+0x1b3/0x490
[   24.668392]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.668956]  kthread+0x257/0x310
[   24.669373]  ret_from_fork+0x41/0x80
[   24.669669]  ret_from_fork_asm+0x1a/0x30
[   24.670059] 
[   24.670309] The buggy address belongs to the object at ffff888102a34180
[   24.670309]  which belongs to the cache kmalloc-32 of size 32
[   24.671353] The buggy address is located 16 bytes inside of
[   24.671353]  freed 32-byte region [ffff888102a34180, ffff888102a341a0)
[   24.672370] 
[   24.672550] The buggy address belongs to the physical page:
[   24.672967] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a34
[   24.673625] flags: 0x200000000000000(node=0|zone=2)
[   24.674236] page_type: f5(slab)
[   24.674645] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   24.675246] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   24.675926] page dumped because: kasan: bad access detected
[   24.676485] 
[   24.676700] Memory state around the buggy address:
[   24.677130]  ffff888102a34080: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   24.677568]  ffff888102a34100: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   24.677977] >ffff888102a34180: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   24.678822]                          ^
[   24.679395]  ffff888102a34200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.679973]  ffff888102a34280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.680785] ==================================================================