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 156634122C for ; Sat, 2 Mar 2024 21:54:40 +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=1709416480; cv=none; b=pZUSGJh/+rQdZygIAzwWPs2O8aPJSWA9Sj7k7mus5hTuewNUjx11tozoMlDZhfM7tmEilLRw4EbDQQGyVDtT7ZsOzkJKfV4lDcxNxo8lZ9wVt7bPNQl2q6HQnyt9IribD+rU1Bo7wxrY05idAvacTbWgz8mJh/D/+2VuqmyxEKk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709416480; c=relaxed/simple; bh=+GBLmskA/LNyinXNhOF5vL8x3hY+taz7oNUqviq657w=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TkzzWPH1HOFZv+MuVYhM8NYJOSTM1fDcp2F1WEOJb1YUs/D2NnxUwGGnQ8sOrjK0oF237ClRec1mBi7nZZWnVnYc1eLwI63eDRkyDs2XWiNFWj1XcIcZER/Sbfa6W2ptkAL+x3HBnGtkSfUdg4XxYecv03GPFTmXxdh1UvwF4pk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Qwlkq1mI; 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="Qwlkq1mI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85FAEC433C7; Sat, 2 Mar 2024 21:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709416479; bh=+GBLmskA/LNyinXNhOF5vL8x3hY+taz7oNUqviq657w=; h=From:To:Cc:Subject:Date:Reply-to:From; b=Qwlkq1mIfaGMpreTrnBdPfnjOP4vTF+SEl5nDao4dmofpRHS3bwcfah941wqDA85E AWcKjKv2VuWpSYmxb7551JDSIAlMGQf/Jd76gHFIGP0l9N2YbQz/d5wu44g6eph3Ka +oaQCdy0FNk809/L4AKs0mYAYZ0Rlw3PJLvwlrFY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-52503: tee: amdtee: fix use-after-free vulnerability in amdtee_close_session Date: Sat, 2 Mar 2024 22:52:48 +0100 Message-ID: <2024030248-CVE-2023-52503-cb3a@gregkh> X-Mailer: git-send-email 2.44.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=2964; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=+GBLmskA/LNyinXNhOF5vL8x3hY+taz7oNUqviq657w=; b=owGbwMvMwCRo6H6F97bub03G02pJDKmP52/Q0umsu79a8LbbKp4ocfUf1znde6/vKKnvuRjgF zQ/VmpyRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzkQDvDLGahf3s8vvYKqTHn PbfKeREx76iIEsM8q+tfjQUelWdfm7g/4pSKIr/Opjt1AA== 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: tee: amdtee: fix use-after-free vulnerability in amdtee_close_session There is a potential race condition in amdtee_close_session that may cause use-after-free in amdtee_open_session. For instance, if a session has refcount == 1, and one thread tries to free this session via: kref_put(&sess->refcount, destroy_session); the reference count will get decremented, and the next step would be to call destroy_session(). However, if in another thread, amdtee_open_session() is called before destroy_session() has completed execution, alloc_session() may return 'sess' that will be freed up later in destroy_session() leading to use-after-free in amdtee_open_session. To fix this issue, treat decrement of sess->refcount and removal of 'sess' from session list in destroy_session() as a critical section, so that it is executed atomically. The Linux kernel CVE team has assigned CVE-2023-52503 to this issue. Affected and fixed versions =========================== Issue introduced in 5.6 with commit 757cc3e9ff1d and fixed in 5.10.199 with commit da7ce52a2f6c Issue introduced in 5.6 with commit 757cc3e9ff1d and fixed in 5.15.136 with commit 1680c82929bc Issue introduced in 5.6 with commit 757cc3e9ff1d and fixed in 6.1.59 with commit 60c3e7a00db9 Issue introduced in 5.6 with commit 757cc3e9ff1d and fixed in 6.5.8 with commit 1c95574350cd Issue introduced in 5.6 with commit 757cc3e9ff1d and fixed in 6.6 with commit f4384b3e54ea Please see https://www.kernel.org or 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-2023-52503 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/tee/amdtee/core.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/da7ce52a2f6c468946195b116615297d3d113a27 https://git.kernel.org/stable/c/1680c82929bc14d706065f123dab77f2f1293116 https://git.kernel.org/stable/c/60c3e7a00db954947c265b55099c21b216f2a05c https://git.kernel.org/stable/c/1c95574350cd63bc3c5c2fa06658010768f2a0ce https://git.kernel.org/stable/c/f4384b3e54ea813868bb81a861bf5b2406e15d8f