Linux Trace Kernel
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: sashiko-reviews@lists.linux.dev
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v7 1/4] tracing: add __print_sym() to replace __print_symbolic()
Date: Mon, 28 Sep 2026 16:19:20 +0200	[thread overview]
Message-ID: <2f552b80cb4a88f52bf7df70a7766460f4fc1628.camel@sipsolutions.net> (raw)
In-Reply-To: <20260923111017.F17CD1F000FF@smtp.kernel.org>

On Wed, 2026-09-23 at 11:10 +0000, sashiko-bot@kernel.org wrote:
> > +#undef __print_sym
> > +#define __print_sym(value, symbol_id)	__print_sym(value:symbol_id)
> 
> [Severity: Medium]
> Does this delimiter choice in the __print_sym() macro in
> include/trace/stages/stage7_class_define.h cause issues for arbitrary C
> expressions?
> 
> This macro transforms the arguments into a string format using a delimiter (:)
> that is unsafe for arbitrary C expressions if parsed left-to-right. If a
> kernel developer uses an expression containing a colon (such as a ternary
> operator like a ? b : c) as the value argument, it seems the string
> representation will contain multiple colons.

[snip]


Technically, yes, but I think it's implausible to have a ternary for
printing a simple enum value *inside* the TP_printk(). You'd usually
want to store the result of the ternary via TP_fast_assign(), I'd think.

> Could a backward search for ':' from the closing parenthesis safely isolate
> the symbol ID?

Technically? But it'd be relatively more complicated, the code would
have to pre-parse to the end and we have seq_put() here etc.

I'm not convinced it's worth doing.

johannes

  reply	other threads:[~2026-09-28 14:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 11:08 [PATCH v7 0/4] tracing: improve symbolic printing Johannes Berg
2026-09-22 11:08 ` [PATCH v7 1/4] tracing: add __print_sym() to replace __print_symbolic() Johannes Berg
2026-09-23 11:10   ` sashiko-bot
2026-09-28 14:19     ` Johannes Berg [this message]
2026-09-22 11:08 ` [PATCH v7 2/4] tracing/timer: use __print_sym() Johannes Berg
2026-09-22 11:08 ` [PATCH v7 3/4] net: dropreason: use new __print_sym() in tracing Johannes Berg
2026-09-24 15:31   ` Ilya Maximets
2026-09-28 13:34   ` Aaron Conole
2026-09-22 11:08 ` [PATCH v7 4/4] net: drop_monitor: use drop_reason_lookup() Johannes Berg

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=2f552b80cb4a88f52bf7df70a7766460f4fc1628.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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