CVE-2024-50221 Information
Description
In the Linux kernel the following vulnerability has been resolved:
drm/amd/pm: Vangogh: Fix kernel memory out of bounds write
KASAN reports that the GPU metrics table allocated in vangogh_tables_init() is not large enough for the memset done in smu_cmn_init_soft_gpu_metrics(). Condensed report follows:
[ 33.861314] BUG: KASAN: slab-out-of-bounds in smu_cmn_init_soft_gpu_metrics+0x73/0x200 [amdgpu]
[ 33.861799] Write of size 168 at addr ffff888129f59500 by task mangoapp/1067
…
[ 33.861808] CPU: 6 UID: 1000 PID: 1067 Comm: mangoapp Tainted: G W 6.12.0-rc4 356 1a56f59a8b5182eeaf67eb7cb8b13594dd23b544
[ 33.861816] Tainted: [W]=WARN
[ 33.861818] Hardware name: Valve Galileo/Galileo BIOS F7G0107 12/01/2023
[ 33.861822] Call Trace:
[ 33.861826]
Empirically we can confirm that the former allocates 152 bytes for the table while the latter memsets the 168 large block.
Root cause appears that when GPU metrics tables for v2_4 parts were added it was not considered to enlarge the table to fit.
The fix in this patch is rather rute force\ and perhaps later should be done in a smarter way by extracting and consolidating the part version to size logic to a common helper instead of brute forcing the largest possible allocation. Nevertheless for now this works and fixes the out of bounds write.
v2: Drop impossible v3_0 case. (Mario)
(cherry picked from commit 0880f58f9609f0200483a49429af0f050d281703)
Reference
https://git.kernel.org/stable/c/f8fd9f0d57af4f8f48b383ec28287af85b47cb9f https://git.kernel.org/stable/c/4aa923a6e6406b43566ef6ac35a3d9a3197fa3e8
Share on: