[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210124175231.fed85eccade5dbe0240b5c3b@kernel.org>
Date: Sun, 24 Jan 2021 17:52:31 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Jianlin Lv <Jianlin.Lv@....com>
Cc: Steven Rostedt <rostedt@...dmis.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"oleg@...hat.com" <oleg@...hat.com>
Subject: Re: [PATCH v2] tracing: precise log info for kretprobe addr err
Hi Jianlin,
On Sat, 23 Jan 2021 14:21:48 +0000
Jianlin Lv <Jianlin.Lv@....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@...nel.org>
Powered by blists - more mailing lists