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

Environment
qemu-arm64
qemu-x86_64

[   37.178262] ==================================================================
[   37.179337] BUG: KASAN: slab-use-after-free in strchr+0xcc/0xd8
[   37.180427] Read of size 1 at addr fff00000c6a4c550 by task kunit_try_catch/248
[   37.182230] 
[   37.182578] CPU: 1 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   37.183959] Tainted: [B]=BAD_PAGE, [N]=TEST
[   37.184626] Hardware name: linux,dummy-virt (DT)
[   37.185626] Call trace:
[   37.186090]  show_stack+0x20/0x38 (C)
[   37.186743]  dump_stack_lvl+0x8c/0xd0
[   37.187918]  print_report+0x118/0x5e0
[   37.188802]  kasan_report+0xc8/0x118
[   37.189693]  __asan_report_load1_noabort+0x20/0x30
[   37.190736]  strchr+0xcc/0xd8
[   37.191744]  kasan_strings+0x180/0x8f8
[   37.192797]  kunit_try_run_case+0x14c/0x3d0
[   37.193631]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.194744]  kthread+0x24c/0x2d0
[   37.195341]  ret_from_fork+0x10/0x20
[   37.195915] 
[   37.196241] Allocated by task 248:
[   37.197717]  kasan_save_stack+0x3c/0x68
[   37.199021]  kasan_save_track+0x20/0x40
[   37.199683]  kasan_save_alloc_info+0x40/0x58
[   37.200314]  __kasan_kmalloc+0xd4/0xd8
[   37.201584]  __kmalloc_cache_noprof+0x15c/0x3c8
[   37.202503]  kasan_strings+0xb4/0x8f8
[   37.203205]  kunit_try_run_case+0x14c/0x3d0
[   37.203983]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.205397]  kthread+0x24c/0x2d0
[   37.206610]  ret_from_fork+0x10/0x20
[   37.207629] 
[   37.207924] Freed by task 248:
[   37.208588]  kasan_save_stack+0x3c/0x68
[   37.210186]  kasan_save_track+0x20/0x40
[   37.210803]  kasan_save_free_info+0x4c/0x78
[   37.211841]  __kasan_slab_free+0x6c/0x98
[   37.212334]  kfree+0x114/0x3d0
[   37.213293]  kasan_strings+0x128/0x8f8
[   37.213848]  kunit_try_run_case+0x14c/0x3d0
[   37.214562]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.216010]  kthread+0x24c/0x2d0
[   37.217026]  ret_from_fork+0x10/0x20
[   37.217666] 
[   37.218215] The buggy address belongs to the object at fff00000c6a4c540
[   37.218215]  which belongs to the cache kmalloc-32 of size 32
[   37.220006] The buggy address is located 16 bytes inside of
[   37.220006]  freed 32-byte region [fff00000c6a4c540, fff00000c6a4c560)
[   37.222309] 
[   37.222763] The buggy address belongs to the physical page:
[   37.223489] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106a4c
[   37.224408] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   37.225986] page_type: f5(slab)
[   37.226625] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   37.227565] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   37.228859] page dumped because: kasan: bad access detected
[   37.230024] 
[   37.230293] Memory state around the buggy address:
[   37.230918]  fff00000c6a4c400: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   37.233098]  fff00000c6a4c480: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   37.234110] >fff00000c6a4c500: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   37.235128]                                                  ^
[   37.235880]  fff00000c6a4c580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.237210]  fff00000c6a4c600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.237893] ==================================================================

