Linux Trace Kernel
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Haoran Wang <haoranwangsec@gmail.com>
Cc: rostedt@goodmis.org, mhiramat@kernel.org,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	mathieu.desnoyers@efficios.com, security@kernel.org
Subject: Re: [BUG] tracing: __copy_from_user without access_ok leaks kernel memory in syscall fault tracing
Date: Thu, 15 Oct 2026 10:44:26 +0200	[thread overview]
Message-ID: <2026101539-rinse-refocus-8203@gregkh> (raw)
In-Reply-To: <6ad07a3c.6e2bf4e6.f29cc.dd67@mx.google.com>

On Thu, Oct 15, 2026 at 03:01:08PM +0800, Haoran Wang wrote:
> I'd like to report an issue in kernel/trace/trace_syscalls.c:686 (function
> syscall_copy_user_array), found via static analysis of Linux 7.0.11 and
> verified against the 7.2.10 source tree. I have reproduced the leak on an
> 7.2.10 kernel.

Cool, but you forgot to also provide a working patch for this?

> 1. Summary
> The "syscall fault tracing" feature (added in 7.0, CONFIG_FTRACE_SYSCALLS)
> treats the raw syscall argument args[1] (the buffer pointer) of faultable
> syscalls (write/pwrite64/ mq_timedsend) as a user address and copies it
> with __copy_from_user(buf, args[1], size) without an access_ok() check.
> When a traced process calls write(fd, <kernel address>, count), the
> sys_enter tracepoint fires before vfs_write's access_ok and
> __copy_from_user copies up to 165 bytes from that kernel address into the
> per-CPU trace buffer, which is appended to the sys_enter_write event and
> readable from /sys/kernel/tracing/trace. The write() itself then returns
> EFAULT, but the leak is already complete. copy_from_user() would have
> rejected a kernel address via access_ok(); __copy_from_user() does not.

This is root-only, so there's no security issue really, right?  Or am I
mistaken?

thanks,

greg k-h

      reply	other threads:[~2026-10-15  8:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  7:01 [BUG] tracing: __copy_from_user without access_ok leaks kernel memory in syscall fault tracing Haoran Wang
2026-10-15  8:44 ` Greg KH [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=2026101539-rinse-refocus-8203@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=haoranwangsec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=security@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