CVE-2024-26669

In the Linux kernel, the following vulnerability has been resolved: net/sched: flower: Fix chain template offload When a qdisc is deleted from a net device the stack instructs the underlying driver to remove its flow offload callback from the associated filter block using the 'FLOW_BLOCK_UNBIND' command. The stack then continues to replay the removal of the filters in the block for this driver by iterating over the chains in the block and invoking the 'reoffload' operation of the classifier being used. In turn, the classifier in its 'reoffload' operation prepares and emits a 'FLOW_CLS_DESTROY' command for each filter. However, the stack does not do the same for chain templates and the underlying driver never receives a 'FLOW_CLS_TMPLT_DESTROY' command when a qdisc is deleted. This results in a memory leak [1] which can be reproduced using [2]. Fix by introducing a 'tmplt_reoffload' operation and have the stack invoke it with the appropriate arguments as part of the replay. Implement the operation in the sole classifier that supports chain templates (flower) by emitting the 'FLOW_CLS_TMPLT_{CREATE,DESTROY}' command based on whether a flow offload callback is being bound to a filter block or being unbound from one. As far as I can tell, the issue happens since cited commit which reordered tcf_block_offload_unbind() before tcf_block_flush_all_chains() in __tcf_block_put(). The order cannot be reversed as the filter block is expected to be freed after flushing all the chains. [1] unreferenced object 0xffff888107e28800 (size 2048): comm "tc", pid 1079, jiffies 4294958525 (age 3074.287s) hex dump (first 32 bytes): b1 a6 7c 11 81 88 ff ff e0 5b b3 10 81 88 ff ff ..|......[...... 01 00 00 00 00 00 00 00 e0 aa b0 84 ff ff ff ff ................ backtrace: [<ffffffff81c06a68>] __kmem_cache_alloc_node+0x1e8/0x320 [<ffffffff81ab374e>] __kmalloc+0x4e/0x90 [<ffffffff832aec6d>] mlxsw_sp_acl_ruleset_get+0x34d/0x7a0 [<ffffffff832bc195>] mlxsw_sp_flower_tmplt_create+0x145/0x180 [<ffffffff832b2e1a>] mlxsw_sp_flow_block_cb+0x1ea/0x280 [<ffffffff83a10613>] tc_setup_cb_call+0x183/0x340 [<ffffffff83a9f85a>] fl_tmplt_create+0x3da/0x4c0 [<ffffffff83a22435>] tc_ctl_chain+0xa15/0x1170 [<ffffffff838a863c>] rtnetlink_rcv_msg+0x3cc/0xed0 [<ffffffff83ac87f0>] netlink_rcv_skb+0x170/0x440 [<ffffffff83ac6270>] netlink_unicast+0x540/0x820 [<ffffffff83ac6e28>] netlink_sendmsg+0x8d8/0xda0 [<ffffffff83793def>] ____sys_sendmsg+0x30f/0xa80 [<ffffffff8379d29a>] ___sys_sendmsg+0x13a/0x1e0 [<ffffffff8379d50c>] __sys_sendmsg+0x11c/0x1f0 [<ffffffff843b9ce0>] do_syscall_64+0x40/0xe0 unreferenced object 0xffff88816d2c0400 (size 1024): comm "tc", pid 1079, jiffies 4294958525 (age 3074.287s) hex dump (first 32 bytes): 40 00 00 00 00 00 00 00 57 f6 38 be 00 00 00 00 @.......W.8..... 10 04 2c 6d 81 88 ff ff 10 04 2c 6d 81 88 ff ff ..,m......,m.... backtrace: [<ffffffff81c06a68>] __kmem_cache_alloc_node+0x1e8/0x320 [<ffffffff81ab36c1>] __kmalloc_node+0x51/0x90 [<ffffffff81a8ed96>] kvmalloc_node+0xa6/0x1f0 [<ffffffff82827d03>] bucket_table_alloc.isra.0+0x83/0x460 [<ffffffff82828d2b>] rhashtable_init+0x43b/0x7c0 [<ffffffff832aed48>] mlxsw_sp_acl_ruleset_get+0x428/0x7a0 [<ffffffff832bc195>] mlxsw_sp_flower_tmplt_create+0x145/0x180 [<ffffffff832b2e1a>] mlxsw_sp_flow_block_cb+0x1ea/0x280 [<ffffffff83a10613>] tc_setup_cb_call+0x183/0x340 [<ffffffff83a9f85a>] fl_tmplt_create+0x3da/0x4c0 [<ffffffff83a22435>] tc_ctl_chain+0xa15/0x1170 [<ffffffff838a863c>] rtnetlink_rcv_msg+0x3cc/0xed0 [<ffffffff83ac87f0>] netlink_rcv_skb+0x170/0x440 [<ffffffff83ac6270>] netlink_unicast+0x540/0x820 [<ffffffff83ac6e28>] netlink_sendmsg+0x8d8/0xda0 [<ffffffff83793def>] ____sys_sendmsg+0x30f/0xa80 [2] # tc qdisc add dev swp1 clsact # tc chain add dev swp1 ingress proto ip chain 1 flower dst_ip 0.0.0.0/32 # tc qdisc del dev ---truncated---
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.8:rc1:*:*:*:*:*:*

History

17 Mar 2025, 15:04

Type Values Removed Values Added
References () https://git.kernel.org/stable/c/32f2a0afa95fae0d1ceec2ff06e0e816939964b8 - () https://git.kernel.org/stable/c/32f2a0afa95fae0d1ceec2ff06e0e816939964b8 - Patch
References () https://git.kernel.org/stable/c/9ed46144cff3598a5cf79955630e795ff9af5b97 - () https://git.kernel.org/stable/c/9ed46144cff3598a5cf79955630e795ff9af5b97 - Patch
References () https://git.kernel.org/stable/c/c04709b2cc99ae31c346f79f0211752d7b74df01 - () https://git.kernel.org/stable/c/c04709b2cc99ae31c346f79f0211752d7b74df01 - Patch
CVSS v2 : unknown
v3 : unknown
v2 : unknown
v3 : 7.1
First Time Linux linux Kernel
Linux
CWE CWE-787
CPE cpe:2.3:o:linux:linux_kernel:6.8:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*

21 Nov 2024, 09:02

Type Values Removed Values Added
References () https://git.kernel.org/stable/c/32f2a0afa95fae0d1ceec2ff06e0e816939964b8 - () https://git.kernel.org/stable/c/32f2a0afa95fae0d1ceec2ff06e0e816939964b8 -
References () https://git.kernel.org/stable/c/9ed46144cff3598a5cf79955630e795ff9af5b97 - () https://git.kernel.org/stable/c/9ed46144cff3598a5cf79955630e795ff9af5b97 -
References () https://git.kernel.org/stable/c/c04709b2cc99ae31c346f79f0211752d7b74df01 - () https://git.kernel.org/stable/c/c04709b2cc99ae31c346f79f0211752d7b74df01 -

02 Apr 2024, 12:50

Type Values Removed Values Added
Summary
  • (es) En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: net/sched: flower: descarga de plantilla de cadena fija Cuando se elimina una qdisc de un dispositivo de red, la pila indica al controlador subyacente que elimine su devolución de llamada de descarga de flujo del bloque de filtro asociado mediante el comando Comando 'FLOW_BLOCK_UNBIND'. Luego, la pila continúa reproduciendo la eliminación de los filtros en el bloque para este controlador iterando sobre las cadenas en el bloque e invocando la operación de "redescarga" del clasificador que se está utilizando. A su vez, el clasificador en su operación de 'redescarga' prepara y emite un comando 'FLOW_CLS_DESTROY' para cada filtro. Sin embargo, la pila no hace lo mismo con las plantillas de cadena y el controlador subyacente nunca recibe un comando 'FLOW_CLS_TMPLT_DESTROY' cuando se elimina una qdisc. Esto da como resultado una pérdida de memoria [1] que se puede reproducir usando [2]. Para solucionarlo, introduzca una operación 'tmplt_reoffload' y haga que la pila la invoque con los argumentos apropiados como parte de la reproducción. Implemente la operación en el único clasificador que admite plantillas de cadena (flor) emitiendo el comando 'FLOW_CLS_TMPLT_{CREATE,DESTROY}' en función de si una devolución de llamada de descarga de flujo está vinculada a un bloque de filtro o no está vinculada a uno. Por lo que puedo decir, el problema ocurre desde el commit que reordenó tcf_block_offload_unbind() antes de tcf_block_flush_all_chains() en __tcf_block_put(). El orden no se puede invertir ya que se espera que el bloque del filtro se libere después de lavar todas las cadenas. [1] objeto sin referencia 0xffff888107e28800 (tamaño 2048): comm "tc", pid 1079, jiffies 4294958525 (edad 3074.287s) volcado hexadecimal (primeros 32 bytes): b1 a6 7c 11 81 88 ff ff e0 5b b3 10 81 88 ff f ..|......[...... 01 00 00 00 00 00 00 00 e0 aa b0 84 ff ff ff ff ................ retroceso: [] __kmem_cache_alloc_node+0x1e8/0x320 [] __kmalloc+0x4e/0x90 [] mlxsw_sp_acl_ruleset_get+0x34d/0x7a0 [] mlxsw_sp_flower_tmplt_create+0x145/0x180 [] mlxsw_sp_flow_block_cb+0x1ea/0x280 [] tc_setup_cb_call+0x183/0x340 [] fl_tmplt_create+0x3da/0x4c0 [] tc_ctl_chain+0xa15/0x1170 [] rtnetlink_rcv_msg+0x3cc/0xed0 [] netlink_rcv_skb+0x170/0x440 [] netlink_unicast+0x540/0x820 [] netlink_sendmsg+0x8d8/0xda0 [] ____sys_sendmsg+0x30f/0xa80 [] ___sys_ enviarmsg+0x13a/0x1e0 [] __sys_sendmsg+0x11c/0x1f0 [] do_syscall_64+0x40/0xe0 objeto sin referencia 0xffff88816d2c0400 (tamaño 1024): comm "tc", pid 1079, santiamén 4294958525 (edad 3074.287s) volcado hexadecimal (primeros 32 bytes): 40 00 00 00 00 00 00 00 57 f6 38 be 00 00 00 00 @.......W.8..... 10 04 2c 6d 81 88 ff ff 10 04 2c 6d 81 88 ff ff ..,m......, m.... retroceso: [] __kmem_cache_alloc_node+0x1e8/0x320 [] __kmalloc_node+0x51/0x90 [] kvmalloc_node+0xa6/0x1f0 [] bucket_table_alloc.isra.0+0x83/ 0x460 [] rhashtable_init+0x43b/0x7c0 [] mlxsw_sp_acl_ruleset_get+0x428/0x7a0 [] mlxsw_sp_flower_tmplt_create+0x145/0x180 [] mlxsw_sp_flow_block_cb+0x1ea/0x280 [] tc_setup_cb_call+0x183/ 0x340 [] fl_tmplt_create+0x3da/0x4c0 [] tc_ctl_chain+0xa15/0x1170 [] rtnetlink_rcv_msg+0x3cc/0xed0 [] netlink_rcv_skb+0x170/0x440 [] netlink_unicast+0x540/ 0x820 [] netlink_sendmsg+0x8d8/0xda0 [] ____sys_sendmsg+0x30f/0xa80 [2] # ---truncado---

02 Apr 2024, 07:15

Type Values Removed Values Added
New CVE

Information

Published : 2024-04-02 07:15

Updated : 2025-03-17 15:04


NVD link : CVE-2024-26669

Mitre link : CVE-2024-26669

CVE.ORG link : CVE-2024-26669


JSON object : View

Products Affected

linux

  • linux_kernel
CWE
CWE-787

Out-of-bounds Write