mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: n3rd <18670333770@163.com>
Cc: "linux-trace-kernel@vger.kernel.org"
	<linux-trace-kernel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	"security@kernel.org" <security@kernel.org>
Subject: Re: [SECURITY] tracing: splice(2) trace_pipe peek outside the access lock
Date: Wed, 11 Nov 2026 01:40:46 -0500	[thread overview]
Message-ID: <20261111014046.07a658bd@fedora> (raw)
In-Reply-To: <6bc59ae6.bbe98.1a1c54ca872.Coremail.18670333770@163.com>

On Tue, 10 Nov 2026 19:51:37 +0800 (GMT+08:00)
n3rd <18670333770@163.com> wrote:

> 4. Conditions
> Requires local root to write

Here you state that it requires local root to exploit.

> /sys/kernel/tracing/buffer_subbuf_size_kb and trace_marker and to
> read trace_pipe, tracefs mounted, and at least two CPUs so that the
> order change and the splice reader really run concurrently. The order
> change is what frees the page; a splice(2) reader without concurrent
> order changes does not trigger it. CONFIG_TRACING=y is required for
> the tracefs files and CONFIG_KASAN=y makes the read visible as a
> KASAN report; without KASAN the read is silent. Tested on x86_64
> only, with QEMU TCG and two vCPUs.
> 


> 
> 6. Suggested fix
> Move the trace_find_next_entry_inc() call in
> tracing_splice_read_pipe() below trace_event_read_lock() and
> trace_access_lock(), matching tracing_read_pipe(), so that the peek
> is covered by the same RING_BUFFER_ALL_CPUS access lock that
> serializes ring_buffer_subbuf_order_set(). Alternatively copy the
> event out while the reader lock is held, the way rb_iter_head_event()
> does. No upstream patch exists as of v7.3-rc7.

Feel free to send a patch.

> 
> 
> 7. Mitigation
> Restrict write access to tracefs to trusted processes and avoid
> changing buffer_subbuf_size_kb while trace_pipe is being read with
> splice(2). This reduces exposure but does not fix the root cause.

Now you state the mitigation in to only allow access to tracefs to
trusted processes, which as you stated above, is the default.

This is *not* a security bug. Please continue this conversation in the
linux-trace-kernel. mailing list.

Thanks,

-- Steve

           reply	other threads:[~2026-11-11  6:40 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <6bc59ae6.bbe98.1a1c54ca872.Coremail.18670333770@163.com>]

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=20261111014046.07a658bd@fedora \
    --to=rostedt@goodmis.org \
    --cc=18670333770@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.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

all inboxes | Powered by JetHome®