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 63B012F6581 for ; Wed, 22 Oct 2025 13:25:08 +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=1761139509; cv=none; b=IsshaKBxygNZxupy2za1wHLI+XkN/FLDF0D4NKZ8WF4x5+wa+jyy0kH8SCxzRgbWBdSqeMPVKuygivuZwHtaSABRIkxs4LlHdfy6NWAKcuZsVV5cUFpkbxBc42kfg3KNMffZloYWoRBO2usZ1bBKcdLWPt2SwPTQx+xGIYzeoJw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761139509; c=relaxed/simple; bh=v7E6iFjdlNu2feqth2dyJtkfbqzmdhxz9Mdqt2uOpms=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qPOXlCDOsuZ+G8k8dG0ovb8y6mgx8eNug4S1QIWHy8Tkk5yf//MmcTUDXL3HYUHa/K7kXNqxC1jX+DoQ1KVcLd/zlHSt0jSuOQirql5921WVDGDzNLvZiu7JBXM1GueJbXos19foP5nd05cZ84hJxgBLg1mexfu1knqnr2dFhTo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JWgL25Of; 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="JWgL25Of" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 872FFC4CEE7; Wed, 22 Oct 2025 13:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1761139507; bh=v7E6iFjdlNu2feqth2dyJtkfbqzmdhxz9Mdqt2uOpms=; h=From:To:Cc:Subject:Date:Reply-to:From; b=JWgL25Oft1PxI7PJlbxoR6II2tUoH4mfOZfD5lxPQXVRfXVUm4/0BWNu+hoPKhU0Z jOoKNfFzfx3agikvzAHQOVZl52S4r/VxEbPUyg6LFYyeQFZ35FWoka6GzIHJVkDORM MIypKu7uf0O+ZTTowI+kTvaxF2E0TqGyzC74Gq9E= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50579: arm64: ftrace: fix module PLTs with mcount Date: Wed, 22 Oct 2025 15:24:27 +0200 Message-ID: <2025102209-CVE-2022-50579-0f47@gregkh> X-Mailer: git-send-email 2.51.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=5648; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=vt6fuzFE9QIc0I4Bm43UECXG2Ju+/ZcLR/0Mjf0ewyw=; b=owGbwMvMwCRo6H6F97bub03G02pJDBk/bv2ck1xz9pzEDMWp88Mu21x5sjpNs/f+e9NfL/e53 Db1urMksyOWhUGQiUFWTJHlyzaeo/srDil6GdqehpnDygQyhIGLUwAmcn0+w1zxIzfSk/9/uvN8 wjHH7My5J9t26n9kmB82V7bk15mQ2pod+YcPGrBlSLdarQIA X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: arm64: ftrace: fix module PLTs with mcount Li Huafei reports that mcount-based ftrace with module PLTs was broken by commit: a6253579977e4c6f ("arm64: ftrace: consistently handle PLTs.") When a module PLTs are used and a module is loaded sufficiently far away from the kernel, we'll create PLTs for any branches which are out-of-range. These are separate from the special ftrace trampoline PLTs, which the module PLT code doesn't directly manipulate. When mcount is in use this is a problem, as each mcount callsite in a module will be initialized to point to a module PLT, but since commit a6253579977e4c6f ftrace_make_nop() will assume that the callsite has been initialized to point to the special ftrace trampoline PLT, and ftrace_find_callable_addr() rejects other cases. This means that when ftrace tries to initialize a callsite via ftrace_make_nop(), the call to ftrace_find_callable_addr() will find that the `_mcount` stub is out-of-range and is not handled by the ftrace PLT, resulting in a splat: | ftrace_test: loading out-of-tree module taints kernel. | ftrace: no module PLT for _mcount | ------------[ ftrace bug ]------------ | ftrace failed to modify | [] 0xffff800029180014 | actual: 44:00:00:94 | Initializing ftrace call sites | ftrace record flags: 2000000 | (0) | expected tramp: ffff80000802eb3c | ------------[ cut here ]------------ | WARNING: CPU: 3 PID: 157 at kernel/trace/ftrace.c:2120 ftrace_bug+0x94/0x270 | Modules linked in: | CPU: 3 PID: 157 Comm: insmod Tainted: G O 6.0.0-rc6-00151-gcd722513a189-dirty #22 | Hardware name: linux,dummy-virt (DT) | pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) | pc : ftrace_bug+0x94/0x270 | lr : ftrace_bug+0x21c/0x270 | sp : ffff80000b2bbaf0 | x29: ffff80000b2bbaf0 x28: 0000000000000000 x27: ffff0000c4d38000 | x26: 0000000000000001 x25: ffff800009d7e000 x24: ffff0000c4d86e00 | x23: 0000000002000000 x22: ffff80000a62b000 x21: ffff8000098ebea8 | x20: ffff0000c4d38000 x19: ffff80000aa24158 x18: ffffffffffffffff | x17: 0000000000000000 x16: 0a0d2d2d2d2d2d2d x15: ffff800009aa9118 | x14: 0000000000000000 x13: 6333626532303830 x12: 3030303866666666 | x11: 203a706d61727420 x10: 6465746365707865 x9 : 3362653230383030 | x8 : c0000000ffffefff x7 : 0000000000017fe8 x6 : 000000000000bff4 | x5 : 0000000000057fa8 x4 : 0000000000000000 x3 : 0000000000000001 | x2 : ad2cb14bb5438900 x1 : 0000000000000000 x0 : 0000000000000022 | Call trace: | ftrace_bug+0x94/0x270 | ftrace_process_locs+0x308/0x430 | ftrace_module_init+0x44/0x60 | load_module+0x15b4/0x1ce8 | __do_sys_init_module+0x1ec/0x238 | __arm64_sys_init_module+0x24/0x30 | invoke_syscall+0x54/0x118 | el0_svc_common.constprop.4+0x84/0x100 | do_el0_svc+0x3c/0xd0 | el0_svc+0x1c/0x50 | el0t_64_sync_handler+0x90/0xb8 | el0t_64_sync+0x15c/0x160 | ---[ end trace 0000000000000000 ]--- | ---------test_init----------- Fix this by reverting to the old behaviour of ignoring the old instruction when initialising an mcount callsite in a module, which was the behaviour prior to commit a6253579977e4c6f. The Linux kernel CVE team has assigned CVE-2022-50579 to this issue. Affected and fixed versions =========================== Issue introduced in 5.10.124 with commit bc28fde90937a920f7714ec4408269cac744f796 and fixed in 5.10.150 with commit 657de36c72f57fa172a66b06f826b3f5bc56f42e Issue introduced in 5.15.49 with commit db73aa9466338ec821ed2a0b01721fe4d06876b1 and fixed in 5.15.75 with commit 6c93b683cedaef745884cb9d554d02ed6266b897 Issue introduced in 5.19 with commit a6253579977e4c6f7818eeb05bf2bc65678a7187 and fixed in 5.19.17 with commit 0f77b6b2ba70d7c9d69ef39694e283ded9f8b5f2 Issue introduced in 5.19 with commit a6253579977e4c6f7818eeb05bf2bc65678a7187 and fixed in 6.0.3 with commit 985432303cf7d4804fb2c2fdfbf0466a796d68c3 Issue introduced in 5.19 with commit a6253579977e4c6f7818eeb05bf2bc65678a7187 and fixed in 6.1 with commit 8cfb08575c6d4585f1ce0deeb189e5c824776b04 Issue introduced in 5.18.6 with commit dcecc96ed16f73417de5550f384e348c9d56f279 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-50579 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/ftrace.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/657de36c72f57fa172a66b06f826b3f5bc56f42e https://git.kernel.org/stable/c/6c93b683cedaef745884cb9d554d02ed6266b897 https://git.kernel.org/stable/c/0f77b6b2ba70d7c9d69ef39694e283ded9f8b5f2 https://git.kernel.org/stable/c/985432303cf7d4804fb2c2fdfbf0466a796d68c3 https://git.kernel.org/stable/c/8cfb08575c6d4585f1ce0deeb189e5c824776b04