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

Environment
qemu-arm64
qemu-x86_64

[   51.006365] ==================================================================
[   51.007709] BUG: KASAN: slab-use-after-free in strcmp+0xc0/0xc8
[   51.008496] Read of size 1 at addr fff00000c616c150 by task kunit_try_catch/248
[   51.009534] 
[   51.010384] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   51.011634] Tainted: [B]=BAD_PAGE, [N]=TEST
[   51.012782] Hardware name: linux,dummy-virt (DT)
[   51.013639] Call trace:
[   51.014221]  show_stack+0x20/0x38 (C)
[   51.014868]  dump_stack_lvl+0x8c/0xd0
[   51.015432]  print_report+0x118/0x5e0
[   51.015974]  kasan_report+0xc8/0x118
[   51.016620]  __asan_report_load1_noabort+0x20/0x30
[   51.017754]  strcmp+0xc0/0xc8
[   51.018426]  kasan_strings+0x248/0x8f8
[   51.019020]  kunit_try_run_case+0x14c/0x3d0
[   51.019736]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   51.020538]  kthread+0x24c/0x2d0
[   51.021231]  ret_from_fork+0x10/0x20
[   51.021646] 
[   51.021815] Allocated by task 248:
[   51.022067]  kasan_save_stack+0x3c/0x68
[   51.022379]  kasan_save_track+0x20/0x40
[   51.022675]  kasan_save_alloc_info+0x40/0x58
[   51.022974]  __kasan_kmalloc+0xd4/0xd8
[   51.023249]  __kmalloc_cache_noprof+0x15c/0x3c0
[   51.025143]  kasan_strings+0xb4/0x8f8
[   51.025895]  kunit_try_run_case+0x14c/0x3d0
[   51.026774]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   51.027331]  kthread+0x24c/0x2d0
[   51.028225]  ret_from_fork+0x10/0x20
[   51.029040] 
[   51.029312] Freed by task 248:
[   51.029860]  kasan_save_stack+0x3c/0x68
[   51.030716]  kasan_save_track+0x20/0x40
[   51.031386]  kasan_save_free_info+0x4c/0x78
[   51.031973]  __kasan_slab_free+0x6c/0x98
[   51.032522]  kfree+0x114/0x3c8
[   51.033916]  kasan_strings+0x128/0x8f8
[   51.034490]  kunit_try_run_case+0x14c/0x3d0
[   51.035072]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   51.035806]  kthread+0x24c/0x2d0
[   51.036420]  ret_from_fork+0x10/0x20
[   51.037157] 
[   51.037521] The buggy address belongs to the object at fff00000c616c140
[   51.037521]  which belongs to the cache kmalloc-32 of size 32
[   51.039440] The buggy address is located 16 bytes inside of
[   51.039440]  freed 32-byte region [fff00000c616c140, fff00000c616c160)
[   51.040893] 
[   51.041386] The buggy address belongs to the physical page:
[   51.042772] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10616c
[   51.043860] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   51.044830] page_type: f5(slab)
[   51.045352] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   51.046624] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   51.047504] page dumped because: kasan: bad access detected
[   51.048214] 
[   51.048619] Memory state around the buggy address:
[   51.049409]  fff00000c616c000: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   51.050989]  fff00000c616c080: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   51.052055] >fff00000c616c100: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   51.053028]                                                  ^
[   51.053751]  fff00000c616c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   51.054590]  fff00000c616c200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   51.055351] ==================================================================

