Hay
Date
Dec. 9, 2024, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   23.995981] ==================================================================
[   23.997118] BUG: KASAN: slab-use-after-free in krealloc_uaf+0x180/0x520
[   23.997942] Read of size 1 at addr fff00000c0973600 by task kunit_try_catch/152
[   23.998813] 
[   23.999646] CPU: 0 UID: 0 PID: 152 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   24.000922] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.001489] Hardware name: linux,dummy-virt (DT)
[   24.002361] Call trace:
[   24.003298]  show_stack+0x20/0x38 (C)
[   24.003879]  dump_stack_lvl+0x8c/0xd0
[   24.004440]  print_report+0x118/0x5e0
[   24.005025]  kasan_report+0xc8/0x118
[   24.005561]  __kasan_check_byte+0x54/0x70
[   24.006192]  krealloc_noprof+0x44/0x360
[   24.006770]  krealloc_uaf+0x180/0x520
[   24.007336]  kunit_try_run_case+0x14c/0x3d0
[   24.008323]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.008998]  kthread+0x24c/0x2d0
[   24.009399]  ret_from_fork+0x10/0x20
[   24.010406] 
[   24.010792] Allocated by task 152:
[   24.011353]  kasan_save_stack+0x3c/0x68
[   24.012212]  kasan_save_track+0x20/0x40
[   24.012811]  kasan_save_alloc_info+0x40/0x58
[   24.013482]  __kasan_kmalloc+0xd4/0xd8
[   24.014091]  __kmalloc_cache_noprof+0x15c/0x3c0
[   24.014733]  krealloc_uaf+0xc8/0x520
[   24.015343]  kunit_try_run_case+0x14c/0x3d0
[   24.016006]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.017427]  kthread+0x24c/0x2d0
[   24.017870]  ret_from_fork+0x10/0x20
[   24.018380] 
[   24.018722] Freed by task 152:
[   24.019532]  kasan_save_stack+0x3c/0x68
[   24.020079]  kasan_save_track+0x20/0x40
[   24.020613]  kasan_save_free_info+0x4c/0x78
[   24.021176]  __kasan_slab_free+0x6c/0x98
[   24.021753]  kfree+0x114/0x3c8
[   24.022210]  krealloc_uaf+0x12c/0x520
[   24.022748]  kunit_try_run_case+0x14c/0x3d0
[   24.024037]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.024729]  kthread+0x24c/0x2d0
[   24.025238]  ret_from_fork+0x10/0x20
[   24.025795] 
[   24.026143] The buggy address belongs to the object at fff00000c0973600
[   24.026143]  which belongs to the cache kmalloc-256 of size 256
[   24.027517] The buggy address is located 0 bytes inside of
[   24.027517]  freed 256-byte region [fff00000c0973600, fff00000c0973700)
[   24.029198] 
[   24.029428] The buggy address belongs to the physical page:
[   24.030181] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x100972
[   24.031647] head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
[   24.032786] flags: 0xbfffe0000000040(head|node=0|zone=2|lastcpupid=0x1ffff)
[   24.033523] page_type: f5(slab)
[   24.034062] raw: 0bfffe0000000040 fff00000c0001b40 dead000000000122 0000000000000000
[   24.035269] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   24.036017] head: 0bfffe0000000040 fff00000c0001b40 dead000000000122 0000000000000000
[   24.036901] head: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   24.037808] head: 0bfffe0000000001 ffffc1ffc3025c81 ffffffffffffffff 0000000000000000
[   24.038650] head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
[   24.040087] page dumped because: kasan: bad access detected
[   24.040721] 
[   24.041041] Memory state around the buggy address:
[   24.041635]  fff00000c0973500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.042436]  fff00000c0973580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.043634] >fff00000c0973600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   24.044534]                    ^
[   24.045154]  fff00000c0973680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   24.046195]  fff00000c0973700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.047950] ==================================================================
[   24.051410] ==================================================================
[   24.052269] BUG: KASAN: slab-use-after-free in krealloc_uaf+0x4c8/0x520
[   24.052933] Read of size 1 at addr fff00000c0973600 by task kunit_try_catch/152
[   24.053535] 
[   24.053938] CPU: 0 UID: 0 PID: 152 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   24.055123] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.055833] Hardware name: linux,dummy-virt (DT)
[   24.057181] Call trace:
[   24.057613]  show_stack+0x20/0x38 (C)
[   24.058284]  dump_stack_lvl+0x8c/0xd0
[   24.059193]  print_report+0x118/0x5e0
[   24.059662]  kasan_report+0xc8/0x118
[   24.060084]  __asan_report_load1_noabort+0x20/0x30
[   24.060579]  krealloc_uaf+0x4c8/0x520
[   24.061454]  kunit_try_run_case+0x14c/0x3d0
[   24.062027]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.062799]  kthread+0x24c/0x2d0
[   24.063651]  ret_from_fork+0x10/0x20
[   24.064100] 
[   24.064503] Allocated by task 152:
[   24.065285]  kasan_save_stack+0x3c/0x68
[   24.065870]  kasan_save_track+0x20/0x40
[   24.066409]  kasan_save_alloc_info+0x40/0x58
[   24.067027]  __kasan_kmalloc+0xd4/0xd8
[   24.067569]  __kmalloc_cache_noprof+0x15c/0x3c0
[   24.068566]  krealloc_uaf+0xc8/0x520
[   24.069121]  kunit_try_run_case+0x14c/0x3d0
[   24.069686]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.070368]  kthread+0x24c/0x2d0
[   24.070936]  ret_from_fork+0x10/0x20
[   24.072070] 
[   24.072390] Freed by task 152:
[   24.072858]  kasan_save_stack+0x3c/0x68
[   24.073387]  kasan_save_track+0x20/0x40
[   24.073964]  kasan_save_free_info+0x4c/0x78
[   24.074523]  __kasan_slab_free+0x6c/0x98
[   24.075149]  kfree+0x114/0x3c8
[   24.075597]  krealloc_uaf+0x12c/0x520
[   24.076113]  kunit_try_run_case+0x14c/0x3d0
[   24.076652]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.077725]  kthread+0x24c/0x2d0
[   24.078208]  ret_from_fork+0x10/0x20
[   24.078753] 
[   24.079082] The buggy address belongs to the object at fff00000c0973600
[   24.079082]  which belongs to the cache kmalloc-256 of size 256
[   24.081009] The buggy address is located 0 bytes inside of
[   24.081009]  freed 256-byte region [fff00000c0973600, fff00000c0973700)
[   24.082166] 
[   24.082479] The buggy address belongs to the physical page:
[   24.083441] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x100972
[   24.084165] head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
[   24.084972] flags: 0xbfffe0000000040(head|node=0|zone=2|lastcpupid=0x1ffff)
[   24.085799] page_type: f5(slab)
[   24.086233] raw: 0bfffe0000000040 fff00000c0001b40 dead000000000122 0000000000000000
[   24.087887] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   24.088603] head: 0bfffe0000000040 fff00000c0001b40 dead000000000122 0000000000000000
[   24.089471] head: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   24.090365] head: 0bfffe0000000001 ffffc1ffc3025c81 ffffffffffffffff 0000000000000000
[   24.091428] head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
[   24.092575] page dumped because: kasan: bad access detected
[   24.093455] 
[   24.093762] Memory state around the buggy address:
[   24.094291]  fff00000c0973500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.095203]  fff00000c0973580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.096239] >fff00000c0973600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   24.097255]                    ^
[   24.097888]  fff00000c0973680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   24.098762]  fff00000c0973700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.099798] ==================================================================

