Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Kuyo Chang <kuyo.chang@mediatek.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Martin Kaiser <martin@kaiser.cx>, Vinod Koul <vkoul@kernel.org>,
	<stable@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-trace-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH 1/1] tracing: Fix UBSAN shift-out-of-bounds in test_event_printk()
Date: Wed, 25 Nov 2026 10:34:50 -0500	[thread overview]
Message-ID: <20261125103450.5ac2cb14@gandalf.local.home> (raw)
In-Reply-To: <20261125080431.1612026-1-kuyo.chang@mediatek.com>

On Wed, 25 Nov 2026 16:03:56 +0800
Kuyo Chang <kuyo.chang@mediatek.com> wrote:

> Commit b5cc230af5e5 ("tracing: Warn when an event dereferences a pointer
> in TP_printk()") removed the early return when dereference_flags is zero
> so that test_double_dereference() can check all event arguments.
> 
> As a result, trace events with more than 64 arguments in TP_printk() now
> always reach the argument-parsing loop and evaluate (1ULL << arg) when
> arg >= 64, triggering a UBSAN shift-out-of-bounds trap.
> 
> Additionally, in the format string parsing loop, the bounds check only
> tested 'arg == 63'. If the first 64 specifiers are non-pointer and
> non-string formats (e.g., %d) and a subsequent specifier (arg >= 64) is
> %s or %p*, 'arg == 63' evaluates to false and '1ULL << arg' also shifts
> out of bounds.
> 
> Fix both issues by changing the upper bound check to 'arg >= 63' and
> guarding the '(1ULL << arg)' checks in the argument loop with
> 'arg < 64'.
> 
> Fixes: b5cc230af5e5 ("tracing: Warn when an event dereferences a pointer in TP_printk()")
> Cc: stable@vger.kernel.org

I'll add this as a cleanup but I'm nuking the above tags. There is no event
with anywhere close to 64 args. These checks were simply a failsafe in case
they ever happened (which they likely will never do).

-- Steve

  reply	other threads:[~2026-11-25 15:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  8:03 [PATCH 1/1] tracing: Fix UBSAN shift-out-of-bounds in test_event_printk() Kuyo Chang
2026-11-25 15:34 ` Steven Rostedt [this message]
2026-11-25 15:36 ` Steven Rostedt

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=20261125103450.5ac2cb14@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=kuyo.chang@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=martin@kaiser.cx \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vkoul@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