[   28.407556] ==================================================================
[   28.408651] BUG: KASAN: slab-use-after-free in strcmp+0xb0/0xc0
[   28.409417] Read of size 1 at addr ffff888101ab9950 by task kunit_try_catch/267
[   28.410387] 
[   28.410638] CPU: 1 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   28.411551] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.411866] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.412930] Call Trace:
[   28.413166]  <TASK>
[   28.413405]  dump_stack_lvl+0x73/0xb0
[   28.414026]  print_report+0xd1/0x640
[   28.414782]  ? __virt_addr_valid+0x1db/0x2d0
[   28.415484]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.416156]  kasan_report+0x102/0x140
[   28.416570]  ? strcmp+0xb0/0xc0
[   28.416842]  ? strcmp+0xb0/0xc0
[   28.417320]  __asan_report_load1_noabort+0x18/0x20
[   28.418268]  strcmp+0xb0/0xc0
[   28.418700]  kasan_strings+0x2e9/0xb60
[   28.419027]  ? __pfx_kasan_strings+0x10/0x10
[   28.419962]  ? __schedule+0xc3e/0x2790
[   28.420424]  ? __pfx_read_tsc+0x10/0x10
[   28.420917]  ? ktime_get_ts64+0x84/0x230
[   28.421496]  kunit_try_run_case+0x1b3/0x490
[   28.421820]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.423015]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.423639]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.424389]  ? __kthread_parkme+0x82/0x160
[   28.424863]  ? preempt_count_sub+0x50/0x80
[   28.425423]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.425855]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.426694]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.427328]  kthread+0x257/0x310
[   28.428602]  ? __pfx_kthread+0x10/0x10
[   28.429163]  ret_from_fork+0x41/0x80
[   28.429682]  ? __pfx_kthread+0x10/0x10
[   28.430211]  ret_from_fork_asm+0x1a/0x30
[   28.430647]  </TASK>
[   28.431176] 
[   28.431362] Allocated by task 267:
[   28.431744]  kasan_save_stack+0x3d/0x60
[   28.432603]  kasan_save_track+0x18/0x40
[   28.433194]  kasan_save_alloc_info+0x3b/0x50
[   28.433573]  __kasan_kmalloc+0xb7/0xc0
[   28.434142]  __kmalloc_cache_noprof+0x184/0x410
[   28.434609]  kasan_strings+0xb3/0xb60
[   28.435281]  kunit_try_run_case+0x1b3/0x490
[   28.435754]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.436501]  kthread+0x257/0x310
[   28.437302]  ret_from_fork+0x41/0x80
[   28.437602]  ret_from_fork_asm+0x1a/0x30
[   28.438215] 
[   28.438452] Freed by task 267:
[   28.438779]  kasan_save_stack+0x3d/0x60
[   28.439620]  kasan_save_track+0x18/0x40
[   28.440188]  kasan_save_free_info+0x3f/0x60
[   28.440573]  __kasan_slab_free+0x56/0x70
[   28.441287]  kfree+0x123/0x3f0
[   28.441609]  kasan_strings+0x13a/0xb60
[   28.442171]  kunit_try_run_case+0x1b3/0x490
[   28.442754]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.443518]  kthread+0x257/0x310
[   28.444074]  ret_from_fork+0x41/0x80
[   28.444904]  ret_from_fork_asm+0x1a/0x30
[   28.445423] 
[   28.445739] The buggy address belongs to the object at ffff888101ab9940
[   28.445739]  which belongs to the cache kmalloc-32 of size 32
[   28.447026] The buggy address is located 16 bytes inside of
[   28.447026]  freed 32-byte region [ffff888101ab9940, ffff888101ab9960)
[   28.447896] 
[   28.448287] The buggy address belongs to the physical page:
[   28.448853] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ab9
[   28.449954] flags: 0x200000000000000(node=0|zone=2)
[   28.450863] page_type: f5(slab)
[   28.451438] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.452304] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   28.452792] page dumped because: kasan: bad access detected
[   28.453561] 
[   28.453728] Memory state around the buggy address:
[   28.454524]  ffff888101ab9800: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.455248]  ffff888101ab9880: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   28.455861] >ffff888101ab9900: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   28.457108]                                                  ^
[   28.457406]  ffff888101ab9980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.457682]  ffff888101ab9a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.457949] ==================================================================