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 28AA2170A11 for ; Wed, 18 Jun 2025 11:08:47 +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=1750244927; cv=none; b=UhBaTTMrqy8Y+eBBYg/jVkwAUnAMwDCnf1Z85DJJQJM8M6P/q7KPMGZHwLx9ofw1A+kW9m794HQzAedJDO11vAcgpMqA5ouf5XrKuMQAjAHTokqqHuegIgpRE6tGxjXfowpGKQZVKR/jRQQwVej3l6QomXqglTLclnPhLL5XnVQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244927; c=relaxed/simple; bh=S9pdxoCYMXgXs7QaSvVt1V5GilFtmbF6yCkhmVzYN78=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=b4CiqCDsXvRZssGlx4DGnhnfhIZkJWb4gbl/MyJwVpM9wnT48EYuLN6ehlWlwCbHZIl3ArDS9ISaszR9Q6nit6zZJDRxAe/X1elSoiB8OylLJAvSsBmQ/wenL6lGDf5D1Cx7L9SndI6bkv7MSw1872hXEVPD1UKDADeV2cT2fIU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OGEj6ddS; 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="OGEj6ddS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E5DFC4CEE7; Wed, 18 Jun 2025 11:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750244927; bh=S9pdxoCYMXgXs7QaSvVt1V5GilFtmbF6yCkhmVzYN78=; h=From:To:Cc:Subject:Date:Reply-to:From; b=OGEj6ddSPFA7dWesY5EPidVpsb5FX86SIQtbPraeAc9zEmGPGIRJVikHil8ouiUHD zJIYHouW7NPvPsm0ihI7onDD2sEuafMQS/bLB+hzC51u3W1so5s/1RRDH2HYmT048i oOdc3guqHJeTVpnT9+LH7kCsaU8TGXKUmYjFMVDs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50078: tracing/eprobes: Do not allow eprobes to use $stack, or % for regs Date: Wed, 18 Jun 2025 13:02:23 +0200 Message-ID: <2025061855-CVE-2022-50078-54e5@gregkh> X-Mailer: git-send-email 2.49.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=4377; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=t6LvbXCqMttH1eyquo+UEUtEubIT3+gRRXRyK/9Kchk=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlBczKMPcP59sdEbGI9dKBC/5jnhoPx/DGrV5qoZ/7mV 82aO7WiI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACayyYVhfknyS4UvZzd3vJW5 q7/CMVhjL/cOU4YFR0qUn272/S7U4HszolB94dSQi+/CAQ== 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: tracing/eprobes: Do not allow eprobes to use $stack, or % for regs While playing with event probes (eprobes), I tried to see what would happen if I attempted to retrieve the instruction pointer (%rip) knowing that event probes do not use pt_regs. The result was: BUG: kernel NULL pointer dereference, address: 0000000000000024 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 1 PID: 1847 Comm: trace-cmd Not tainted 5.19.0-rc5-test+ #309 Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v03.03 07/14/2016 RIP: 0010:get_event_field.isra.0+0x0/0x50 Code: ff 48 c7 c7 c0 8f 74 a1 e8 3d 8b f5 ff e8 88 09 f6 ff 4c 89 e7 e8 50 6a 13 00 48 89 ef 5b 5d 41 5c 41 5d e9 42 6a 13 00 66 90 <48> 63 47 24 8b 57 2c 48 01 c6 8b 47 28 83 f8 02 74 0e 83 f8 04 74 RSP: 0018:ffff916c394bbaf0 EFLAGS: 00010086 RAX: ffff916c854041d8 RBX: ffff916c8d9fbf50 RCX: ffff916c255d2000 RDX: 0000000000000000 RSI: ffff916c255d2008 RDI: 0000000000000000 RBP: 0000000000000000 R08: ffff916c3a2a0c08 R09: ffff916c394bbda8 R10: 0000000000000000 R11: 0000000000000000 R12: ffff916c854041d8 R13: ffff916c854041b0 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff916c9ea40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000024 CR3: 000000011b60a002 CR4: 00000000001706e0 Call Trace: get_eprobe_size+0xb4/0x640 ? __mod_node_page_state+0x72/0xc0 __eprobe_trace_func+0x59/0x1a0 ? __mod_lruvec_page_state+0xaa/0x1b0 ? page_remove_file_rmap+0x14/0x230 ? page_remove_rmap+0xda/0x170 event_triggers_call+0x52/0xe0 trace_event_buffer_commit+0x18f/0x240 trace_event_raw_event_sched_wakeup_template+0x7a/0xb0 try_to_wake_up+0x260/0x4c0 __wake_up_common+0x80/0x180 __wake_up_common_lock+0x7c/0xc0 do_notify_parent+0x1c9/0x2a0 exit_notify+0x1a9/0x220 do_exit+0x2ba/0x450 do_group_exit+0x2d/0x90 __x64_sys_exit_group+0x14/0x20 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Obviously this is not the desired result. Move the testing for TPARG_FL_TPOINT which is only used for event probes to the top of the "$" variable check, as all the other variables are not used for event probes. Also add a check in the register parsing "%" to fail if an event probe is used. The Linux kernel CVE team has assigned CVE-2022-50078 to this issue. Affected and fixed versions =========================== Issue introduced in 5.15 with commit 7491e2c442781a1860181adb5ab472a52075f393 and fixed in 5.15.63 with commit ba53c21ce9773743b8e0a8ada048c96ff2d55c67 Issue introduced in 5.15 with commit 7491e2c442781a1860181adb5ab472a52075f393 and fixed in 5.19.4 with commit 7c262114a576d94c0ced80e232bbb17391a55908 Issue introduced in 5.15 with commit 7491e2c442781a1860181adb5ab472a52075f393 and fixed in 6.0 with commit 2673c60ee67e71f2ebe34386e62d348f71edee47 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-50078 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: kernel/trace/trace_probe.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/ba53c21ce9773743b8e0a8ada048c96ff2d55c67 https://git.kernel.org/stable/c/7c262114a576d94c0ced80e232bbb17391a55908 https://git.kernel.org/stable/c/2673c60ee67e71f2ebe34386e62d348f71edee47