mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Jianlin Lv <Jianlin.Lv@arm.com>, Oleg Nesterov <oleg@redhat.com>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing/kprobe: Fix to support kretprobe events on unloaded modules
Date: Thu, 28 Jan 2021 09:09:35 +0900	[thread overview]
Message-ID: <20210128090935.719ac21fbfa2b6cfc91dea9c@kernel.org> (raw)
In-Reply-To: <20210127172950.7911317a@gandalf.local.home>

On Wed, 27 Jan 2021 17:29:50 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Thu, 28 Jan 2021 00:37:51 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > Fix kprobe_on_func_entry() returns error code instead of false so that
> > register_kretprobe() can return an appropriate error code.
> > 
> > append_trace_kprobe() expects the kprobe registration returns -ENOENT
> > when the target symbol is not found, and it checks whether the target
> > module is unloaded or not. If the target module doesn't exist, it
> > defers to probe the target symbol until the module is loaded.
> > 
> > However, since register_kretprobe() returns -EINVAL instead of -ENOENT
> > in that case, it always fail on putting the kretprobe event on unloaded
> > modules. e.g.
> > 
> > Kprobe event:
> > /sys/kernel/debug/tracing # echo p xfs:xfs_end_io >> kprobe_events
> > [   16.515574] trace_kprobe: This probe might be able to register after target module is loaded. Continue.
> > 
> > Kretprobe event: (p -> r)
> > /sys/kernel/debug/tracing # echo r xfs:xfs_end_io >> kprobe_events
> > sh: write error: Invalid argument
> > /sys/kernel/debug/tracing # cat error_log
> > [   41.122514] trace_kprobe: error: Failed to register probe event
> >   Command: r xfs:xfs_end_io
> >              ^
> > 
> > To fix this bug, change kprobe_on_func_entry() to detect symbol lookup
> > failure and return -ENOENT in that case. Otherwise it returns -EINVAL
> > or 0 (succeeded, given address is on the entry).
> > 
> > Reported-by: Jianlin Lv <Jianlin.Lv@arm.com>
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> 
> Is this something that should go to stable? And if so, can you supply a
> Fixes tag?

Yes, I thought that had not supported previously, but that's wrong.
I found below commit introduced -ENOENT check in trace_kprobe side.

Fixes: 59158ec4aef7 ("tracing/kprobes: Check the probe on unloaded module correctly")

Thank you,


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2021-01-28  0:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27 15:37 Masami Hiramatsu
2021-01-27 22:29 ` Steven Rostedt
2021-01-28  0:09   ` Masami Hiramatsu [this message]
     [not found]     ` <AM6PR08MB3589FAFEE0CDE17DEC647FAC98B99@AM6PR08MB3589.eurprd08.prod.outlook.com>
     [not found]       ` <20210129224502.d0b293d0a4e0f18658d60957@kernel.org>
2021-01-30  2:07         ` Jianlin Lv

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=20210128090935.719ac21fbfa2b6cfc91dea9c@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

all inboxes | Powered by JetHome®