From mboxrd@z Thu Jan 1 00:00:00 1970 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 7325219E97F for ; Wed, 26 Feb 2025 02:15:18 +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=1740536118; cv=none; b=bPHI4FUVkTr1q9kovKGDwHLzXCVxf5Fn9/bGHM7/LnY1TaP/c4aCsFhJO/mHcXOFaG3V7IbDa9S2YOVNrmcgKskYZnuxeeJuiotpplBl/A3A5CIcPDk4kq+dJu+2ooocvRKMpKD9+e7iKIbHUmioflJEANV4LyaWOYq/xZWFojo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740536118; c=relaxed/simple; bh=BnOAtWMJ5LGE8lb7XdLOYKQMqkd8hhpiRvJsTAYs31c=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=k7sXIeeGNEZlTSTBCubYx24lnYJaAcLYHftvvvm25hxfS0fUxP1+kgZlAcG/BsFQS12T5FqIBMVB/L+w1u9e8ubE5O9iLQY/vhKhRuV4yDYBWdeMLBD2aia/QUqiBS9FdrO1x8OrO/Rf71/8TH07Q04rwL3YY/2qDi5kCQ25B5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uAn0bFDg; 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="uAn0bFDg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49C16C4CEDD; Wed, 26 Feb 2025 02:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740536118; bh=BnOAtWMJ5LGE8lb7XdLOYKQMqkd8hhpiRvJsTAYs31c=; h=From:To:Cc:Subject:Date:Reply-to:From; b=uAn0bFDgE6HZuO5kOpwBVmXLig6AgoVrg5L8xaT76WsnAwDHkgXxwQQGsuT3va4A2 klwjzaf2q80H/4+7SlMiitHyEK+N1KZDxkfLqzOJZ5v6ccGAZf8BZBXRaAg6wpPmCw PWh9+PP4bJ2YivO/WPL7VJZ1EnIkBGzfg0YQ6ego= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49520: arm64: compat: Do not treat syscall number as ESR_ELx for a bad syscall Date: Wed, 26 Feb 2025 03:13:14 +0100 Message-ID: <2025022611-CVE-2022-49520-465c@gregkh> X-Mailer: git-send-email 2.48.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=4530; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=BnOAtWMJ5LGE8lb7XdLOYKQMqkd8hhpiRvJsTAYs31c=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7KpiXB8dekkqObzKQCNy2zZrtcdfUounv1QOOCU2yU tyyWcK3I5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACaSs41hrsg+9o9R/+XDLf0k s4+1Tl+g7b58J8P8rAefmOdxbC3dncC6zPDd9216UzaLAgA= 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: arm64: compat: Do not treat syscall number as ESR_ELx for a bad syscall If a compat process tries to execute an unknown system call above the __ARM_NR_COMPAT_END number, the kernel sends a SIGILL signal to the offending process. Information about the error is printed to dmesg in compat_arm_syscall() -> arm64_notify_die() -> arm64_force_sig_fault() -> arm64_show_signal(). arm64_show_signal() interprets a non-zero value for current->thread.fault_code as an exception syndrome and displays the message associated with the ESR_ELx.EC field (bits 31:26). current->thread.fault_code is set in compat_arm_syscall() -> arm64_notify_die() with the bad syscall number instead of a valid ESR_ELx value. This means that the ESR_ELx.EC field has the value that the user set for the syscall number and the kernel can end up printing bogus exception messages*. For example, for the syscall number 0x68000000, which evaluates to ESR_ELx.EC value of 0x1A (ESR_ELx_EC_FPAC) the kernel prints this error: [ 18.349161] syscall[300]: unhandled exception: ERET/ERETAA/ERETAB, ESR 0x68000000, Oops - bad compat syscall(2) in syscall[10000+50000] [ 18.350639] CPU: 2 PID: 300 Comm: syscall Not tainted 5.18.0-rc1 #79 [ 18.351249] Hardware name: Pine64 RockPro64 v2.0 (DT) [..] which is misleading, as the bad compat syscall has nothing to do with pointer authentication. Stop arm64_show_signal() from printing exception syndrome information by having compat_arm_syscall() set the ESR_ELx value to 0, as it has no meaning for an invalid system call number. The example above now becomes: [ 19.935275] syscall[301]: unhandled exception: Oops - bad compat syscall(2) in syscall[10000+50000] [ 19.936124] CPU: 1 PID: 301 Comm: syscall Not tainted 5.18.0-rc1-00005-g7e08006d4102 #80 [ 19.936894] Hardware name: Pine64 RockPro64 v2.0 (DT) [..] which although shows less information because the syscall number, wrongfully advertised as the ESR value, is missing, it is better than showing plainly wrong information. The syscall number can be easily obtained with strace. *A 32-bit value above or equal to 0x8000_0000 is interpreted as a negative integer in compat_arm_syscal() and the condition scno < __ARM_NR_COMPAT_END evaluates to true; the syscall will exit to userspace in this case with the ENOSYS error code instead of arm64_notify_die() being called. The Linux kernel CVE team has assigned CVE-2022-49520 to this issue. Affected and fixed versions =========================== Fixed in 5.4.198 with commit efd183d988b416fcdf6f7c298a17ced4859ca77d Fixed in 5.10.121 with commit ad97425d23af3c3b8d4f6a2bb666cb485087c007 Fixed in 5.15.46 with commit 621916afe8cd4f322eb12759b64a2f938d4e551d Fixed in 5.17.14 with commit 095e975f8150ccd7f852eb578c1cdbdd2f517c7a Fixed in 5.18.3 with commit 3910ae71cb963fa2b68e684489d4fc3d105afda0 Fixed in 5.19 with commit 3fed9e551417b84038b15117732ea4505eee386b 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-2022-49520 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/sys_compat.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/efd183d988b416fcdf6f7c298a17ced4859ca77d https://git.kernel.org/stable/c/ad97425d23af3c3b8d4f6a2bb666cb485087c007 https://git.kernel.org/stable/c/621916afe8cd4f322eb12759b64a2f938d4e551d https://git.kernel.org/stable/c/095e975f8150ccd7f852eb578c1cdbdd2f517c7a https://git.kernel.org/stable/c/3910ae71cb963fa2b68e684489d4fc3d105afda0 https://git.kernel.org/stable/c/3fed9e551417b84038b15117732ea4505eee386b