From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
linux-trace-kernel@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] tracing/probes: Fix return value when "(fault)" is injected
Date: Thu, 6 Jul 2023 13:40:36 +0900 [thread overview]
Message-ID: <20230706134036.5c074aa5fc6a55cdb5038660@kernel.org> (raw)
In-Reply-To: <20230705224956.1c5213e6@gandalf.local.home>
On Wed, 5 Jul 2023 22:49:56 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Sun, 2 Jul 2023 23:47:35 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
>
> > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> >
> > When the "(fault)" is injected, the return value of fetch_store_string*()
> > should be the length of the "(fault)", but an error code is returned.
> > Fix it to return the correct length and update the data_loc according the
> > updated length.
> > This needs to update a ftracetest test case, which expects trace output
> > to appear as '(fault)' instead of '"(fault)"'.
> >
>
> Ah, because of patch 2, the ret < 0 makes it return without printing the
> "fault"?
No, actually set_data_loc() updates the 'ret' argument, but it is just
disposed... (not returned to the caller)
-static nokprobe_inline void set_data_loc(int ret, void *dest, void *__dest, void *base, int len)
+static nokprobe_inline int set_data_loc(int ret, void *dest, void *__dest, void *base, int len)
{
- if (ret >= 0) {
- *(u32 *)dest = make_data_loc(ret, __dest - base);
- } else {
+ if (ret < 0) {
strscpy(__dest, FAULT_STRING, len);
ret = strlen(__dest) + 1;
}
+
+ *(u32 *)dest = make_data_loc(ret, __dest - base);
+ return ret;
}
So this returns updated 'ret', and also update data_loc to use the
updated 'ret' value (which is the length of the stored data).
>
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Thank you!
>
> -- Steve
>
>
> > Fixes: 2e9906f84fc7 ("tracing: Add "(fault)" name injection to kernel probes")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > ---
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2023-07-06 4:40 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
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 [this message]
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=20230706134036.5c074aa5fc6a55cdb5038660@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;
as well as URLs for NNTP newsgroup(s).