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 7B2BB146019 for ; Mon, 29 Jul 2024 15:49:38 +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=1722268178; cv=none; b=SEeAcPe5QPfZqm98wbKizpgq9GnYMfdkniZ9JFeiT8L5UTV2Ljmcr0Kob3sph6qiZfraLculyj/ds0eTvPNdth/f4r4znt3xNJHbcnnVO3YJ0iVd30qLodXGmH/c2PQTU5pj8HXrx2kgyulrRfrLemW0BM2pa8bUO0GEhwaUCaA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722268178; c=relaxed/simple; bh=uDvdUJpMByD94xiRGFMvYm9thT3nI3sD5wuSjeGXjlM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rpJqmkfCEsn3rSM5iR3b9s7qI1f9w097HN+PkhE6zDpoJIfTuqN419Y3VRWZi3Cah0ot5ZxGkfnO/q6UAnvxK+/jAs3KjI9BF1FHvA+v9IWwnRiswzrz6GnyKHrIxEJiWwlTXyH3MqcJ9xBJgejxf2UPDL9CwB6n69M8v29KCdE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Y7P261a7; 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="Y7P261a7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3C7EC32786; Mon, 29 Jul 2024 15:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722268178; bh=uDvdUJpMByD94xiRGFMvYm9thT3nI3sD5wuSjeGXjlM=; h=From:To:Cc:Subject:Date:Reply-to:From; b=Y7P261a7YWXVB49dSx/YxDzuIpJTE/F25BSqx08hZBSuHLhHeIb6NnVj0I5KaH1hP xrRYQ9ViYvrpaNKtGD1bIe6ph2KVdqA+lC3p5lfAg1nTHpdhe1qsa9tDMHhV9y4HHB bfKJKjK+kmiFPfrAwjSwSPdZyZ14ZNajtC3ZPUio= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-41092: drm/i915/gt: Fix potential UAF by revoke of fence registers Date: Mon, 29 Jul 2024 17:48:54 +0200 Message-ID: <2024072953-CVE-2024-41092-8bd7@gregkh> X-Mailer: git-send-email 2.45.2 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=5275; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=uDvdUJpMByD94xiRGFMvYm9thT3nI3sD5wuSjeGXjlM=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnLdz71OhTdMV03x2n9Wrtdd+YfrKtvMd6xdfX1U0ycD WcU2P/+6IhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJyNowzJV3r5XNfSUu/nRz fef3r3M5VrguE2GYK9q1TarJ9EVK5K+2Fd4yBW8vdljPBgA= 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: drm/i915/gt: Fix potential UAF by revoke of fence registers CI has been sporadically reporting the following issue triggered by igt@i915_selftest@live@hangcheck on ADL-P and similar machines: <6> [414.049203] i915: Running intel_hangcheck_live_selftests/igt_reset_evict_fence ... <6> [414.068804] i915 0000:00:02.0: [drm] GT0: GUC: submission enabled <6> [414.068812] i915 0000:00:02.0: [drm] GT0: GUC: SLPC enabled <3> [414.070354] Unable to pin Y-tiled fence; err:-4 <3> [414.071282] i915_vma_revoke_fence:301 GEM_BUG_ON(!i915_active_is_idle(&fence->active)) ... <4>[ 609.603992] ------------[ cut here ]------------ <2>[ 609.603995] kernel BUG at drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c:301! <4>[ 609.604003] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI <4>[ 609.604006] CPU: 0 PID: 268 Comm: kworker/u64:3 Tainted: G U W 6.9.0-CI_DRM_14785-g1ba62f8cea9c+ #1 <4>[ 609.604008] Hardware name: Intel Corporation Alder Lake Client Platform/AlderLake-P DDR4 RVP, BIOS RPLPFWI1.R00.4035.A00.2301200723 01/20/2023 <4>[ 609.604010] Workqueue: i915 __i915_gem_free_work [i915] <4>[ 609.604149] RIP: 0010:i915_vma_revoke_fence+0x187/0x1f0 [i915] ... <4>[ 609.604271] Call Trace: <4>[ 609.604273] ... <4>[ 609.604716] __i915_vma_evict+0x2e9/0x550 [i915] <4>[ 609.604852] __i915_vma_unbind+0x7c/0x160 [i915] <4>[ 609.604977] force_unbind+0x24/0xa0 [i915] <4>[ 609.605098] i915_vma_destroy+0x2f/0xa0 [i915] <4>[ 609.605210] __i915_gem_object_pages_fini+0x51/0x2f0 [i915] <4>[ 609.605330] __i915_gem_free_objects.isra.0+0x6a/0xc0 [i915] <4>[ 609.605440] process_scheduled_works+0x351/0x690 ... In the past, there were similar failures reported by CI from other IGT tests, observed on other platforms. Before commit 63baf4f3d587 ("drm/i915/gt: Only wait for GPU activity before unbinding a GGTT fence"), i915_vma_revoke_fence() was waiting for idleness of vma->active via fence_update(). That commit introduced vma->fence->active in order for the fence_update() to be able to wait selectively on that one instead of vma->active since only idleness of fence registers was needed. But then, another commit 0d86ee35097a ("drm/i915/gt: Make fence revocation unequivocal") replaced the call to fence_update() in i915_vma_revoke_fence() with only fence_write(), and also added that GEM_BUG_ON(!i915_active_is_idle(&fence->active)) in front. No justification was provided on why we might then expect idleness of vma->fence->active without first waiting on it. The issue can be potentially caused by a race among revocation of fence registers on one side and sequential execution of signal callbacks invoked on completion of a request that was using them on the other, still processed in parallel to revocation of those fence registers. Fix it by waiting for idleness of vma->fence->active in i915_vma_revoke_fence(). (cherry picked from commit 24bb052d3dd499c5956abad5f7d8e4fd07da7fb1) The Linux kernel CVE team has assigned CVE-2024-41092 to this issue. Affected and fixed versions =========================== Issue introduced in 5.8 with commit 0d86ee35097a and fixed in 5.10.221 with commit f771b91f21c4 Issue introduced in 5.8 with commit 0d86ee35097a and fixed in 5.15.162 with commit 29c0fdf49078 Issue introduced in 5.8 with commit 0d86ee35097a and fixed in 6.1.97 with commit ca0fabd365a2 Issue introduced in 5.8 with commit 0d86ee35097a and fixed in 6.6.37 with commit 06dec31a0a51 Issue introduced in 5.8 with commit 0d86ee35097a and fixed in 6.9.8 with commit 414f4a31f7a8 Issue introduced in 5.8 with commit 0d86ee35097a and fixed in 6.10 with commit 996c3412a065 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-41092 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/gpu/drm/i915/gt/intel_ggtt_fencing.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/f771b91f21c46ad1217328d05e72a2c7e3add535 https://git.kernel.org/stable/c/29c0fdf49078ab161570d3d1c6e13d66f182717d https://git.kernel.org/stable/c/ca0fabd365a27a94a36e68a7a02df8ff3c13dac6 https://git.kernel.org/stable/c/06dec31a0a5112a91f49085e8a8fa1a82296d5c7 https://git.kernel.org/stable/c/414f4a31f7a811008fd9a33b06216b060bad18fc https://git.kernel.org/stable/c/996c3412a06578e9d779a16b9e79ace18125ab50