Hay
Date
Dec. 3, 2024, 11:38 p.m.

Environment
qemu-arm64
qemu-x86_64

[   33.644802] ==================================================================
[   33.645582] BUG: KASAN: slab-use-after-free in strlen+0xa8/0xb0
[   33.646386] Read of size 1 at addr fff00000c5921b90 by task kunit_try_catch/248
[   33.647147] 
[   33.647751] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   33.649023] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.649642] Hardware name: linux,dummy-virt (DT)
[   33.650317] Call trace:
[   33.650959]  show_stack+0x20/0x38 (C)
[   33.651791]  dump_stack_lvl+0x8c/0xd0
[   33.652639]  print_report+0x118/0x5e0
[   33.653404]  kasan_report+0xc8/0x118
[   33.654185]  __asan_report_load1_noabort+0x20/0x30
[   33.654961]  strlen+0xa8/0xb0
[   33.655612]  kasan_strings+0x304/0x8d8
[   33.656319]  kunit_try_run_case+0x14c/0x3d0
[   33.657076]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.658021]  kthread+0x24c/0x2d0
[   33.658725]  ret_from_fork+0x10/0x20
[   33.659473] 
[   33.659900] Allocated by task 248:
[   33.660555]  kasan_save_stack+0x3c/0x68
[   33.661247]  kasan_save_track+0x20/0x40
[   33.661962]  kasan_save_alloc_info+0x40/0x58
[   33.662800]  __kasan_kmalloc+0xd4/0xd8
[   33.663590]  __kmalloc_cache_noprof+0x15c/0x3c0
[   33.664391]  kasan_strings+0xb0/0x8d8
[   33.665065]  kunit_try_run_case+0x14c/0x3d0
[   33.665841]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.666687]  kthread+0x24c/0x2d0
[   33.667344]  ret_from_fork+0x10/0x20
[   33.668054] 
[   33.668525] Freed by task 248:
[   33.669162]  kasan_save_stack+0x3c/0x68
[   33.669925]  kasan_save_track+0x20/0x40
[   33.670655]  kasan_save_free_info+0x4c/0x78
[   33.671230]  __kasan_slab_free+0x6c/0x98
[   33.671805]  kfree+0x114/0x3c8
[   33.672572]  kasan_strings+0x124/0x8d8
[   33.673189]  kunit_try_run_case+0x14c/0x3d0
[   33.673910]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.674780]  kthread+0x24c/0x2d0
[   33.675316]  ret_from_fork+0x10/0x20
[   33.675856] 
[   33.676221] The buggy address belongs to the object at fff00000c5921b80
[   33.676221]  which belongs to the cache kmalloc-32 of size 32
[   33.677683] The buggy address is located 16 bytes inside of
[   33.677683]  freed 32-byte region [fff00000c5921b80, fff00000c5921ba0)
[   33.679184] 
[   33.679657] The buggy address belongs to the physical page:
[   33.680475] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105921
[   33.681551] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.682468] page_type: f5(slab)
[   33.683044] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   33.684120] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   33.685068] page dumped because: kasan: bad access detected
[   33.685891] 
[   33.686230] Memory state around the buggy address:
[   33.686986]  fff00000c5921a80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.688090]  fff00000c5921b00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.688958] >fff00000c5921b80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.689941]                          ^
[   33.690550]  fff00000c5921c00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   33.691528]  fff00000c5921c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.692447] ==================================================================

