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

Environment
qemu-arm64
qemu-x86_64

[   33.515448] ==================================================================
[   33.516470] BUG: KASAN: slab-use-after-free in strchr+0xcc/0xd8
[   33.517497] Read of size 1 at addr fff00000c4081c10 by task kunit_try_catch/247
[   33.518860] 
[   33.519204] CPU: 1 UID: 0 PID: 247 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   33.520662] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.521318] Hardware name: linux,dummy-virt (DT)
[   33.521598] Call trace:
[   33.521783]  show_stack+0x20/0x38 (C)
[   33.522052]  dump_stack_lvl+0x8c/0xd0
[   33.522341]  print_report+0x118/0x5e0
[   33.522602]  kasan_report+0xc8/0x118
[   33.522857]  __asan_report_load1_noabort+0x20/0x30
[   33.523234]  strchr+0xcc/0xd8
[   33.524919]  kasan_strings+0x180/0x8f8
[   33.526164]  kunit_try_run_case+0x14c/0x3d0
[   33.526825]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.527603]  kthread+0x24c/0x2d0
[   33.527876]  ret_from_fork+0x10/0x20
[   33.528180] 
[   33.528608] Allocated by task 247:
[   33.529450]  kasan_save_stack+0x3c/0x68
[   33.530418]  kasan_save_track+0x20/0x40
[   33.531138]  kasan_save_alloc_info+0x40/0x58
[   33.531868]  __kasan_kmalloc+0xd4/0xd8
[   33.532578]  __kmalloc_cache_noprof+0x15c/0x3c0
[   33.533483]  kasan_strings+0xb4/0x8f8
[   33.534057]  kunit_try_run_case+0x14c/0x3d0
[   33.534601]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.535565]  kthread+0x24c/0x2d0
[   33.536183]  ret_from_fork+0x10/0x20
[   33.536727] 
[   33.537090] Freed by task 247:
[   33.537588]  kasan_save_stack+0x3c/0x68
[   33.538759]  kasan_save_track+0x20/0x40
[   33.539263]  kasan_save_free_info+0x4c/0x78
[   33.539784]  __kasan_slab_free+0x6c/0x98
[   33.540926]  kfree+0x114/0x3c8
[   33.541621]  kasan_strings+0x128/0x8f8
[   33.542316]  kunit_try_run_case+0x14c/0x3d0
[   33.542943]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.543659]  kthread+0x24c/0x2d0
[   33.544191]  ret_from_fork+0x10/0x20
[   33.544783] 
[   33.545260] The buggy address belongs to the object at fff00000c4081c00
[   33.545260]  which belongs to the cache kmalloc-32 of size 32
[   33.546373] The buggy address is located 16 bytes inside of
[   33.546373]  freed 32-byte region [fff00000c4081c00, fff00000c4081c20)
[   33.547490] 
[   33.547879] The buggy address belongs to the physical page:
[   33.548620] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104081
[   33.549717] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.550626] page_type: f5(slab)
[   33.551163] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   33.552068] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   33.552928] page dumped because: kasan: bad access detected
[   33.553746] 
[   33.554049] Memory state around the buggy address:
[   33.554682]  fff00000c4081b00: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   33.555540]  fff00000c4081b80: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   33.556419] >fff00000c4081c00: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   33.557258]                          ^
[   33.558751]  fff00000c4081c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.559669]  fff00000c4081d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.560613] ==================================================================

