mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pengpeng Hou <pengpeng@iscas.ac.cn>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [GIT PULL] probes: Fixes for v7.0-rc7
Date: Sat, 11 Apr 2026 20:27:59 +0900	[thread overview]
Message-ID: <20260411202759.13a90fec3c05b399acdcabba@kernel.org> (raw)

Hi Linus,

Probes fixes for v7.0-rc7

- tracing/probe: reject non-closed empty immediate strings
  Fixed a buffer index underflow bug that occurred when passing an
  non-closed empty immediate string to the probe event.


Please pull the latest probes-fixes-v7.0-rc7 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
probes-fixes-v7.0-rc7

Tag SHA1: 0c7333fa2ead5a8cd9bbd9825fd034eecf23fb70
Head SHA1: 4346be6577aaa04586167402ae87bbdbe32484a4


Pengpeng Hou (1):
      tracing/probe: reject non-closed empty immediate strings

----
 kernel/trace/trace_probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---------------------------
commit 4346be6577aaa04586167402ae87bbdbe32484a4
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
Date:   Thu Apr 2 00:03:15 2026 +0800

    tracing/probe: reject non-closed empty immediate strings
    
    parse_probe_arg() accepts quoted immediate strings and passes the body
    after the opening quote to __parse_imm_string(). That helper currently
    computes strlen(str) and immediately dereferences str[len - 1], which
    underflows when the body is empty and not closed with double-quotation.
    
    Reject empty non-closed immediate strings before checking for the closing quote.
    
    Link: https://lore.kernel.org/all/20260401160315.88518-1-pengpeng@iscas.ac.cn/
    
    Fixes: a42e3c4de964 ("tracing/probe: Add immediate string parameter support")
    Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
    Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

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] != '"') {
+	if (!len || str[len - 1] != '"') {
 		trace_probe_log_err(offs + len, IMMSTR_NO_CLOSE);
 		return -EINVAL;
 	}

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

             reply	other threads:[~2026-04-11 11:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-11 11:27 Masami Hiramatsu [this message]
2026-04-11 19:59 ` pr-tracker-bot

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=20260411202759.13a90fec3c05b399acdcabba@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pengpeng@iscas.ac.cn \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.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®