linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Jianlin Lv <Jianlin.Lv@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"oleg@redhat.com" <oleg@redhat.com>
Subject: Re: [PATCH v2] tracing: precise log info for kretprobe addr err
Date: Sun, 24 Jan 2021 17:52:31 +0900	[thread overview]
Message-ID: <20210124175231.fed85eccade5dbe0240b5c3b@kernel.org> (raw)
In-Reply-To: <AM6PR08MB3589CB4AB4EC3ADBBB45144C98BF0@AM6PR08MB3589.eurprd08.prod.outlook.com>

Hi Jianlin,

On Sat, 23 Jan 2021 14:21:48 +0000
Jianlin Lv <Jianlin.Lv@arm.com> wrote:

> Regarding the UPROBES, I read the code of trace_uprobe_create() and  found a place for improvement.
> 
> diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> index 3cf7128e1ad3..8c81f04d7755 100644
> --- a/kernel/trace/trace_uprobe.c
> +++ b/kernel/trace/trace_uprobe.c
> @@ -567,16 +567,18 @@ static int trace_uprobe_create(int argc, const char **argv)
>         if (!filename)
>                 return -ENOMEM;
> 
> +       trace_probe_log_init("trace_uprobe", argc, argv);
> +       trace_probe_log_set_index(1);   /* filename is the 2nd argument */
> +
>         /* Find the last occurrence, in case the path contains ':' too. */
>         arg = strrchr(filename, ':');
>         if (!arg || !isdigit(arg[1])) {
> +               trace_probe_log_err(arg + 1 - filename, BAD_UPROBE_OFFS);
>                 kfree(filename);
> -               return -ECANCELED;
> +               ret = -EINVAL;
> +               goto out;

Sorry, it's not a bug, but an expected behavior, because this is checking
routine which identify the passed command is mine (uprobe event definition)
or others (e.g. kprobe event definition).

Note that the dyn_event_operations::create operator will be used from
dyn_event, which passes the command string from TRACEFS/dynamic_events
to each create operator and check the return is -ECANCELED.
The -ECANCELED is not an error, it means "it is not mine, but maybe others."
See create_dyn_event(int argc, char **argv) in kernel/trace/trace_dynevent.c.

Thank you,

-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2021-01-24  8:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 15:56 [PATCH v2] tracing: precise log info for kretprobe addr err Jianlin Lv
2021-01-20 16:20 ` Steven Rostedt
2021-01-21  2:28   ` Masami Hiramatsu
2021-01-23 14:21     ` Jianlin Lv
2021-01-24  8:52       ` Masami Hiramatsu [this message]
2021-01-25  3:14         ` Jianlin Lv
2021-01-25 14:42           ` Steven Rostedt

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=20210124175231.fed85eccade5dbe0240b5c3b@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=Jianlin.Lv@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --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).