[   24.459677] ==================================================================
[   24.461066] BUG: KASAN: slab-use-after-free in strchr+0x9c/0xc0
[   24.461969] Read of size 1 at addr ffff888102a34190 by task kunit_try_catch/267
[   24.463084] 
[   24.463474] CPU: 0 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   24.464598] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.465325] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.466207] Call Trace:
[   24.466473]  <TASK>
[   24.467216]  dump_stack_lvl+0x73/0xb0
[   24.467735]  print_report+0xd1/0x640
[   24.468189]  ? __virt_addr_valid+0x1db/0x2d0
[   24.468717]  ? kasan_complete_mode_report_info+0x64/0x200
[   24.469766]  kasan_report+0x102/0x140
[   24.470190]  ? strchr+0x9c/0xc0
[   24.470714]  ? strchr+0x9c/0xc0
[   24.471180]  __asan_report_load1_noabort+0x18/0x20
[   24.471700]  strchr+0x9c/0xc0
[   24.472032]  kasan_strings+0x1b1/0xb60
[   24.473064]  ? __pfx_kasan_strings+0x10/0x10
[   24.473764]  ? __schedule+0xc3e/0x2790
[   24.474242]  ? __pfx_read_tsc+0x10/0x10
[   24.474622]  ? ktime_get_ts64+0x84/0x230
[   24.475102]  kunit_try_run_case+0x1b3/0x490
[   24.475640]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.476368]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.477058]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.477839]  ? __kthread_parkme+0x82/0x160
[   24.478222]  ? preempt_count_sub+0x50/0x80
[   24.478840]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.479309]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.479926]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.480418]  kthread+0x257/0x310
[   24.480783]  ? __pfx_kthread+0x10/0x10
[   24.481242]  ret_from_fork+0x41/0x80
[   24.481633]  ? __pfx_kthread+0x10/0x10
[   24.482107]  ret_from_fork_asm+0x1a/0x30
[   24.482640]  </TASK>
[   24.482896] 
[   24.483049] Allocated by task 267:
[   24.483524]  kasan_save_stack+0x3d/0x60
[   24.483871]  kasan_save_track+0x18/0x40
[   24.484411]  kasan_save_alloc_info+0x3b/0x50
[   24.484838]  __kasan_kmalloc+0xb7/0xc0
[   24.485275]  __kmalloc_cache_noprof+0x184/0x410
[   24.485771]  kasan_strings+0xb3/0xb60
[   24.486629]  kunit_try_run_case+0x1b3/0x490
[   24.486959]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.487570]  kthread+0x257/0x310
[   24.487975]  ret_from_fork+0x41/0x80
[   24.488469]  ret_from_fork_asm+0x1a/0x30
[   24.488769] 
[   24.488920] Freed by task 267:
[   24.489372]  kasan_save_stack+0x3d/0x60
[   24.489859]  kasan_save_track+0x18/0x40
[   24.490387]  kasan_save_free_info+0x3f/0x60
[   24.490697]  __kasan_slab_free+0x56/0x70
[   24.491034]  kfree+0x123/0x3f0
[   24.491475]  kasan_strings+0x13a/0xb60
[   24.491894]  kunit_try_run_case+0x1b3/0x490
[   24.492266]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.492872]  kthread+0x257/0x310
[   24.493376]  ret_from_fork+0x41/0x80
[   24.493682]  ret_from_fork_asm+0x1a/0x30
[   24.494135] 
[   24.494388] The buggy address belongs to the object at ffff888102a34180
[   24.494388]  which belongs to the cache kmalloc-32 of size 32
[   24.495426] The buggy address is located 16 bytes inside of
[   24.495426]  freed 32-byte region [ffff888102a34180, ffff888102a341a0)
[   24.496383] 
[   24.496573] The buggy address belongs to the physical page:
[   24.496960] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a34
[   24.497707] flags: 0x200000000000000(node=0|zone=2)
[   24.498111] page_type: f5(slab)
[   24.498503] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   24.499140] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   24.499834] page dumped because: kasan: bad access detected
[   24.500266] 
[   24.500490] Memory state around the buggy address:
[   24.501019]  ffff888102a34080: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   24.501722]  ffff888102a34100: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   24.502179] >ffff888102a34180: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   24.502973]                          ^
[   24.503521]  ffff888102a34200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.504122]  ffff888102a34280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.504724] ==================================================================