[   23.905690] ==================================================================
[   23.906764] BUG: KASAN: slab-use-after-free in krealloc_uaf+0x53e/0x5e0
[   23.907319] Read of size 1 at addr ffff8881003a0800 by task kunit_try_catch/171
[   23.908217] 
[   23.908427] CPU: 0 UID: 0 PID: 171 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   23.909657] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.910240] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   23.910798] Call Trace:
[   23.911687]  <TASK>
[   23.912072]  dump_stack_lvl+0x73/0xb0
[   23.912714]  print_report+0xd1/0x640
[   23.913118]  ? __virt_addr_valid+0x1db/0x2d0
[   23.913715]  ? kasan_complete_mode_report_info+0x64/0x200
[   23.914468]  kasan_report+0x102/0x140
[   23.914754]  ? krealloc_uaf+0x53e/0x5e0
[   23.915684]  ? krealloc_uaf+0x53e/0x5e0
[   23.916547]  __asan_report_load1_noabort+0x18/0x20
[   23.916949]  krealloc_uaf+0x53e/0x5e0
[   23.918061]  ? __pfx_krealloc_uaf+0x10/0x10
[   23.918861]  ? finish_task_switch.isra.0+0x153/0x700
[   23.919788]  ? __switch_to+0x5d9/0xf60
[   23.920197]  ? __schedule+0xc70/0x27e0
[   23.920698]  ? __pfx_read_tsc+0x10/0x10
[   23.921130]  ? ktime_get_ts64+0x86/0x230
[   23.921572]  kunit_try_run_case+0x1b3/0x490
[   23.922040]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.922556]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   23.923074]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   23.924155]  ? __kthread_parkme+0x82/0x160
[   23.924501]  ? preempt_count_sub+0x50/0x80
[   23.925098]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.925798]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   23.926410]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.926917]  kthread+0x257/0x310
[   23.927809]  ? __pfx_kthread+0x10/0x10
[   23.928355]  ret_from_fork+0x41/0x80
[   23.928676]  ? __pfx_kthread+0x10/0x10
[   23.929327]  ret_from_fork_asm+0x1a/0x30
[   23.929720]  </TASK>
[   23.930360] 
[   23.930535] Allocated by task 171:
[   23.930967]  kasan_save_stack+0x3d/0x60
[   23.931337]  kasan_save_track+0x18/0x40
[   23.931759]  kasan_save_alloc_info+0x3b/0x50
[   23.932192]  __kasan_kmalloc+0xb7/0xc0
[   23.932562]  __kmalloc_cache_noprof+0x184/0x410
[   23.933830]  krealloc_uaf+0xbc/0x5e0
[   23.934274]  kunit_try_run_case+0x1b3/0x490
[   23.934606]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.935391]  kthread+0x257/0x310
[   23.935783]  ret_from_fork+0x41/0x80
[   23.936356]  ret_from_fork_asm+0x1a/0x30
[   23.936776] 
[   23.937049] Freed by task 171:
[   23.937916]  kasan_save_stack+0x3d/0x60
[   23.938218]  kasan_save_track+0x18/0x40
[   23.938737]  kasan_save_free_info+0x3f/0x60
[   23.939446]  __kasan_slab_free+0x56/0x70
[   23.939780]  kfree+0x123/0x3f0
[   23.940179]  krealloc_uaf+0x13e/0x5e0
[   23.940663]  kunit_try_run_case+0x1b3/0x490
[   23.941320]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.942241]  kthread+0x257/0x310
[   23.942711]  ret_from_fork+0x41/0x80
[   23.943165]  ret_from_fork_asm+0x1a/0x30
[   23.943698] 
[   23.944015] The buggy address belongs to the object at ffff8881003a0800
[   23.944015]  which belongs to the cache kmalloc-256 of size 256
[   23.944842] The buggy address is located 0 bytes inside of
[   23.944842]  freed 256-byte region [ffff8881003a0800, ffff8881003a0900)
[   23.945950] 
[   23.946151] The buggy address belongs to the physical page:
[   23.946613] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1003a0
[   23.949100] head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
[   23.949976] flags: 0x200000000000040(head|node=0|zone=2)
[   23.950804] page_type: f5(slab)
[   23.951085] raw: 0200000000000040 ffff888100041b40 dead000000000122 0000000000000000
[   23.952384] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   23.953389] head: 0200000000000040 ffff888100041b40 dead000000000122 0000000000000000
[   23.954551] head: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   23.955587] head: 0200000000000001 ffffea000400e801 ffffffffffffffff 0000000000000000
[   23.956438] head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
[   23.957686] page dumped because: kasan: bad access detected
[   23.958678] 
[   23.958919] Memory state around the buggy address:
[   23.959821]  ffff8881003a0700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.961051]  ffff8881003a0780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.961698] >ffff8881003a0800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   23.963006]                    ^
[   23.964036]  ffff8881003a0880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   23.964888]  ffff8881003a0900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.965485] ==================================================================
[   23.834931] ==================================================================
[   23.836972] BUG: KASAN: slab-use-after-free in krealloc_uaf+0x1b9/0x5e0
[   23.838154] Read of size 1 at addr ffff8881003a0800 by task kunit_try_catch/171
[   23.838828] 
[   23.839063] CPU: 0 UID: 0 PID: 171 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   23.841107] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.841772] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   23.843043] Call Trace:
[   23.843607]  <TASK>
[   23.844120]  dump_stack_lvl+0x73/0xb0
[   23.845278]  print_report+0xd1/0x640
[   23.845665]  ? __virt_addr_valid+0x1db/0x2d0
[   23.846641]  ? kasan_complete_mode_report_info+0x64/0x200
[   23.847193]  kasan_report+0x102/0x140
[   23.848193]  ? krealloc_uaf+0x1b9/0x5e0
[   23.849058]  ? krealloc_uaf+0x1b9/0x5e0
[   23.849859]  ? krealloc_uaf+0x1b9/0x5e0
[   23.850476]  __kasan_check_byte+0x3d/0x50
[   23.851203]  krealloc_noprof+0x3f/0x340
[   23.852235]  krealloc_uaf+0x1b9/0x5e0
[   23.852885]  ? __pfx_krealloc_uaf+0x10/0x10
[   23.853387]  ? finish_task_switch.isra.0+0x153/0x700
[   23.854275]  ? __switch_to+0x5d9/0xf60
[   23.854731]  ? __schedule+0xc70/0x27e0
[   23.855579]  ? __pfx_read_tsc+0x10/0x10
[   23.856481]  ? ktime_get_ts64+0x86/0x230
[   23.856991]  kunit_try_run_case+0x1b3/0x490
[   23.857732]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.858620]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   23.859423]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   23.860104]  ? __kthread_parkme+0x82/0x160
[   23.861287]  ? preempt_count_sub+0x50/0x80
[   23.861743]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.862768]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   23.863687]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.865013]  kthread+0x257/0x310
[   23.865653]  ? __pfx_kthread+0x10/0x10
[   23.866444]  ret_from_fork+0x41/0x80
[   23.867029]  ? __pfx_kthread+0x10/0x10
[   23.867499]  ret_from_fork_asm+0x1a/0x30
[   23.868598]  </TASK>
[   23.868886] 
[   23.869066] Allocated by task 171:
[   23.869851]  kasan_save_stack+0x3d/0x60
[   23.870253]  kasan_save_track+0x18/0x40
[   23.870558]  kasan_save_alloc_info+0x3b/0x50
[   23.871717]  __kasan_kmalloc+0xb7/0xc0
[   23.872498]  __kmalloc_cache_noprof+0x184/0x410
[   23.872927]  krealloc_uaf+0xbc/0x5e0
[   23.873285]  kunit_try_run_case+0x1b3/0x490
[   23.873893]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.874651]  kthread+0x257/0x310
[   23.875578]  ret_from_fork+0x41/0x80
[   23.876553]  ret_from_fork_asm+0x1a/0x30
[   23.877070] 
[   23.877652] Freed by task 171:
[   23.878098]  kasan_save_stack+0x3d/0x60
[   23.878930]  kasan_save_track+0x18/0x40
[   23.879657]  kasan_save_free_info+0x3f/0x60
[   23.880814]  __kasan_slab_free+0x56/0x70
[   23.881755]  kfree+0x123/0x3f0
[   23.882476]  krealloc_uaf+0x13e/0x5e0
[   23.883903]  kunit_try_run_case+0x1b3/0x490
[   23.884172]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.884548]  kthread+0x257/0x310
[   23.885246]  ret_from_fork+0x41/0x80
[   23.885721]  ret_from_fork_asm+0x1a/0x30
[   23.886108] 
[   23.886340] The buggy address belongs to the object at ffff8881003a0800
[   23.886340]  which belongs to the cache kmalloc-256 of size 256
[   23.888843] The buggy address is located 0 bytes inside of
[   23.888843]  freed 256-byte region [ffff8881003a0800, ffff8881003a0900)
[   23.889765] 
[   23.890138] The buggy address belongs to the physical page:
[   23.890606] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1003a0
[   23.891284] head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
[   23.892020] flags: 0x200000000000040(head|node=0|zone=2)
[   23.892583] page_type: f5(slab)
[   23.893007] raw: 0200000000000040 ffff888100041b40 dead000000000122 0000000000000000
[   23.893782] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   23.894369] head: 0200000000000040 ffff888100041b40 dead000000000122 0000000000000000
[   23.895118] head: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   23.896667] head: 0200000000000001 ffffea000400e801 ffffffffffffffff 0000000000000000
[   23.897522] head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
[   23.898040] page dumped because: kasan: bad access detected
[   23.898601] 
[   23.898832] Memory state around the buggy address:
[   23.899341]  ffff8881003a0700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.900566]  ffff8881003a0780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.901356] >ffff8881003a0800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   23.902132]                    ^
[   23.902523]  ffff8881003a0880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   23.903112]  ffff8881003a0900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.904258] ==================================================================