From: Steven Rostedt <rostedt@goodmis.org>
To: Kyle Zeng <kylebot@openai.com>
Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
mhiramat@kernel.org, outbounddisclosures@openai.com,
stable@vger.kernel.org
Subject: Re: [PATCH] tracing: Validate user addresses in faultable buffer copies
Date: Mon, 9 Nov 2026 03:36:01 -0500 [thread overview]
Message-ID: <20261109033601.0cfeb51a@fedora> (raw)
In-Reply-To: <20261006225221.54513-1-kylebot@openai.com>
On Tue, 6 Oct 2026 15:52:21 -0700
Kyle Zeng <kylebot@openai.com> wrote:
> Syscall entry tracing runs before the syscall implementation validates
> its arguments. For a size-bearing user argument,
> syscall_copy_user_array() passes the register-supplied pointer directly
> to __copy_from_user(), which assumes the user address has already been
> checked. On x86-64 this can copy mapped kernel memory into the raw event.
> An unprivileged task can open a task-bound sys_enter_write perf event at
> perf_event_paranoid=2 and disclose that memory with a write() that even
> fails with EBADF.
>
> Use copy_from_user() for each actual array pointer. Use it in the default
> trace_user_fault_read() path as well: the original syscall-array tracing
> implementation used that path, and the helper is documented to use
> copy_from_user(). Keep the existing length limits and per-argument fault
> handling, so valid user data is recorded as before and failed copies do
> not contribute bytes to the event.
>
> Fixes: b4f7624cfc94 ("tracing: Have system call events record user array data")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:gpt-6-astra
> Signed-off-by: Kyle Zeng <kylebot@openai.com>
> ---
> kernel/trace/trace.c | 2 +-
> kernel/trace/trace_syscalls.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index e4a490d3d08c..07acbc44d99c 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -6263,7 +6263,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();
> diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
> index e35744049e3f..d9190fdc030d 100644
> --- a/kernel/trace/trace_syscalls.c
> +++ b/kernel/trace/trace_syscalls.c
> @@ -683,7 +683,7 @@ static int syscall_copy_user_array(char *buf, const char __user *ptr,
>
> for (int i = 0; i < args->uargs; i++, buf += SYSCALL_FAULT_ARG_SZ) {
> ptr = (char __user *)args->ptr_array[i];
> - ret = __copy_from_user(buf, ptr, size);
> + ret = copy_from_user(buf, ptr, size);
This was fixed by:
097fd0050089d ("tracing/syscalls: Use copy_from_user for the faultable syscall buffer")
as I missed your patch. But the other one still needs to be updated.
Care to send a v2 that just updates the trace.c file?
Thanks,
-- Steve
> args->read[i] = ret ? -1 : size;
> }
> return 0;
prev parent reply other threads:[~2026-11-09 8:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 22:52 Kyle Zeng
2026-11-09 8:36 ` Steven Rostedt [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=20261109033601.0cfeb51a@fedora \
--to=rostedt@goodmis.org \
--cc=kylebot@openai.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=outbounddisclosures@openai.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®