[   28.923546] ==================================================================
[   28.923975] BUG: KASAN: slab-use-after-free in strlen+0x8f/0xb0
[   28.924593] Read of size 1 at addr ffff888102a07b90 by task kunit_try_catch/268
[   28.925508] 
[   28.925723] CPU: 1 UID: 0 PID: 268 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   28.926239] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.926476] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.927267] Call Trace:
[   28.927629]  <TASK>
[   28.927918]  dump_stack_lvl+0x73/0xb0
[   28.928338]  print_report+0xd1/0x640
[   28.928823]  ? __virt_addr_valid+0x1db/0x2d0
[   28.929330]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.929905]  kasan_report+0x102/0x140
[   28.930198]  ? strlen+0x8f/0xb0
[   28.930514]  ? strlen+0x8f/0xb0
[   28.930914]  __asan_report_load1_noabort+0x18/0x20
[   28.931437]  strlen+0x8f/0xb0
[   28.931813]  kasan_strings+0x425/0xb60
[   28.932251]  ? __pfx_kasan_strings+0x10/0x10
[   28.932630]  ? __schedule+0xc3e/0x2790
[   28.932995]  ? __pfx_read_tsc+0x10/0x10
[   28.933443]  ? ktime_get_ts64+0x86/0x230
[   28.933866]  kunit_try_run_case+0x1b3/0x490
[   28.934315]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.935123]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.935632]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.936091]  ? __kthread_parkme+0x82/0x160
[   28.936472]  ? preempt_count_sub+0x50/0x80
[   28.936882]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.937390]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.937957]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.938503]  kthread+0x257/0x310
[   28.938908]  ? __pfx_kthread+0x10/0x10
[   28.939239]  ret_from_fork+0x41/0x80
[   28.939737]  ? __pfx_kthread+0x10/0x10
[   28.940150]  ret_from_fork_asm+0x1a/0x30
[   28.940681]  </TASK>
[   28.940933] 
[   28.941102] Allocated by task 268:
[   28.941487]  kasan_save_stack+0x3d/0x60
[   28.941894]  kasan_save_track+0x18/0x40
[   28.942245]  kasan_save_alloc_info+0x3b/0x50
[   28.942765]  __kasan_kmalloc+0xb7/0xc0
[   28.943154]  __kmalloc_cache_noprof+0x184/0x410
[   28.943699]  kasan_strings+0xb9/0xb60
[   28.943957]  kunit_try_run_case+0x1b3/0x490
[   28.944417]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.944979]  kthread+0x257/0x310
[   28.945354]  ret_from_fork+0x41/0x80
[   28.945814]  ret_from_fork_asm+0x1a/0x30
[   28.946138] 
[   28.946382] Freed by task 268:
[   28.946814]  kasan_save_stack+0x3d/0x60
[   28.947234]  kasan_save_track+0x18/0x40
[   28.947614]  kasan_save_free_info+0x3f/0x60
[   28.947989]  __kasan_slab_free+0x56/0x70
[   28.948385]  kfree+0x123/0x3f0
[   28.948749]  kasan_strings+0x13c/0xb60
[   28.948999]  kunit_try_run_case+0x1b3/0x490
[   28.949275]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.949576]  kthread+0x257/0x310
[   28.949807]  ret_from_fork+0x41/0x80
[   28.950101]  ret_from_fork_asm+0x1a/0x30
[   28.950514] 
[   28.950730] The buggy address belongs to the object at ffff888102a07b80
[   28.950730]  which belongs to the cache kmalloc-32 of size 32
[   28.951856] The buggy address is located 16 bytes inside of
[   28.951856]  freed 32-byte region [ffff888102a07b80, ffff888102a07ba0)
[   28.953107] 
[   28.953330] The buggy address belongs to the physical page:
[   28.954322] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a07
[   28.954932] flags: 0x200000000000000(node=0|zone=2)
[   28.955251] page_type: f5(slab)
[   28.955531] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.958344] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   28.959830] page dumped because: kasan: bad access detected
[   28.960335] 
[   28.961624] Memory state around the buggy address:
[   28.962095]  ffff888102a07a80: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.963977]  ffff888102a07b00: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   28.965011] >ffff888102a07b80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   28.965926]                          ^
[   28.966107]  ffff888102a07c00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.967262]  ffff888102a07c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   28.967863] ==================================================================