[   28.101092] ==================================================================
[   28.102051] BUG: KASAN: slab-use-after-free in strchr+0x9c/0xc0
[   28.103006] Read of size 1 at addr ffff888102a18a90 by task kunit_try_catch/267
[   28.103721] 
[   28.104174] CPU: 1 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   28.105230] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.105542] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.106981] Call Trace:
[   28.107415]  <TASK>
[   28.107987]  dump_stack_lvl+0x73/0xb0
[   28.108560]  print_report+0xd1/0x640
[   28.109191]  ? __virt_addr_valid+0x1db/0x2d0
[   28.109669]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.110442]  kasan_report+0x102/0x140
[   28.110889]  ? strchr+0x9c/0xc0
[   28.111608]  ? strchr+0x9c/0xc0
[   28.111910]  __asan_report_load1_noabort+0x18/0x20
[   28.112513]  strchr+0x9c/0xc0
[   28.113713]  kasan_strings+0x1b1/0xb60
[   28.114106]  ? __pfx_kasan_strings+0x10/0x10
[   28.115097]  ? __schedule+0xc3e/0x2790
[   28.115551]  ? __pfx_read_tsc+0x10/0x10
[   28.116269]  ? ktime_get_ts64+0x84/0x230
[   28.117295]  kunit_try_run_case+0x1b3/0x490
[   28.117665]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.118237]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.118742]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.119103]  ? __kthread_parkme+0x82/0x160
[   28.119694]  ? preempt_count_sub+0x50/0x80
[   28.120165]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.120686]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.121768]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.122249]  kthread+0x257/0x310
[   28.122534]  ? __pfx_kthread+0x10/0x10
[   28.122968]  ret_from_fork+0x41/0x80
[   28.123332]  ? __pfx_kthread+0x10/0x10
[   28.124406]  ret_from_fork_asm+0x1a/0x30
[   28.125057]  </TASK>
[   28.125447] 
[   28.125841] Allocated by task 267:
[   28.126574]  kasan_save_stack+0x3d/0x60
[   28.126876]  kasan_save_track+0x18/0x40
[   28.127931]  kasan_save_alloc_info+0x3b/0x50
[   28.128771]  __kasan_kmalloc+0xb7/0xc0
[   28.129231]  __kmalloc_cache_noprof+0x184/0x410
[   28.129619]  kasan_strings+0xb3/0xb60
[   28.130378]  kunit_try_run_case+0x1b3/0x490
[   28.130666]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.131333]  kthread+0x257/0x310
[   28.132667]  ret_from_fork+0x41/0x80
[   28.133041]  ret_from_fork_asm+0x1a/0x30
[   28.133207] 
[   28.133336] Freed by task 267:
[   28.133668]  kasan_save_stack+0x3d/0x60
[   28.134201]  kasan_save_track+0x18/0x40
[   28.134809]  kasan_save_free_info+0x3f/0x60
[   28.135352]  __kasan_slab_free+0x56/0x70
[   28.136204]  kfree+0x123/0x3f0
[   28.136572]  kasan_strings+0x13a/0xb60
[   28.137082]  kunit_try_run_case+0x1b3/0x490
[   28.137853]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.138492]  kthread+0x257/0x310
[   28.139098]  ret_from_fork+0x41/0x80
[   28.139530]  ret_from_fork_asm+0x1a/0x30
[   28.140209] 
[   28.140462] The buggy address belongs to the object at ffff888102a18a80
[   28.140462]  which belongs to the cache kmalloc-32 of size 32
[   28.141397] The buggy address is located 16 bytes inside of
[   28.141397]  freed 32-byte region [ffff888102a18a80, ffff888102a18aa0)
[   28.142295] 
[   28.142510] The buggy address belongs to the physical page:
[   28.143638] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a18
[   28.144408] flags: 0x200000000000000(node=0|zone=2)
[   28.144773] page_type: f5(slab)
[   28.145345] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.146290] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   28.147009] page dumped because: kasan: bad access detected
[   28.147608] 
[   28.147845] Memory state around the buggy address:
[   28.149119]  ffff888102a18980: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.149712]  ffff888102a18a00: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   28.150496] >ffff888102a18a80: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   28.151319]                          ^
[   28.151593]  ffff888102a18b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.152492]  ffff888102a18b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.153510] ==================================================================