| From bippy-5f407fcff5a0 Mon Sep 17 00:00:00 2001 |
| From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| To: <linux-cve-announce@vger.kernel.org> |
| Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org> |
| Subject: CVE-2024-57874: arm64: ptrace: fix partial SETREGSET for NT_ARM_TAGGED_ADDR_CTRL |
| |
| Description |
| =========== |
| |
| In the Linux kernel, the following vulnerability has been resolved: |
| |
| arm64: ptrace: fix partial SETREGSET for NT_ARM_TAGGED_ADDR_CTRL |
| |
| Currently tagged_addr_ctrl_set() doesn't initialize the temporary 'ctrl' |
| variable, and a SETREGSET call with a length of zero will leave this |
| uninitialized. Consequently tagged_addr_ctrl_set() will consume an |
| arbitrary value, potentially leaking up to 64 bits of memory from the |
| kernel stack. The read is limited to a specific slot on the stack, and |
| the issue does not provide a write mechanism. |
| |
| As set_tagged_addr_ctrl() only accepts values where bits [63:4] zero and |
| rejects other values, a partial SETREGSET attempt will randomly succeed |
| or fail depending on the value of the uninitialized value, and the |
| exposure is significantly limited. |
| |
| Fix this by initializing the temporary value before copying the regset |
| from userspace, as for other regsets (e.g. NT_PRSTATUS, NT_PRFPREG, |
| NT_ARM_SYSTEM_CALL). In the case of a zero-length write, the existing |
| value of the tagged address ctrl will be retained. |
| |
| The NT_ARM_TAGGED_ADDR_CTRL regset is only visible in the |
| user_aarch64_view used by a native AArch64 task to manipulate another |
| native AArch64 task. As get_tagged_addr_ctrl() only returns an error |
| value when called for a compat task, tagged_addr_ctrl_get() and |
| tagged_addr_ctrl_set() should never observe an error value from |
| get_tagged_addr_ctrl(). Add a WARN_ON_ONCE() to both to indicate that |
| such an error would be unexpected, and error handlnig is not missing in |
| either case. |
| |
| The Linux kernel CVE team has assigned CVE-2024-57874 to this issue. |
| |
| |
| Affected and fixed versions |
| =========================== |
| |
| Issue introduced in 5.10 with commit 2200aa7154cb7ef76bac93e98326883ba64bfa2e and fixed in 5.10.231 with commit 1152dd13845efde5554f80c7e1233bae1d26bd3e |
| Issue introduced in 5.10 with commit 2200aa7154cb7ef76bac93e98326883ba64bfa2e and fixed in 5.15.174 with commit 1c176f5155ee6161fee6f416b64aa50394d3f220 |
| Issue introduced in 5.10 with commit 2200aa7154cb7ef76bac93e98326883ba64bfa2e and fixed in 6.1.120 with commit 1370cf3eb5495d70e00547598583a4cd45b40b99 |
| Issue introduced in 5.10 with commit 2200aa7154cb7ef76bac93e98326883ba64bfa2e and fixed in 6.6.66 with commit 96035c0093db258975b8887676afe59a64c34a72 |
| Issue introduced in 5.10 with commit 2200aa7154cb7ef76bac93e98326883ba64bfa2e and fixed in 6.12.5 with commit abd614bbfcee73247495bd9472da8f85ac83546e |
| Issue introduced in 5.10 with commit 2200aa7154cb7ef76bac93e98326883ba64bfa2e and fixed in 6.13 with commit ca62d90085f4af36de745883faab9f8a7cbb45d3 |
| |
| 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-57874 |
| 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: |
| arch/arm64/kernel/ptrace.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/1152dd13845efde5554f80c7e1233bae1d26bd3e |
| https://git.kernel.org/stable/c/1c176f5155ee6161fee6f416b64aa50394d3f220 |
| https://git.kernel.org/stable/c/1370cf3eb5495d70e00547598583a4cd45b40b99 |
| https://git.kernel.org/stable/c/96035c0093db258975b8887676afe59a64c34a72 |
| https://git.kernel.org/stable/c/abd614bbfcee73247495bd9472da8f85ac83546e |
| https://git.kernel.org/stable/c/ca62d90085f4af36de745883faab9f8a7cbb45d3 |