cve-2024-39291
Vulnerability from cvelistv5
Published
2024-06-24 13:52
Modified
2024-11-05 09:31
Severity ?
EPSS score ?
Summary
drm/amdgpu: Fix buffer size in gfx_v9_4_3_init_ cp_compute_microcode() and rlc_microcode()
References
{ "containers": { "adp": [ { "providerMetadata": { "dateUpdated": "2024-08-02T04:19:20.630Z", "orgId": "af854a3a-2127-422b-91ae-364da2661108", "shortName": "CVE" }, "references": [ { "tags": [ "x_transferred" ], "url": "https://git.kernel.org/stable/c/19bd9537b6bc1c882df25206c15917214d8e9460" }, { "tags": [ "x_transferred" ], "url": "https://git.kernel.org/stable/c/f1b6a016dfa45cedc080d36fa5d6f22237d80e8b" }, { "tags": [ "x_transferred" ], "url": "https://git.kernel.org/stable/c/acce6479e30f73ab0872e93a75aed1fb791d04ec" } ], "title": "CVE Program Container" }, { "metrics": [ { "other": { "content": { "id": "CVE-2024-39291", "options": [ { "Exploitation": "none" }, { "Automatable": "no" }, { "Technical Impact": "partial" } ], "role": "CISA Coordinator", "timestamp": "2024-09-10T17:08:43.406503Z", "version": "2.0.3" }, "type": "ssvc" } } ], "providerMetadata": { "dateUpdated": "2024-09-11T17:34:43.758Z", "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "shortName": "CISA-ADP" }, "title": "CISA ADP Vulnrichment" } ], "cna": { "affected": [ { "defaultStatus": "unaffected", "product": "Linux", "programFiles": [ "drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c" ], "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "vendor": "Linux", "versions": [ { "lessThan": "19bd9537b6bc", "status": "affected", "version": "86301129698b", "versionType": "git" }, { "lessThan": "f1b6a016dfa4", "status": "affected", "version": "86301129698b", "versionType": "git" }, { "lessThan": "acce6479e30f", "status": "affected", "version": "86301129698b", "versionType": "git" } ] }, { "defaultStatus": "affected", "product": "Linux", "programFiles": [ "drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c" ], "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "vendor": "Linux", "versions": [ { "status": "affected", "version": "6.5" }, { "lessThan": "6.5", "status": "unaffected", "version": "0", "versionType": "semver" }, { "lessThanOrEqual": "6.6.*", "status": "unaffected", "version": "6.6.33", "versionType": "semver" }, { "lessThanOrEqual": "6.9.*", "status": "unaffected", "version": "6.9.4", "versionType": "semver" }, { "lessThanOrEqual": "*", "status": "unaffected", "version": "6.10", "versionType": "original_commit_for_fix" } ] } ], "descriptions": [ { "lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\ndrm/amdgpu: Fix buffer size in gfx_v9_4_3_init_ cp_compute_microcode() and rlc_microcode()\n\nThe function gfx_v9_4_3_init_microcode in gfx_v9_4_3.c was generating\nabout potential truncation of output when using the snprintf function.\nThe issue was due to the size of the buffer \u0027ucode_prefix\u0027 being too\nsmall to accommodate the maximum possible length of the string being\nwritten into it.\n\nThe string being written is \"amdgpu/%s_mec.bin\" or \"amdgpu/%s_rlc.bin\",\nwhere %s is replaced by the value of \u0027chip_name\u0027. The length of this\nstring without the %s is 16 characters. The warning message indicated\nthat \u0027chip_name\u0027 could be up to 29 characters long, resulting in a total\nof 45 characters, which exceeds the buffer size of 30 characters.\n\nTo resolve this issue, the size of the \u0027ucode_prefix\u0027 buffer has been\nreduced from 30 to 15. This ensures that the maximum possible length of\nthe string being written into the buffer will not exceed its size, thus\npreventing potential buffer overflow and truncation issues.\n\nFixes the below with gcc W=1:\ndrivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c: In function \u2018gfx_v9_4_3_early_init\u2019:\ndrivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:52: warning: \u2018%s\u2019 directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]\n 379 | snprintf(fw_name, sizeof(fw_name), \"amdgpu/%s_rlc.bin\", chip_name);\n | ^~\n......\n 439 | r = gfx_v9_4_3_init_rlc_microcode(adev, ucode_prefix);\n | ~~~~~~~~~~~~\ndrivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:9: note: \u2018snprintf\u2019 output between 16 and 45 bytes into a destination of size 30\n 379 | snprintf(fw_name, sizeof(fw_name), \"amdgpu/%s_rlc.bin\", chip_name);\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\ndrivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:52: warning: \u2018%s\u2019 directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]\n 413 | snprintf(fw_name, sizeof(fw_name), \"amdgpu/%s_mec.bin\", chip_name);\n | ^~\n......\n 443 | r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);\n | ~~~~~~~~~~~~\ndrivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:9: note: \u2018snprintf\u2019 output between 16 and 45 bytes into a destination of size 30\n 413 | snprintf(fw_name, sizeof(fw_name), \"amdgpu/%s_mec.bin\", chip_name);\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" } ], "providerMetadata": { "dateUpdated": "2024-11-05T09:31:37.282Z", "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "shortName": "Linux" }, "references": [ { "url": "https://git.kernel.org/stable/c/19bd9537b6bc1c882df25206c15917214d8e9460" }, { "url": "https://git.kernel.org/stable/c/f1b6a016dfa45cedc080d36fa5d6f22237d80e8b" }, { "url": "https://git.kernel.org/stable/c/acce6479e30f73ab0872e93a75aed1fb791d04ec" } ], "title": "drm/amdgpu: Fix buffer size in gfx_v9_4_3_init_ cp_compute_microcode() and rlc_microcode()", "x_generator": { "engine": "bippy-9e1c9544281a" } } }, "cveMetadata": { "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "assignerShortName": "Linux", "cveId": "CVE-2024-39291", "datePublished": "2024-06-24T13:52:26.082Z", "dateReserved": "2024-06-21T11:16:40.644Z", "dateUpdated": "2024-11-05T09:31:37.282Z", "state": "PUBLISHED" }, "dataType": "CVE_RECORD", "dataVersion": "5.1", "meta": { "nvd": "{\"cve\":{\"id\":\"CVE-2024-39291\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-06-24T14:15:12.863\",\"lastModified\":\"2024-06-26T14:03:13.437\",\"vulnStatus\":\"Analyzed\",\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\ndrm/amdgpu: Fix buffer size in gfx_v9_4_3_init_ cp_compute_microcode() and rlc_microcode()\\n\\nThe function gfx_v9_4_3_init_microcode in gfx_v9_4_3.c was generating\\nabout potential truncation of output when using the snprintf function.\\nThe issue was due to the size of the buffer \u0027ucode_prefix\u0027 being too\\nsmall to accommodate the maximum possible length of the string being\\nwritten into it.\\n\\nThe string being written is \\\"amdgpu/%s_mec.bin\\\" or \\\"amdgpu/%s_rlc.bin\\\",\\nwhere %s is replaced by the value of \u0027chip_name\u0027. The length of this\\nstring without the %s is 16 characters. The warning message indicated\\nthat \u0027chip_name\u0027 could be up to 29 characters long, resulting in a total\\nof 45 characters, which exceeds the buffer size of 30 characters.\\n\\nTo resolve this issue, the size of the \u0027ucode_prefix\u0027 buffer has been\\nreduced from 30 to 15. This ensures that the maximum possible length of\\nthe string being written into the buffer will not exceed its size, thus\\npreventing potential buffer overflow and truncation issues.\\n\\nFixes the below with gcc W=1:\\ndrivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c: In function \u2018gfx_v9_4_3_early_init\u2019:\\ndrivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:52: warning: \u2018%s\u2019 directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]\\n 379 | snprintf(fw_name, sizeof(fw_name), \\\"amdgpu/%s_rlc.bin\\\", chip_name);\\n | ^~\\n......\\n 439 | r = gfx_v9_4_3_init_rlc_microcode(adev, ucode_prefix);\\n | ~~~~~~~~~~~~\\ndrivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:9: note: \u2018snprintf\u2019 output between 16 and 45 bytes into a destination of size 30\\n 379 | snprintf(fw_name, sizeof(fw_name), \\\"amdgpu/%s_rlc.bin\\\", chip_name);\\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\ndrivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:52: warning: \u2018%s\u2019 directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]\\n 413 | snprintf(fw_name, sizeof(fw_name), \\\"amdgpu/%s_mec.bin\\\", chip_name);\\n | ^~\\n......\\n 443 | r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);\\n | ~~~~~~~~~~~~\\ndrivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:9: note: \u2018snprintf\u2019 output between 16 and 45 bytes into a destination of size 30\\n 413 | snprintf(fw_name, sizeof(fw_name), \\\"amdgpu/%s_mec.bin\\\", chip_name);\\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se resolvi\u00f3 la siguiente vulnerabilidad: drm/amdgpu: corrigi\u00f3 el tama\u00f1o del b\u00fafer en gfx_v9_4_3_init_ cp_compute_microcode() y rlc_microcode() La funci\u00f3n gfx_v9_4_3_init_microcode en gfx_v9_4_3.c generaba un posible truncamiento de la salida al usar la funci\u00f3n snprintf. El problema se deb\u00eda a que el tama\u00f1o del b\u00fafer \u0027ucode_prefix\u0027 era demasiado peque\u00f1o para acomodar la longitud m\u00e1xima posible de la cadena que se estaba escribiendo en \u00e9l. La cadena que se est\u00e1 escribiendo es \\\"amdgpu/%s_mec.bin\\\" o \\\"amdgpu/%s_rlc.bin\\\", donde %s se reemplaza por el valor de \u0027chip_name\u0027. La longitud de esta cadena sin %s es de 16 caracteres. El mensaje de advertencia indicaba que \u0027chip_name\u0027 pod\u00eda tener hasta 29 caracteres, lo que daba como resultado un total de 45 caracteres, lo que supera el tama\u00f1o del b\u00fafer de 30 caracteres. Para resolver este problema, el tama\u00f1o del b\u00fafer \u0027ucode_prefix\u0027 se ha reducido de 30 a 15. Esto garantiza que la longitud m\u00e1xima posible de la cadena que se escribe en el b\u00fafer no exceder\u00e1 su tama\u00f1o, evitando as\u00ed posibles problemas de desbordamiento y truncamiento del b\u00fafer. . Corrige lo siguiente con gcc W=1: drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c: En funci\u00f3n \u0027gfx_v9_4_3_early_init\u0027: drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:52: advertencia: \u0027 La salida de la directiva de %s puede truncarse escribiendo hasta 29 bytes en una regi\u00f3n de tama\u00f1o 23 [-Wformat-truncation=] 379 | snprintf(fw_name, sizeof(fw_name), \\\"amdgpu/%s_rlc.bin\\\", chip_name); | ^~ ...... 439 | r = gfx_v9_4_3_init_rlc_microcode(adev, ucode_prefix); | ~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:9: nota: \u0027snprintf\u0027 genera entre 16 y 45 bytes en un destino de tama\u00f1o 30 379 | snprintf(fw_name, sizeof(fw_name), \\\"amdgpu/%s_rlc.bin\\\", chip_name); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:52: advertencia: la salida de la directiva \u0027%s\u0027 puede truncarse escribiendo hasta 29 bytes en una regi\u00f3n de tama\u00f1o 23 [-Wformat-truncation=] 413 | snprintf(fw_name, sizeof(fw_name), \\\"amdgpu/%s_mec.bin\\\", chip_name); | ^~ ...... 443 | r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix); | ~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:9: nota: \u0027snprintf\u0027 genera entre 16 y 45 bytes en un destino de tama\u00f1o 30 413 | snprintf(fw_name, sizeof(fw_name), \\\"amdgpu/%s_mec.bin\\\", chip_name); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~\"}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H\",\"attackVector\":\"LOCAL\",\"attackComplexity\":\"LOW\",\"privilegesRequired\":\"LOW\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"HIGH\",\"integrityImpact\":\"HIGH\",\"availabilityImpact\":\"HIGH\",\"baseScore\":7.8,\"baseSeverity\":\"HIGH\"},\"exploitabilityScore\":1.8,\"impactScore\":5.9}]},\"weaknesses\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"description\":[{\"lang\":\"en\",\"value\":\"CWE-120\"}]}],\"configurations\":[{\"nodes\":[{\"operator\":\"OR\",\"negate\":false,\"cpeMatch\":[{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionEndExcluding\":\"6.5\",\"matchCriteriaId\":\"98C491C7-598A-4D36-BA4F-3505A5727ED1\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"6.6\",\"versionEndExcluding\":\"6.6.33\",\"matchCriteriaId\":\"53BC60D9-65A5-4D8F-96C8-149F09214DBD\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"6.9\",\"versionEndExcluding\":\"6.9.4\",\"matchCriteriaId\":\"A500F935-F0ED-4DC7-AD02-9D7C365D13AE\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:6.10.0:rc1:*:*:*:*:*:*\",\"matchCriteriaId\":\"C40DD2D9-90E3-4E95-9F1A-E7C680F11F2A\"}]}]}],\"references\":[{\"url\":\"https://git.kernel.org/stable/c/19bd9537b6bc1c882df25206c15917214d8e9460\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Mailing List\",\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/acce6479e30f73ab0872e93a75aed1fb791d04ec\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Mailing List\",\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/f1b6a016dfa45cedc080d36fa5d6f22237d80e8b\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Mailing List\",\"Patch\"]}]}}" } }
Loading...
Loading...
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.