7.8high
tracing/dma: Cap dma_map_sg tracepoint arrays to prevent buffer overflow
- Severity
- 7.8high CVSS:3.1 by NVD
- Exploit likelihood
- 0.15% (higher than 4% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: tracing/dma: Cap dma_map_sg tracepoint arrays to prevent buffer overflow The dma_map_sg tracepoint can trigger a perf buffer overflow when tracing large scatter-gather lists. With devices like virtio-gpu creating large DRM buffers, nents can exceed 1000 entries, resulting in: phys_addrs: 1000 * 8 bytes = 8,000 bytes dma_addrs: 1000 * 8 bytes = 8,000 bytes lengths: 1000 * 4 bytes = 4,000 bytes Total: ~20,000 bytes This exceeds PERF_MAX_TRACE_SIZE (8192 bytes), causing: WARNING: CPU: 0 PID: 5497 at kernel/trace/trace_event_perf.c:405 perf buffer not large enough, wanted 24620, have 8192 Cap all three dynamic arrays at 128 entries using min() in the array size calculation. This ensures arrays are only as large as needed (up to the cap), avoiding unnecessary memory allocation for small operations while preventing overflow for large ones. The tracepoint now records the full nents/ents counts and a truncated flag so users can see when data has been capped. Changes in v2: - Use min(nents, DMA_TRACE_MAX_ENTRIES) for dynamic array sizing instead of fixed DMA_TRACE_MAX_ENTRIES allocation (feedback from Steven Rostedt) - This allocates only what's needed up to the cap, avoiding waste for small operations Reviwed-by: Sean Anderson <sean.anderson@linux.dev>
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 038eb433dc1474c4bc7d33188294e3d4778efdfd before 02d209bb018a40dee9eac89e91860253dee9605b, from 038eb433dc1474c4bc7d33188294e3d4778efdfd before f2584f791a10343bdc995ff6ff402db45b95de69, from 038eb433dc1474c4bc7d33188294e3d4778efdfd before daafcc0ef0b358d9d622b6e3b7c43767aa3814ee, 6.12 Not affected: before 6.12, from 6.12.74 up to 6.12.*, from 6.18.13 up to 6.18.*, from 6.19 up to * | CVE List |
| linux linux_kernel | from 6.12.1 before 6.12.74, from 6.13 before 6.18.13, 6.12, 6.19 | NVD |
Classification
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: tracing/dma: Cap dma_map_sg tracepoint arrays to prevent buffer overflow The dma_map_sg tracepoint can trigger a perf buffer overflow when tracing large scatter-gather lists. With devices like virtio-gpu creating large DRM buffers, nents can exceed 1000 entries, resulting in: phys_addrs: 1000 * 8 bytes = 8,000 bytes dma_addrs: 1000 * 8 bytes = 8,000 bytes lengths: 1000 * 4 bytes = 4,000 bytes Total: ~20,000 bytes This exceeds PERF_MAX_TRACE_SIZE (8192 bytes), causing: WARNING: CPU: 0 PID: 5497 at kernel/trace/trace_event_perf.c:405 perf buffer not large enough, wanted 24620, have 8192 Cap all three dynamic arrays at 128 entries using min() in the array size calculation. This ensures arrays are only as large as needed (up to the cap), avoiding unnecessary memory allocation for small operations while preventing overflow for large ones. The tracepoint now records the full nents/ents counts and a truncated flag so users can see when data has been capped. Changes in v2: - Use min(nents, DMA_TRACE_MAX_ENTRIES) for dynamic array sizing instead of fixed DMA_TRACE_MAX_ENTRIES allocation (feedback from Steven Rostedt) - This allocates only what's needed up to the cap, avoiding waste for small operations Reviwed-by: Sean Anderson <sean.anderson@linux.dev>
NVD (es)
En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: tracing/dma: Limitar los arrays del tracepoint dma_map_sg para prevenir el desbordamiento de búfer El tracepoint dma_map_sg puede desencadenar un desbordamiento de búfer de perf al trazar listas grandes de scatter-gather. Con dispositivos como virtio-gpu creando búferes DRM grandes, nents puede exceder las 1000 entradas, resultando en: phys_addrs: 1000 * 8 bytes = 8.000 bytes dma_addrs: 1000 * 8 bytes = 8.000 bytes lengths: 1000 * 4 bytes = 4.000 bytes Total: ~20.000 bytes Esto excede PERF_MAX_TRACE_SIZE (8192 bytes), causando: ADVERTENCIA: CPU: 0 PID: 5497 en kernel/trace/trace_event_perf.c:405 búfer de perf no lo suficientemente grande, se querían 24620, se tienen 8192 Limitar los tres arrays dinámicos a 128 entradas usando min() en el cálculo del tamaño del array. Esto asegura que los arrays sean solo tan grandes como sea necesario (hasta el límite), evitando la asignación de memoria innecesaria para operaciones pequeñas mientras se previene el desbordamiento para las grandes. El tracepoint ahora registra los conteos completos de nents/ents y un indicador de truncamiento para que los usuarios puedan ver cuándo los datos han sido limitados. Cambios en v2: - Usar min(nents, DMA_TRACE_MAX_ENTRIES) para el dimensionamiento dinámico del array en lugar de la asignación fija de DMA_TRACE_MAX_ENTRIES (comentarios de Steven Rostedt) - Esto asigna solo lo necesario hasta el límite, evitando el desperdicio para operaciones pequeñas Revisado por: Sean Anderson
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-23390 changed 2026-05-11 | CVE Terms of Use |
| NVD | CVE-2026-23390 changed 2026-06-17 | Public domain |