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 C2BAA28C03D for ; Wed, 18 Jun 2025 11:10:54 +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=1750245054; cv=none; b=bf2FlAMMcQPvIkj52GK3dSer5VKQqhvN1Y0x94SesfxYfjZFHL0j+QG4wYHUjNsfzLUj7/3wCHQw6u8W1en+wlHqc+H3tHvzQ5fKusP3iUo7FCqz93xTskvQdD0khI07fQB+aruC8yKwWa6AKMmQ+w3oxVEMTiShELYgliSRgv4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750245054; c=relaxed/simple; bh=JjA3W9F33edGXyA0C11LJsOAOjns3OQ6ZByc67COLkU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pXgQGydZnqdpgPUG+L1GbPVE7juRsKUodwLHwazg39w2Px0pkv+1FP8hM04A2KQPmdyOKUFDJOkWX8N07RQE3g6G49dTpkkfYbFWjROvwloDJsBgycWye17LJXeKCOmJplFOqKA+eRCbWliW3KPRS7PDy8JMMyhHVNAMIWglef8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cOfOZx0d; 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="cOfOZx0d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A791C4CEE7; Wed, 18 Jun 2025 11:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750245054; bh=JjA3W9F33edGXyA0C11LJsOAOjns3OQ6ZByc67COLkU=; h=From:To:Cc:Subject:Date:Reply-to:From; b=cOfOZx0dr9c9kf2TjDKvV8/Yep8Gu61a5PlH4iObwVeCL6jOiVAUyNw6Ri7zVavGF WkT6UrTnYT74TwM2hg+vLhp+WCJ8pZrp+YzKQMd59jWl5YuikktEfGL0Tym0JalT9s Tg1smqbTAbXqfGnfGCA3znWZLuCFW8KQXvEf7jdo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50117: vfio: Split migration ops from main device ops Date: Wed, 18 Jun 2025 13:03:02 +0200 Message-ID: <2025061810-CVE-2022-50117-7322@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=2943; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=FqL4TQvJZDWxMbJC0VchbCXhctPkrZP8E2jLuZ6LO+M=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlBc8qmMpWViPmIdV3YzctWqRXt3TTnYezEdU+qfrpVL dHKNU7siGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgIkU32WYZ9FusnXeC6HMR9+W bOOqvvVUu8ljE8OCtcdYXm1i7ljKtubaDZ6jRwq+8K0yAAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: vfio: Split migration ops from main device ops vfio core checks whether the driver sets some migration op (e.g. set_state/get_state) and accordingly calls its op. However, currently mlx5 driver sets the above ops without regards to its migration caps. This might lead to unexpected usage/Oops if user space may call to the above ops even if the driver doesn't support migration. As for example, the migration state_mutex is not initialized in that case. The cleanest way to manage that seems to split the migration ops from the main device ops, this will let the driver setting them separately from the main ops when it's applicable. As part of that, validate ops construction on registration and include a check for VFIO_MIGRATION_STOP_COPY since the uAPI claims it must be set in migration_flags. HISI driver was changed as well to match this scheme. This scheme may enable down the road to come with some extra group of ops (e.g. DMA log) that can be set without regards to the other options based on driver caps. The Linux kernel CVE team has assigned CVE-2022-50117 to this issue. Affected and fixed versions =========================== Issue introduced in 5.18 with commit 6fadb021266d03c5fd7bca2cfa1607efd246dad1 and fixed in 5.19.2 with commit bba6b12d73d36e0ddbc2c3ac5668a667b00d4345 Issue introduced in 5.18 with commit 6fadb021266d03c5fd7bca2cfa1607efd246dad1 and fixed in 6.0 with commit 6e97eba8ad8748fabb795cffc5d9e1a7dcfd7367 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-2022-50117 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/vfio/pci/hisilicon/hisi_acc_vfio_pci.c drivers/vfio/pci/mlx5/cmd.c drivers/vfio/pci/mlx5/cmd.h drivers/vfio/pci/mlx5/main.c drivers/vfio/pci/vfio_pci_core.c drivers/vfio/vfio.c include/linux/vfio.h 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/bba6b12d73d36e0ddbc2c3ac5668a667b00d4345 https://git.kernel.org/stable/c/6e97eba8ad8748fabb795cffc5d9e1a7dcfd7367