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: Steven Rostedt <rostedt@goodmis.org>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	linux-trace-kernel@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] tracing/probes: Fix to exit fetching if an error is detected
Date: Fri, 7 Jul 2023 16:07:49 +0900	[thread overview]
Message-ID: <20230707160749.0dcf02cf0b7ee9e0ded2816e@kernel.org> (raw)
In-Reply-To: <168830924625.2278819.7022958622963157629.stgit@mhiramat.roam.corp.google.com>

On Sun,  2 Jul 2023 23:47:26 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Fix to exit fetching arguments if an error is detected when storing
> strings. Without this fix, if an array is specified with string types
> it may store the data at the wrong address.
> 
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/8819b154-2ba1-43c3-98a2-cbde20892023@moroto.mountain/
> Fixes: 9b960a38835f ("tracing: probeevent: Unify fetch_insn processing common part")
> Cc: stable@vger.kernel.org
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>  kernel/trace/trace_probe_tmpl.h |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h
> index 4735c5cb76fa..d6f2bf69f9bc 100644
> --- a/kernel/trace/trace_probe_tmpl.h
> +++ b/kernel/trace/trace_probe_tmpl.h
> @@ -193,6 +193,8 @@ process_fetch_insn_bottom(struct fetch_insn *code, unsigned long val,
>  	default:
>  		return -EILSEQ;
>  	}
> +	if (ret < 0)
> +		return ret;

I found this will leave a garbage data on the trace data if we are in the array.
Let me fix this issue.
(-EILSEQ case has another issue. I think it should not be recorded)

Thank you,

>  	code++;
>  
>  	/* 4th stage: modify stored value if needed */
> 


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

  reply	other threads:[~2023-07-07  7:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-02 14:47 [PATCH 0/3] tracing/probes: Fix bugs in process_fetch_insn Masami Hiramatsu (Google)
2023-07-02 14:47 ` [PATCH 1/3] tracing/probes: Fix to avoid double count of the string length on the array Masami Hiramatsu (Google)
     [not found]   ` <25bd757c-f929-0153-4c94-f0502c5d1005@web.de>
2023-07-03  8:21     ` Masami Hiramatsu
2023-07-02 14:47 ` [PATCH 2/3] tracing/probes: Fix to exit fetching if an error is detected Masami Hiramatsu (Google)
2023-07-07  7:07   ` Masami Hiramatsu [this message]
2023-07-02 14:47 ` [PATCH 3/3] tracing/probes: Fix return value when "(fault)" is injected Masami Hiramatsu (Google)
2023-07-06  2:49   ` Steven Rostedt
2023-07-06  4:40     ` Masami Hiramatsu
2023-07-06 13:50       ` Steven Rostedt
2023-07-07  2:02         ` Masami Hiramatsu
2023-07-07  2:20           ` Steven Rostedt
2023-07-07  2:51             ` Masami Hiramatsu
2023-07-07  3:06               ` Steven Rostedt
2023-07-07  6:54                 ` Masami Hiramatsu

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=20230707160749.0dcf02cf0b7ee9e0ded2816e@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --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