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 A8C6E1F6687 for ; Fri, 27 Dec 2024 15:07:29 +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=1735312049; cv=none; b=VHXw4Rpb4PTc/2WQCxPmkd5eEfyED1Tp6S3uKOJc1F5WTUQrakB7nmrzTN3cEb9fjEg559dBD/W3bYpvrQj5LZgFvBc07cOdXvGEN6p2JZgxLLosjXfiarqj5H5buGN2mMXGHKXKaxTvy2yrDSE+ey7VFztF/mfo1hzLqSDYjfk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735312049; c=relaxed/simple; bh=1xaTQbrT8Zspav+tpDwJrEeqpVQQ8lc/MIXkF50z7w8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LhgHbvpPoVoOjPnkdaHBefu+ucezsI0vzMuWYPHZzTQWvfMeZiLU3Bu/YnumJ7IE9Rriry/cYH/umCw6QWEZnlx/jCkUZjRpMYmN6DctMu3md5ZAj3J44Os9UcC4spNe8BiawTiNW/HizyxOEJnw7//bjsgqAhWj7R8jAObIyGY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nIUsC4E4; 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="nIUsC4E4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A992C4CED6; Fri, 27 Dec 2024 15:07:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735312049; bh=1xaTQbrT8Zspav+tpDwJrEeqpVQQ8lc/MIXkF50z7w8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=nIUsC4E4BpoNO5Iw4mHkOnF254Iybq20pFjAZhHnRxjJ0Qioei72hCJh6I91lyreI /Wds6NSamExRMHFEzI6Ag1G8KIb/6HVYbT+tRxm/rhWTp1h87VkN+hEK9ILEFQxvxN KtfV5E5RC851Gt0B+rMKD9lECv1hql7Yboiq+CAU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-56668: iommu/vt-d: Fix qi_batch NULL pointer with nested parent domain Date: Fri, 27 Dec 2024 16:07:05 +0100 Message-ID: <2024122754-CVE-2024-56668-0d8d@gregkh> X-Mailer: git-send-email 2.47.1 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=3202; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=1xaTQbrT8Zspav+tpDwJrEeqpVQQ8lc/MIXkF50z7w8=; b=owGbwMvMwCRo6H6F97bub03G02pJDOl5h/qcat8+rcxR3nd/3omcd52MDFtnnP90aStn5pvqN Uu2nLDN64hlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJGLIzzFONPKfbmSwlHrno jeEGiRdHwuaWPWOYX2DL/lad1er+FUa9c5W1jN6SSss+AAA= 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: iommu/vt-d: Fix qi_batch NULL pointer with nested parent domain The qi_batch is allocated when assigning cache tag for a domain. While for nested parent domain, it is missed. Hence, when trying to map pages to the nested parent, NULL dereference occurred. Also, there is potential memleak since there is no lock around domain->qi_batch allocation. To solve it, add a helper for qi_batch allocation, and call it in both the __cache_tag_assign_domain() and __cache_tag_assign_parent_domain(). BUG: kernel NULL pointer dereference, address: 0000000000000200 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 8104795067 P4D 0 Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 223 UID: 0 PID: 4357 Comm: qemu-system-x86 Not tainted 6.13.0-rc1-00028-g4b50c3c3b998-dirty #2632 Call Trace: ? __die+0x24/0x70 ? page_fault_oops+0x80/0x150 ? do_user_addr_fault+0x63/0x7b0 ? exc_page_fault+0x7c/0x220 ? asm_exc_page_fault+0x26/0x30 ? cache_tag_flush_range_np+0x13c/0x260 intel_iommu_iotlb_sync_map+0x1a/0x30 iommu_map+0x61/0xf0 batch_to_domain+0x188/0x250 iopt_area_fill_domains+0x125/0x320 ? rcu_is_watching+0x11/0x50 iopt_map_pages+0x63/0x100 iopt_map_common.isra.0+0xa7/0x190 iopt_map_user_pages+0x6a/0x80 iommufd_ioas_map+0xcd/0x1d0 iommufd_fops_ioctl+0x118/0x1c0 __x64_sys_ioctl+0x93/0xc0 do_syscall_64+0x71/0x140 entry_SYSCALL_64_after_hwframe+0x76/0x7e The Linux kernel CVE team has assigned CVE-2024-56668 to this issue. Affected and fixed versions =========================== Issue introduced in 6.12 with commit 705c1cdf1e73c4c727bbfc8775434e6dd36e8baf and fixed in 6.12.6 with commit ffd774c34774fd4cc0e9cf2976595623a6c3a077 Issue introduced in 6.12 with commit 705c1cdf1e73c4c727bbfc8775434e6dd36e8baf and fixed in 6.13-rc3 with commit 74536f91962d5f6af0a42414773ce61e653c10ee 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-2024-56668 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/iommu/intel/cache.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/ffd774c34774fd4cc0e9cf2976595623a6c3a077 https://git.kernel.org/stable/c/74536f91962d5f6af0a42414773ce61e653c10ee