UBSAN DRM Error at Boot UCHAR [1] and ATOM_PPLIB_NONCLOCK_INFO
Environment: kernel 6.7.3 060703 generic, Ubuntu 23.10, AMD Radeon™ HD 7800 Series, TAHITI, Southern Island, AMDGPU driver, Wayland, 2013 MacPro Trashcan FirePro 500 dual cards;
Possibly Related: #2894 (closed) #2874 (closed) #2759 #3107 (closed) Ubuntu LaunchPad Bugs Kernel 5.17 patch
During boot I am getting the following UBSAN DRM errors.
17:48:34 kernel: kfd kfd: amdgpu: TAHITI not supported in kfd
17:48:34 kernel: ================================================================================
17:48:34 kernel: index 16 is out of range for type 'UCHAR [1]'
17:48:34 kernel: UBSAN: array-index-out-of-bounds in /home/kernel/COD/linux/drivers/gpu/**drm**/amd/amdgpu/../pm/legacy-dpm/si_dpm.c:7321:32
17:48:34 kernel: ================================================================================
17:48:34 kernel: index 2 is out of range for type 'ATOM_PPLIB_NONCLOCK_INFO [1]'
17:48:34 kernel: UBSAN: array-index-out-of-bounds in /home/kernel/COD/linux/drivers/gpu/**drm**/amd/amdgpu/../pm/legacy-dpm/si_dpm.c:7288:39
17:48:34 kernel: ================================================================================
17:48:34 kernel: kfd kfd: amdgpu: TAHITI not supported in kfd
Not sure if this is the right place to post this?
#inxi -Fxxrzc0
> Graphics:
> Device-1: AMD Tahiti LE [Radeon HD 7870 XT] vendor: Apple FirePro D500
> driver: amdgpu v: kernel arch: GCN-1 pcie: speed: 8 GT/s lanes: 16 ports:
> active: none empty: DP-1, DP-2, DP-3, DP-4, DP-5, DP-6 bus-ID: 02:00.0
> chip-ID: 1002:679e temp: 55.0 C
> Device-2: AMD Tahiti LE [Radeon HD 7870 XT] vendor: Apple FirePro D500
> driver: amdgpu v: kernel arch: GCN-1 pcie: speed: 8 GT/s lanes: 16 ports:
> active: DP-11,DP-9 empty: DP-10, DP-12, DP-7, DP-8 bus-ID: 06:00.0
> chip-ID: 1002:679e temp: 60.0 C
> Device-3: Nexight NexiGo N930E FHD Webcam driver: snd-usb-audio,uvcvideo
> type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 bus-ID: 11-4:3
> chip-ID: 3433:930e
> Device-4: Apple FaceTime HD Camera (Display) driver: uvcvideo type: USB
> rev: 2.0 speed: 480 Mb/s lanes: 1 bus-ID: 3-1.5:4 chip-ID: 05ac:1112
> Display: wayland server: X.org v: 1.21.1.7 with: Xwayland v: 23.2.0
> compositor: gnome-shell driver: X: loaded: radeon
> unloaded: fbdev,modesetting,vesa dri: radeonsi gpu: amdgpu display-ID: 0
> Monitor-1: DP-11 model: Apple Thunderbolt res: 2560x1440 dpi: 109
> diag: 685mm (27")
> Monitor-2: DP-9 model: Dell U2312HM res: 1920x1080 dpi: 96
> diag: 585mm (23")
> API: OpenGL v: 4.6 Mesa 23.2.1-1ubuntu3.1 renderer: AMD Radeon HD 7800
> Series (tahiti LLVM 15.0.7 DRM 3.57 6.7.3-060703-generic)
> direct-render: Yes
The following patch seems to address it but cannot be applied:
From 94acfb2d574b989f0708e98337f7db1d4831ae17 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Wed, 17 Jan 2024 18:09:00 -0500
Subject: [PATCH] drm/amdgpu: covert some variable sized arrays to [] style
Replace [1] with []. Silences UBSAN warnings.
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3107
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/include/pptable.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/include/pptable.h b/drivers/gpu/drm/amd/include/pptable.h
index 5aac8d545bdc..ef3feb0b6674 100644
--- a/drivers/gpu/drm/amd/include/pptable.h
+++ b/drivers/gpu/drm/amd/include/pptable.h
@@ -491,7 +491,7 @@ typedef struct _ClockInfoArray{
//sizeof(ATOM_PPLIB_CLOCK_INFO)
UCHAR ucEntrySize;
- UCHAR clockInfo[1];
+ UCHAR clockInfo[];
}ClockInfoArray;
typedef struct _NonClockInfoArray{
@@ -501,7 +501,7 @@ typedef struct _NonClockInfoArray{
//sizeof(ATOM_PPLIB_NONCLOCK_INFO)
UCHAR ucEntrySize;
- ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[1];
+ ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[];
}NonClockInfoArray;
typedef struct _ATOM_PPLIB_Clock_Voltage_Dependency_Record
--
2.42.0
Edited by Alex Deucher