LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Anders Roxell <anders.roxell@linaro.org>,
	Ingo Molnar <mingo@kernel.org>,
	"Naveen N . Rao" <naveen.n.rao@linux.ibm.com>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	"David S . Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kprobes: Fix to init kprobes in subsys_initcall
Date: Wed, 5 Jun 2019 00:56:23 +0900	[thread overview]
Message-ID: <20190605005623.80198859f1f1e6695b3d3976@kernel.org> (raw)
In-Reply-To: <20190604050629.11c7ef12@oasis.local.home>

On Tue, 4 Jun 2019 05:06:29 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Mon,  3 Jun 2019 22:04:42 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > Since arm64 kernel initializes breakpoint trap vector in arch_initcall(),
> > initializing kprobe (and run smoke test) in postcore_initcall() causes
> > a kernel panic.
> > 
> > To fix this issue, move the kprobe initialization in subsys_initcall()
> > (which is called right afer the arch_initcall).
> > 
> > In-kernel kprobe users (ftrace and bpf) are using fs_initcall() which is
> > called after subsys_initcall(), so this shouldn't cause more problem.
> > 
> > Reported-by: Anders Roxell <anders.roxell@linaro.org>
> > Fixes: b5f8b32c93b2 ("kprobes: Initialize kprobes at postcore_initcall")
> 
> Hi Masami,
> 
> Is this really a fix, or is this just needed to add kprobes to the command line?

Hi Steve,

Yes, this is a real fix, not related to the kprobes command line feature.

First of all, the problem was that kprobes(module_init) was initialized
later than trace_kprobe(fs_initcall). the commit b5f8b32c93b2 is to solve
it. But I missed that the break-point hander initialization can be done 
in arch_initcall on some archs. This is fixing that bug.

Thank you,


> 
> -- Steve
> 
> 
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> >  kernel/kprobes.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> > index 54aaaad00a47..5471efbeb937 100644
> > --- a/kernel/kprobes.c
> > +++ b/kernel/kprobes.c
> > @@ -2289,7 +2289,7 @@ static int __init init_kprobes(void)
> >  		init_test_probes();
> >  	return err;
> >  }
> > -postcore_initcall(init_kprobes);
> > +subsys_initcall(init_kprobes);
> >  
> >  #ifdef CONFIG_DEBUG_FS
> >  static void report_probe(struct seq_file *pi, struct kprobe *p,
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2019-06-04 15:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22  8:32 [PATCH v2 0/2] Enable new kprobe event at boot Masami Hiramatsu
2019-05-22  8:32 ` [PATCH v2 1/2] kprobes: Initialize kprobes at postcore_initcall Masami Hiramatsu
2019-05-22  8:32 ` [PATCH v2 2/2] tracing/kprobe: Add kprobe_event= boot parameter Masami Hiramatsu
2019-05-28 12:23   ` Anders Roxell
2019-05-28 12:36     ` Steven Rostedt
2019-05-28 13:39       ` Anders Roxell
2019-06-03 11:52         ` Masami Hiramatsu
2019-06-03 12:41           ` Masami Hiramatsu
2019-06-03 13:04             ` [PATCH] kprobes: Fix to init kprobes in subsys_initcall Masami Hiramatsu
2019-06-03 20:33               ` Anders Roxell
2019-06-04  9:06               ` Steven Rostedt
2019-06-04 15:56                 ` Masami Hiramatsu [this message]
2019-06-12  7:59               ` Masami Hiramatsu
2019-06-12 13:47                 ` Steven Rostedt
2019-06-13  7:08                   ` Masami Hiramatsu
2019-06-14 20:38                     ` 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=20190605005623.80198859f1f1e6695b3d3976@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=anders.roxell@linaro.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    --subject='Re: [PATCH] kprobes: Fix to init kprobes in subsys_initcall' \
    /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

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).