Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4C3F200B8A for ; Wed, 16 Apr 2025 14:16:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744813019; cv=none; b=AvTv6sjwPfr3eyHgPe7K/ocOsJeSlKhCprp/+wa8sLb8gsQDJHApuaU7VdExQPxjLvT9NGWFCrRf2nzQ9zWIPyTJnVHJsncvCxgFYprDQvdWxTtw44NB9QsAh8siJI/jMVKDbpZ6q9qC/K117n8DX1yB7nncbPEV9kljRySeNHU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744813019; c=relaxed/simple; bh=f5g/Q0oG3c0GCo5jqLBF4gOYK74XHzjGKn1SIe6dcyc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Oppru0cPVqGzs6cZYn/hewGj+Qr4CVM+iE1mYtsdCtKmT2b6ZYTL9gydwRu++9UAzBOK+NSNesy0Xh0ww/jtESaaHJoneZESKIKmHtQQeR6udcXqduIxXCC+2PE/polPdpJmdAWQGzDhRfn7a+pmRGdKs1h8M2D8gLMUp418tcY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZEVtIvsN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ZEVtIvsN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCD34C4CEE2; Wed, 16 Apr 2025 14:16:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744813019; bh=f5g/Q0oG3c0GCo5jqLBF4gOYK74XHzjGKn1SIe6dcyc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=ZEVtIvsN6pX4Q91ZssPiLUmKv5k0AAFueDoXXem1pum2OsF6g1+PZy9392Iv99Ior T15Nekw86k0b+twvX9ZcFgAEjBU4PEjByBYuljIX2PecT4ccZ2pt265mf+lBhAeGi2 nGRqMbYkmI7bxgM0dQ5++3dr3Eu+kSrqO3K68rqE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-22091: RDMA/mlx5: Fix page_size variable overflow Date: Wed, 16 Apr 2025 16:13:02 +0200 Message-ID: <2025041617-CVE-2025-22091-462d@gregkh> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=5657; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=f5g/Q0oG3c0GCo5jqLBF4gOYK74XHzjGKn1SIe6dcyc=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn/dx08/XxBa+/VBU7v8wrWFdZGnyjNy+ty5ZZLrWz6r GU67dCyjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhI43eG+cE1wsc2zAtRq7qS zSGcW2A3p+mxCsOCS/ezrh+cMlN8sX/AawM3h3mXjeY3AQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: RDMA/mlx5: Fix page_size variable overflow Change all variables storing mlx5_umem_mkc_find_best_pgsz() result to unsigned long to support values larger than 31 and avoid overflow. For example: If we try to register 4GB of memory that is contiguous in physical memory, the driver will optimize the page_size and try to use an mkey with 4GB entity size. The 'unsigned int' page_size variable will overflow to '0' and we'll hit the WARN_ON() in alloc_cacheable_mr(). WARNING: CPU: 2 PID: 1203 at drivers/infiniband/hw/mlx5/mr.c:1124 alloc_cacheable_mr+0x22/0x580 [mlx5_ib] Modules linked in: mlx5_ib mlx5_core bonding ip6_gre ip6_tunnel tunnel6 ip_gre gre rdma_rxe rdma_ucm ib_uverbs ib_ipoib ib_umad rpcrdma ib_iser libiscsi scsi_transport_iscsi rdma_cm iw_cm ib_cm fuse ib_core [last unloaded: mlx5_core] CPU: 2 UID: 70878 PID: 1203 Comm: rdma_resource_l Tainted: G W 6.14.0-rc4-dirty #43 Tainted: [W]=WARN Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:alloc_cacheable_mr+0x22/0x580 [mlx5_ib] Code: 90 90 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 41 55 41 54 41 52 53 48 83 ec 30 f6 46 28 04 4c 8b 77 08 75 21 <0f> 0b 49 c7 c2 ea ff ff ff 48 8d 65 d0 4c 89 d0 5b 41 5a 41 5c 41 RSP: 0018:ffffc900006ffac8 EFLAGS: 00010246 RAX: 0000000004c0d0d0 RBX: ffff888217a22000 RCX: 0000000000100001 RDX: 00007fb7ac480000 RSI: ffff8882037b1240 RDI: ffff8882046f0600 RBP: ffffc900006ffb28 R08: 0000000000000001 R09: 0000000000000000 R10: 00000000000007e0 R11: ffffea0008011d40 R12: ffff8882037b1240 R13: ffff8882046f0600 R14: ffff888217a22000 R15: ffffc900006ffe00 FS: 00007fb7ed013340(0000) GS:ffff88885fd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fb7ed1d8000 CR3: 00000001fd8f6006 CR4: 0000000000772eb0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: ? __warn+0x81/0x130 ? alloc_cacheable_mr+0x22/0x580 [mlx5_ib] ? report_bug+0xfc/0x1e0 ? handle_bug+0x55/0x90 ? exc_invalid_op+0x17/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? alloc_cacheable_mr+0x22/0x580 [mlx5_ib] create_real_mr+0x54/0x150 [mlx5_ib] ib_uverbs_reg_mr+0x17f/0x2a0 [ib_uverbs] ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0xca/0x140 [ib_uverbs] ib_uverbs_run_method+0x6d0/0x780 [ib_uverbs] ? __pfx_ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x10/0x10 [ib_uverbs] ib_uverbs_cmd_verbs+0x19b/0x360 [ib_uverbs] ? walk_system_ram_range+0x79/0xd0 ? ___pte_offset_map+0x1b/0x110 ? __pte_offset_map_lock+0x80/0x100 ib_uverbs_ioctl+0xac/0x110 [ib_uverbs] __x64_sys_ioctl+0x94/0xb0 do_syscall_64+0x50/0x110 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7fb7ecf0737b Code: ff ff ff 85 c0 79 9b 49 c7 c4 ff ff ff ff 5b 5d 4c 89 e0 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 7d 2a 0f 00 f7 d8 64 89 01 48 RSP: 002b:00007ffdbe03ecc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007ffdbe03edb8 RCX: 00007fb7ecf0737b RDX: 00007ffdbe03eda0 RSI: 00000000c0181b01 RDI: 0000000000000003 RBP: 00007ffdbe03ed80 R08: 00007fb7ecc84010 R09: 00007ffdbe03eed4 R10: 0000000000000009 R11: 0000000000000246 R12: 00007ffdbe03eed4 R13: 000000000000000c R14: 000000000000000c R15: 00007fb7ecc84150 The Linux kernel CVE team has assigned CVE-2025-22091 to this issue. Affected and fixed versions =========================== Issue introduced in 6.12 with commit cef7dde8836ab09a3bfe96ada4f18ef2496eacc9 and fixed in 6.12.23 with commit 01fd737776ca0f17a96d83cd7f0840ce130b9a02 Issue introduced in 6.12 with commit cef7dde8836ab09a3bfe96ada4f18ef2496eacc9 and fixed in 6.13.11 with commit e0c09f639ca0e102f250df8787740c2013e9d1b3 Issue introduced in 6.12 with commit cef7dde8836ab09a3bfe96ada4f18ef2496eacc9 and fixed in 6.14.2 with commit 05b215d5e219c0228b9c7082ba9bcf176c576646 Issue introduced in 6.12 with commit cef7dde8836ab09a3bfe96ada4f18ef2496eacc9 and fixed in 6.15-rc1 with commit f0c2427412b43cdf1b7b0944749ea17ddb97d5a5 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2025-22091 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/infiniband/hw/mlx5/mr.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/01fd737776ca0f17a96d83cd7f0840ce130b9a02 https://git.kernel.org/stable/c/e0c09f639ca0e102f250df8787740c2013e9d1b3 https://git.kernel.org/stable/c/05b215d5e219c0228b9c7082ba9bcf176c576646 https://git.kernel.org/stable/c/f0c2427412b43cdf1b7b0944749ea17ddb97d5a5