Array index out-of-bounds in /pm/powerplay/hwmgr/vega20_hwmgr.c:3798
Using linux kernel 6.8.1, a system with Radeon VII and Radeon Pro VII GPUs, and dual monitor setup (over DP), I see this in dmesg:
[ 4410.307412] ------------[ cut here ]------------
[ 4410.307417] UBSAN: array-index-out-of-bounds in /home/kernel/COD/linux/drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega20_hwmgr.c:3798:40
[ 4410.307422] index 16 is out of range for type 'vega20_mclk_latency_entries [16]'
[ 4410.307424] CPU: 6 PID: 2312 Comm: gnome-shell Not tainted 6.8.1-060801-generic #202403151937
[ 4410.307427] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./X299 Taichi, BIOS P2.50B 03/16/2021
[ 4410.307429] Call Trace:
[ 4410.307430] <TASK>
[ 4410.307434] dump_stack_lvl+0x48/0x70
[ 4410.307443] dump_stack+0x10/0x20
[ 4410.307445] __ubsan_handle_out_of_bounds+0xc6/0x110
[ 4410.307450] vega20_apply_clocks_adjust_rules+0x6c4/0x8f0 [amdgpu]
[ 4410.307977] phm_apply_clock_adjust_rules+0x27/0x50 [amdgpu]
[ 4410.308345] psm_adjust_power_state_dynamic+0x15a/0x180 [amdgpu]
[ 4410.308716] hwmgr_handle_task+0x120/0x140 [amdgpu]
[ 4410.309078] pp_pm_compute_clocks+0x56/0xf0 [amdgpu]
[ 4410.309454] amdgpu_dpm_compute_clocks+0xc4/0x110 [amdgpu]
[ 4410.309832] dm_pp_apply_display_requirements+0x231/0x290 [amdgpu]
[ 4410.310217] dce11_pplib_apply_display_requirements+0x289/0x2f0 [amdgpu]
[ 4410.310629] dce12_update_clocks+0x103/0x150 [amdgpu]
[ 4410.311028] dce110_prepare_bandwidth+0x40/0x60 [amdgpu]
[ 4410.311432] dc_commit_state_no_check+0x15c/0xdc0 [amdgpu]
[ 4410.311809] dc_commit_streams+0x324/0x6b0 [amdgpu]
[ 4410.312187] amdgpu_dm_commit_streams+0x5fe/0x780 [amdgpu]
[ 4410.312569] ? dm_crtc_get_scanoutpos+0x61/0x170 [amdgpu]
[ 4410.312951] ? ktime_get+0x45/0xc0
[ 4410.312957] amdgpu_dm_atomic_commit_tail+0xff/0x10b0 [amdgpu]
[ 4410.313341] ? __pfx_amdgpu_crtc_get_scanout_position+0x10/0x10 [amdgpu]
[ 4410.313607] ? amdgpu_crtc_get_scanout_position+0x27/0x50 [amdgpu]
[ 4410.313870] ? drm_crtc_vblank_helper_get_vblank_timestamp_internal+0xfd/0x400
[ 4410.313877] ? wait_for_completion_timeout+0x119/0x150
[ 4410.313883] commit_tail+0xc6/0x1b0
[ 4410.313887] drm_atomic_helper_commit+0x132/0x160
[ 4410.313890] drm_atomic_commit+0x96/0xd0
[ 4410.313894] ? __pfx___drm_printfn_info+0x10/0x10
[ 4410.313898] drm_mode_atomic_ioctl+0x560/0x850
[ 4410.313902] ? __pfx_drm_mode_atomic_ioctl+0x10/0x10
[ 4410.313904] drm_ioctl_kernel+0xb9/0x120
[ 4410.313907] drm_ioctl+0x2d4/0x550
[ 4410.313909] ? __pfx_drm_mode_atomic_ioctl+0x10/0x10
[ 4410.313913] amdgpu_drm_ioctl+0x4e/0x90 [amdgpu]
[ 4410.314170] __x64_sys_ioctl+0xa0/0xf0
[ 4410.314173] do_syscall_64+0x82/0x180
[ 4410.314177] ? irqentry_exit+0x43/0x50
[ 4410.314180] ? exc_page_fault+0x94/0x1b0
[ 4410.314182] entry_SYSCALL_64_after_hwframe+0x6e/0x76
[ 4410.314187] RIP: 0033:0x750cfd11a94f
[ 4410.314206] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 77 1f 48 8b 44 24 18 64 48 2b 04 25 28 00
[ 4410.314208] RSP: 002b:00007ffe59884a10 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 4410.314211] RAX: ffffffffffffffda RBX: 00007ffe59884ab0 RCX: 0000750cfd11a94f
[ 4410.314212] RDX: 00007ffe59884ab0 RSI: 00000000c03864bc RDI: 000000000000000b
[ 4410.314214] RBP: 00000000c03864bc R08: 0000000000000013 R09: 0000000000000013
[ 4410.314215] R10: 0000000000000007 R11: 0000000000000246 R12: 0000580a5ebefc00
[ 4410.314216] R13: 000000000000000b R14: 0000580a5c21e9b0 R15: 0000580a5f759af0
[ 4410.314218] </TASK>
[ 4410.314231] ---[ end trace ]---
[ 4410.314233] ------------[ cut here ]------------
[ 4410.314234] UBSAN: array-index-out-of-bounds in /home/kernel/COD/linux/drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega20_hwmgr.c:3799:30
[ 4410.314237] index 19 is out of range for type 'vega20_dpm_level [16]'
[ 4410.314240] CPU: 6 PID: 2312 Comm: gnome-shell Not tainted 6.8.1-060801-generic #202403151937
[ 4410.314242] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./X299 Taichi, BIOS P2.50B 03/16/2021
[ 4410.314243] Call Trace:
[ 4410.314244] <TASK>
[ 4410.314245] dump_stack_lvl+0x48/0x70
[ 4410.314249] dump_stack+0x10/0x20
[ 4410.314251] __ubsan_handle_out_of_bounds+0xc6/0x110
[ 4410.314256] vega20_apply_clocks_adjust_rules+0x6f8/0x8f0 [amdgpu]
[ 4410.314631] phm_apply_clock_adjust_rules+0x27/0x50 [amdgpu]
[ 4410.314996] psm_adjust_power_state_dynamic+0x15a/0x180 [amdgpu]
[ 4410.315357] hwmgr_handle_task+0x120/0x140 [amdgpu]
[ 4410.315710] pp_pm_compute_clocks+0x56/0xf0 [amdgpu]
[ 4410.316076] amdgpu_dpm_compute_clocks+0xc4/0x110 [amdgpu]
[ 4410.316445] dm_pp_apply_display_requirements+0x231/0x290 [amdgpu]
[ 4410.316821] dce11_pplib_apply_display_requirements+0x289/0x2f0 [amdgpu]
[ 4410.317207] dce12_update_clocks+0x103/0x150 [amdgpu]
[ 4410.317595] dce110_prepare_bandwidth+0x40/0x60 [amdgpu]
[ 4410.317988] dc_commit_state_no_check+0x15c/0xdc0 [amdgpu]
[ 4410.318356] dc_commit_streams+0x324/0x6b0 [amdgpu]
[ 4410.318726] amdgpu_dm_commit_streams+0x5fe/0x780 [amdgpu]
[ 4410.319098] ? dm_crtc_get_scanoutpos+0x61/0x170 [amdgpu]
[ 4410.319471] ? ktime_get+0x45/0xc0
[ 4410.319475] amdgpu_dm_atomic_commit_tail+0xff/0x10b0 [amdgpu]
[ 4410.319859] ? __pfx_amdgpu_crtc_get_scanout_position+0x10/0x10 [amdgpu]
[ 4410.320120] ? amdgpu_crtc_get_scanout_position+0x27/0x50 [amdgpu]
[ 4410.320391] ? drm_crtc_vblank_helper_get_vblank_timestamp_internal+0xfd/0x400
[ 4410.320396] ? wait_for_completion_timeout+0x119/0x150
[ 4410.320400] commit_tail+0xc6/0x1b0
[ 4410.320404] drm_atomic_helper_commit+0x132/0x160
[ 4410.320406] drm_atomic_commit+0x96/0xd0
[ 4410.320410] ? __pfx___drm_printfn_info+0x10/0x10
[ 4410.320413] drm_mode_atomic_ioctl+0x560/0x850
[ 4410.320417] ? __pfx_drm_mode_atomic_ioctl+0x10/0x10
[ 4410.320419] drm_ioctl_kernel+0xb9/0x120
[ 4410.320422] drm_ioctl+0x2d4/0x550
[ 4410.320424] ? __pfx_drm_mode_atomic_ioctl+0x10/0x10
[ 4410.320427] amdgpu_drm_ioctl+0x4e/0x90 [amdgpu]
[ 4410.320673] __x64_sys_ioctl+0xa0/0xf0
[ 4410.320676] do_syscall_64+0x82/0x180
[ 4410.320679] ? irqentry_exit+0x43/0x50
[ 4410.320681] ? exc_page_fault+0x94/0x1b0
[ 4410.320684] entry_SYSCALL_64_after_hwframe+0x6e/0x76
[ 4410.320688] RIP: 0033:0x750cfd11a94f
[ 4410.320697] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 77 1f 48 8b 44 24 18 64 48 2b 04 25 28 00
[ 4410.320699] RSP: 002b:00007ffe59884a10 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 4410.320701] RAX: ffffffffffffffda RBX: 00007ffe59884ab0 RCX: 0000750cfd11a94f
[ 4410.320702] RDX: 00007ffe59884ab0 RSI: 00000000c03864bc RDI: 000000000000000b
[ 4410.320703] RBP: 00000000c03864bc R08: 0000000000000013 R09: 0000000000000013
[ 4410.320704] R10: 0000000000000007 R11: 0000000000000246 R12: 0000580a5ebefc00
[ 4410.320706] R13: 000000000000000b R14: 0000580a5c21e9b0 R15: 0000580a5f759af0
[ 4410.320708] </TASK>
[ 4410.320718] ---[ end trace ]---
[ 4410.320720] ------------[ cut here ]------------
[ 4410.320721] UBSAN: array-index-out-of-bounds in /home/kernel/COD/linux/drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega20_hwmgr.c:3800:65
[ 4410.320723] index 34 is out of range for type 'vega20_dpm_level [16]'
[ 4410.320725] CPU: 6 PID: 2312 Comm: gnome-shell Not tainted 6.8.1-060801-generic #202403151937
[ 4410.320727] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./X299 Taichi, BIOS P2.50B 03/16/2021
[ 4410.320728] Call Trace:
[ 4410.320729] <TASK>
[ 4410.320730] dump_stack_lvl+0x48/0x70
[ 4410.320733] dump_stack+0x10/0x20
[ 4410.320735] __ubsan_handle_out_of_bounds+0xc6/0x110
[ 4410.320739] vega20_apply_clocks_adjust_rules+0x74a/0x8f0 [amdgpu]
[ 4410.321109] phm_apply_clock_adjust_rules+0x27/0x50 [amdgpu]
[ 4410.321450] psm_adjust_power_state_dynamic+0x15a/0x180 [amdgpu]
[ 4410.321799] hwmgr_handle_task+0x120/0x140 [amdgpu]
[ 4410.322139] pp_pm_compute_clocks+0x56/0xf0 [amdgpu]
[ 4410.322493] amdgpu_dpm_compute_clocks+0xc4/0x110 [amdgpu]
[ 4410.322850] dm_pp_apply_display_requirements+0x231/0x290 [amdgpu]
[ 4410.323212] dce11_pplib_apply_display_requirements+0x289/0x2f0 [amdgpu]
[ 4410.323588] dce12_update_clocks+0x103/0x150 [amdgpu]
[ 4410.323964] dce110_prepare_bandwidth+0x40/0x60 [amdgpu]
[ 4410.324344] dc_commit_state_no_check+0x15c/0xdc0 [amdgpu]
[ 4410.324698] dc_commit_streams+0x324/0x6b0 [amdgpu]
[ 4410.325054] amdgpu_dm_commit_streams+0x5fe/0x780 [amdgpu]
[ 4410.325415] ? dm_crtc_get_scanoutpos+0x61/0x170 [amdgpu]
[ 4410.325774] ? ktime_get+0x45/0xc0
[ 4410.325778] amdgpu_dm_atomic_commit_tail+0xff/0x10b0 [amdgpu]
[ 4410.326138] ? __pfx_amdgpu_crtc_get_scanout_position+0x10/0x10 [amdgpu]
[ 4410.326390] ? amdgpu_crtc_get_scanout_position+0x27/0x50 [amdgpu]
[ 4410.326640] ? drm_crtc_vblank_helper_get_vblank_timestamp_internal+0xfd/0x400
[ 4410.326644] ? wait_for_completion_timeout+0x119/0x150
[ 4410.326647] commit_tail+0xc6/0x1b0
[ 4410.326650] drm_atomic_helper_commit+0x132/0x160
[ 4410.326653] drm_atomic_commit+0x96/0xd0
[ 4410.326655] ? __pfx___drm_printfn_info+0x10/0x10
[ 4410.326658] drm_mode_atomic_ioctl+0x560/0x850
[ 4410.326661] ? __pfx_drm_mode_atomic_ioctl+0x10/0x10
[ 4410.326663] drm_ioctl_kernel+0xb9/0x120
[ 4410.326666] drm_ioctl+0x2d4/0x550
[ 4410.326667] ? __pfx_drm_mode_atomic_ioctl+0x10/0x10
[ 4410.326671] amdgpu_drm_ioctl+0x4e/0x90 [amdgpu]
[ 4410.326914] __x64_sys_ioctl+0xa0/0xf0
[ 4410.326917] do_syscall_64+0x82/0x180
[ 4410.326919] ? irqentry_exit+0x43/0x50
[ 4410.326921] ? exc_page_fault+0x94/0x1b0
[ 4410.326923] entry_SYSCALL_64_after_hwframe+0x6e/0x76
[ 4410.326926] RIP: 0033:0x750cfd11a94f
[ 4410.326931] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 77 1f 48 8b 44 24 18 64 48 2b 04 25 28 00
[ 4410.326933] RSP: 002b:00007ffe59884a10 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 4410.326935] RAX: ffffffffffffffda RBX: 00007ffe59884ab0 RCX: 0000750cfd11a94f
[ 4410.326936] RDX: 00007ffe59884ab0 RSI: 00000000c03864bc RDI: 000000000000000b
[ 4410.326937] RBP: 00000000c03864bc R08: 0000000000000013 R09: 0000000000000013
[ 4410.326938] R10: 0000000000000007 R11: 0000000000000246 R12: 0000580a5ebefc00
[ 4410.326939] R13: 000000000000000b R14: 0000580a5c21e9b0 R15: 0000580a5f759af0
[ 4410.326941] </TASK>
[ 4410.326948] ---[ end trace ]---