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 5DC5213DBBE for ; Fri, 13 Sep 2024 05:30:53 +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=1726205454; cv=none; b=h0TTZ1XN3YZ+GkUsEwpDD4DYT/Fh5hkHaFLV6hM1KzW0w6WgiBD8iM8uzTeN06FuOqg9P2WsYTFxGO27Kh1Lxw3wtKcA2SHdVl46jwWaMvkzzbMAaowh0GTYwCJdC11uv+Hv5fQphgfxXRWRHMix3ftIwHEEVkeNPZr1LmxsE/c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726205454; c=relaxed/simple; bh=Bkh5pScIB2aj7/CkYH01R/5Y84ihOLIQt7L52QVwot8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pcnYI7fZ8qcgoeEv62wOWrbXQTpd+lc3kO/kts4jUXvnpkAXH+p2KlAgxWFJG1QrJ5WoZpUNp6Lv/G+WrbeH5XGahBSEq3/ItiyxdilnlnrK5pk0jwqaxic8XjcZOmpdnm2LYA/WpiZjZZdSZrS9t9J2nMc7xw3+QAMODVPb81E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pEPOzdCQ; 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="pEPOzdCQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68E1FC4CEC0; Fri, 13 Sep 2024 05:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1726205453; bh=Bkh5pScIB2aj7/CkYH01R/5Y84ihOLIQt7L52QVwot8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=pEPOzdCQ/3kgzHbznHS5iP+011GaNUu7NKq5WO/ZU/NgY3kq2Mkf72ORjO10KmGbZ W1oNDTVv+xcc+avQHb5ZZYWWXiRTNuBSFn0cwL/JwsohOoAJvMVOKjWUeV1/BMwz+u exYq5gC8wwVQ8yT3wSXeXYJ9BNFN37AxtyXHzFP4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-46683: drm/xe: prevent UAF around preempt fence Date: Fri, 13 Sep 2024 07:30:44 +0200 Message-ID: <2024091337-CVE-2024-46683-e513@gregkh> X-Mailer: git-send-email 2.46.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=2912; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Bkh5pScIB2aj7/CkYH01R/5Y84ihOLIQt7L52QVwot8=; b=owGbwMvMwCRo6H6F97bub03G02pJDGmPz/49LbmMP6nlxruGwn0eW/bc4lxw+LZ+vN2tI+fe+ E/OTrfX64hlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJ+G5nWHBVcJKQbl7SH2aT sCMFi92UD5Y5HWGYK82wNynkkFRr1swGz2/7Ajd77gh8DgA= 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/xe: prevent UAF around preempt fence The fence lock is part of the queue, therefore in the current design anything locking the fence should then also hold a ref to the queue to prevent the queue from being freed. However, currently it looks like we signal the fence and then drop the queue ref, but if something is waiting on the fence, the waiter is kicked to wake up at some later point, where upon waking up it first grabs the lock before checking the fence state. But if we have already dropped the queue ref, then the lock might already be freed as part of the queue, leading to uaf. To prevent this, move the fence lock into the fence itself so we don't run into lifetime issues. Alternative might be to have device level lock, or only release the queue in the fence release callback, however that might require pushing to another worker to avoid locking issues. References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2454 References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2342 References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2020 (cherry picked from commit 7116c35aacedc38be6d15bd21b2fc936eed0008b) The Linux kernel CVE team has assigned CVE-2024-46683 to this issue. Affected and fixed versions =========================== Issue introduced in 6.8 with commit dd08ebf6c352 and fixed in 6.10.8 with commit 10081b0b0ed2 Issue introduced in 6.8 with commit dd08ebf6c352 and fixed in 6.11-rc5 with commit 730b72480e29 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-46683 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/xe/xe_exec_queue.c drivers/gpu/drm/xe/xe_exec_queue_types.h drivers/gpu/drm/xe/xe_preempt_fence.c drivers/gpu/drm/xe/xe_preempt_fence_types.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/10081b0b0ed201f53e24bd92deb2e0f3c3e713d4 https://git.kernel.org/stable/c/730b72480e29f63fd644f5fa57c9d46109428953