public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Pengpeng Hou <pengpeng@iscas.ac.cn>,
	rostedt@goodmis.org, mathieu.desnoyers@efficios.com,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] tracing/probe: reject empty immediate strings
Date: Mon, 6 Apr 2026 10:20:19 +0900	[thread overview]
Message-ID: <20260406102019.8a73535655f62e12c1479d62@kernel.org> (raw)
In-Reply-To: <20260406101124.e4e5af12634fb1136cd7d132@kernel.org>

On Mon, 6 Apr 2026 10:11:24 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:

> Hi,
> 
> On Sat, 4 Apr 2026 09:33:59 +0900
> Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> 
> > > diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> > > index e0a5dc86c07e..e1c73065dae5 100644
> > > --- a/kernel/trace/trace_probe.c
> > > +++ b/kernel/trace/trace_probe.c
> > > @@ -1068,7 +1068,7 @@ static int __parse_imm_string(char *str, char **pbuf, int offs)
> > >  {
> > >  	size_t len = strlen(str);
> > >  
> > > -	if (str[len - 1] != '"') {
> 
> It seems that this is not correct fix, because __parse_imm_string()
> is only called from below code:
> 
> 	case '\\':	/* Immediate value */
> 		if (arg[1] == '"') {	/* Immediate string */
> 			ret = __parse_imm_string(arg + 2, &tmp, ctx->offset + 2);
> 			if (ret)
> 
> Thus the call-site already checked the double-quotation.
> This means this if block itself is meaningless.

Nevermind, this fix is correct. But the title is not correct because
we still can specify an empty string (\""), but this rejects non-closed
empty immediate string (\").

Thank you,


> 
> Thanks,
> 
> > > +	if (!len || str[len - 1] != '"') {
> > >  		trace_probe_log_err(offs + len, IMMSTR_NO_CLOSE);
> > >  		return -EINVAL;
> > >  	}
> > > -- 
> > > 2.50.1 (Apple Git-155)
> > > 
> > 
> > 
> > -- 
> > Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> 
> -- 
> Masami Hiramatsu (Google) <mhiramat@kernel.org>


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2026-04-06  1:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30  6:29 [PATCH 1/4] tracing/probe: reject empty immediate strings Pengpeng Hou
2026-04-01 16:03 ` [PATCH v2] " Pengpeng Hou
2026-04-01 17:00   ` Steven Rostedt
2026-04-04  0:33   ` Masami Hiramatsu
2026-04-06  1:11     ` Masami Hiramatsu
2026-04-06  1:20       ` Masami Hiramatsu [this message]
2026-04-06  1:24   ` Masami Hiramatsu
2026-04-06  8:20   ` Pengpeng Hou

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=20260406102019.8a73535655f62e12c1479d62@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=pengpeng@iscas.ac.cn \
    --cc=rostedt@goodmis.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