From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Kyle Zeng <kylebot@openai.com>,
Steven Rostedt <rostedt@goodmis.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.18.y 2/2] tracing: Validate user addresses in faultable buffer copies
Date: Fri, 4 Dec 2026 07:04:43 -0500 [thread overview]
Message-ID: <20261204120418.2912195-2-sashal@kernel.org> (raw)
In-Reply-To: <20261204120418.2912195-1-sashal@kernel.org>
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit c62206dfe9c80490de8cc2d211fb28eea4958240 ]
trace_user_fault_read() uses __copy_from_user() when no custom copy
function is supplied. That primitive assumes the source address has
already been validated, but the helper only checks the destination
buffer size. A caller that passes an unchecked kernel address can
therefore cause mapped kernel memory to be copied into the tracing
buffer. The original syscall-array tracing implementation exposed this
path to syscall arguments before the syscall validated them.
Use copy_from_user() for the default copy as documented. Non-user
addresses then fail the copy and follow the existing NULL-return path.
Successful user copies, buffer bounds, and preemption and migration
retry rules are unchanged.
Cc: stable@vger.kernel.org
Fixes: 64cf7d058a005 ("tracing: Have trace_marker use per-cpu data to read user space")
Link: https://patch.msgid.link/20261110054411.75788-1-kylebot@openai.com
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 91251e41eff82..69db6ce1fb89e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7522,7 +7522,7 @@ char *trace_user_fault_read(struct trace_user_buf_info *tinfo,
if (copy_func) {
ret = copy_func(buffer, ptr, size, data);
} else {
- ret = __copy_from_user(buffer, ptr, size);
+ ret = copy_from_user(buffer, ptr, size);
}
preempt_disable_notrace();
--
2.53.0
prev parent reply other threads:[~2026-12-04 12:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 14:21 FAILED: patch "[PATCH] tracing: Validate user addresses in faultable buffer copies" failed to apply to 6.18-stable tree gregkh
2026-12-04 12:04 ` [PATCH 6.18.y 1/2] tracing: Make trace_user_fault_read() exposed to rest of tracing Sasha Levin
2026-12-04 12:04 ` Sasha Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204120418.2912195-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=kylebot@openai.com \
--cc=rostedt@goodmis.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.