CVE-2025-39901

In the Linux kernel, the following vulnerability has been resolved: i40e: remove read access to debugfs files The 'command' and 'netdev_ops' debugfs files are a legacy debugging interface supported by the i40e driver since its early days by commit 02e9c290814c ("i40e: debugfs interface"). Both of these debugfs files provide a read handler which is mostly useless, and which is implemented with questionable logic. They both use a static 256 byte buffer which is initialized to the empty string. In the case of the 'command' file this buffer is literally never used and simply wastes space. In the case of the 'netdev_ops' file, the last command written is saved here. On read, the files contents are presented as the name of the device followed by a colon and then the contents of their respective static buffer. For 'command' this will always be "<device>: ". For 'netdev_ops', this will be "<device>: <last command written>". But note the buffer is shared between all devices operated by this module. At best, it is mostly meaningless information, and at worse it could be accessed simultaneously as there doesn't appear to be any locking mechanism. We have also recently received multiple reports for both read functions about their use of snprintf and potential overflow that could result in reading arbitrary kernel memory. For the 'command' file, this is definitely impossible, since the static buffer is always zero and never written to. For the 'netdev_ops' file, it does appear to be possible, if the user carefully crafts the command input, it will be copied into the buffer, which could be large enough to cause snprintf to truncate, which then causes the copy_to_user to read beyond the length of the buffer allocated by kzalloc. A minimal fix would be to replace snprintf() with scnprintf() which would cap the return to the number of bytes written, preventing an overflow. A more involved fix would be to drop the mostly useless static buffers, saving 512 bytes and modifying the read functions to stop needing those as input. Instead, lets just completely drop the read access to these files. These are debug interfaces exposed as part of debugfs, and I don't believe that dropping read access will break any script, as the provided output is pretty useless. You can find the netdev name through other more standard interfaces, and the 'netdev_ops' interface can easily result in garbage if you issue simultaneous writes to multiple devices at once. In order to properly remove the i40e_dbg_netdev_ops_buf, we need to refactor its write function to avoid using the static buffer. Instead, use the same logic as the i40e_dbg_command_write, with an allocated buffer. Update the code to use this instead of the static buffer, and ensure we free the buffer on exit. This fixes simultaneous writes to 'netdev_ops' on multiple devices, and allows us to remove the now unused static buffer along with removing the read access.
Configurations

Configuration 1 (hide)

OR cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.17:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.17:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.17:rc3:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.17:rc4:*:*:*:*:*:*

History

19 Oct 2026, 21:10

Type Values Removed Values Added
Summary
  • (es) En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: i40e: eliminar el acceso de lectura a los archivos debugfs Los archivos debugfs 'command' y 'netdev_ops' son una interfaz de depuración heredada soportada por el controlador i40e desde sus inicios por el commit 02e9c290814c ('i40e: debugfs interface'). Ambos archivos debugfs proporcionan un gestor de lectura que es mayormente inútil y que está implementado con lógica cuestionable. Ambos utilizan un búfer estático de 256 bytes que se inicializa a la cadena vacía. En el caso del archivo 'command', este búfer literalmente nunca se usa y simplemente desperdicia espacio. En el caso del archivo 'netdev_ops', el último comando escrito se guarda aquí. Al leer, el contenido de los archivos se presenta como el nombre del dispositivo seguido de dos puntos y luego el contenido de su respectivo búfer estático. Para 'command' esto siempre será '<device>: '. Para 'netdev_ops', esto será '<device>: <last command written>'. Pero tenga en cuenta que el búfer se comparte entre todos los dispositivos operados por este módulo. En el mejor de los casos, es información mayormente sin sentido, y en el peor de los casos, podría ser accedido simultáneamente ya que no parece haber ningún mecanismo de bloqueo. También hemos recibido recientemente múltiples informes para ambas funciones de lectura sobre su uso de snprintf y un posible desbordamiento que podría resultar en la lectura de memoria arbitraria del kernel. Para el archivo 'command', esto es definitivamente imposible, ya que el búfer estático siempre es cero y nunca se escribe en él. Para el archivo 'netdev_ops', sí parece ser posible, si el usuario elabora cuidadosamente la entrada del comando, se copiará en el búfer, que podría ser lo suficientemente grande como para causar que snprintf trunque, lo que luego hace que copy_to_user lea más allá de la longitud del búfer asignado por kzalloc. Una solución mínima sería reemplazar snprintf() con scnprintf(), lo que limitaría el retorno al número de bytes escritos, evitando un desbordamiento. Una solución más compleja sería eliminar los búferes estáticos mayormente inútiles, ahorrando 512 bytes y modificando las funciones de lectura para que dejen de necesitarlos como entrada. En su lugar, simplemente eliminemos completamente el acceso de lectura a estos archivos. Estas son interfaces de depuración expuestas como parte de debugfs, y no creo que eliminar el acceso de lectura rompa ningún script, ya que la salida proporcionada es bastante inútil. Se puede encontrar el nombre de netdev a través de otras interfaces más estándar, y la interfaz 'netdev_ops' puede fácilmente resultar en basura si se realizan escrituras simultáneas a múltiples dispositivos a la vez. Para eliminar correctamente el i40e_dbg_netdev_ops_buf, necesitamos refactorizar su función de escritura para evitar usar el búfer estático. En su lugar, use la misma lógica que i40e_dbg_command_write, con un búfer asignado. Actualice el código para usar esto en lugar del búfer estático, y asegúrese de liberar el búfer al salir. Esto corrige las escrituras simultáneas a 'netdev_ops' en múltiples dispositivos, y nos permite eliminar el búfer estático ahora sin usar junto con la eliminación del acceso de lectura.

Information

Published : 2025-10-01 08:15

Updated : 2026-10-19 21:10


NVD link : CVE-2025-39901

Mitre link : CVE-2025-39901

CVE.ORG link : CVE-2025-39901


JSON object : View

Products Affected

linux

  • linux_kernel
CWE
CWE-125

Out-of-bounds Read