public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.cz>
To: Ingo Molnar <mingo@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	"David S. Miller" <davem@davemloft.net>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	Ananth NMavinakayanahalli <ananth@in.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Jiri Kosina <jkosina@suse.cz>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] kprobes/x86: Use 5-byte NOP when the code might be modified by ftrace
Date: Fri, 20 Feb 2015 14:34:40 +0100	[thread overview]
Message-ID: <20150220133440.GK5136@pathway.suse.cz> (raw)
In-Reply-To: <20150220125223.GA28882@gmail.com>

On Fri 2015-02-20 13:52:23, Ingo Molnar wrote:
> 
> * Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> wrote:
> 
> > (2015/02/20 19:26), Ingo Molnar wrote:
> > > 
> > > * Petr Mladek <pmladek@suse.cz> wrote:
> > > 
> > >> can_probe() checks if the given address points to the 
> > >> beginning of an instruction. It analyzes all the 
> > >> instructions from the beginning of the function until the 
> > >> given address. The code might be modified by another 
> > >> Kprobe. In this case, the current code is read into a 
> > >> buffer, int3 breakpoint is replaced by the saved opcode 
> > >> in the buffer, and can_probe() analyzes the buffer 
> > >> instead.
> > >>
> > >> [...]
> > > 
> > > Had to drop this patch due to build failures on 32-bit x86:
> > > 
> > > arch/x86/kernel/kprobes/core.c:258:40: error: ‘MCOUNT_INSN_SIZE’ undeclared (first use in this function)
> > 
> > Oops, MCOUNT_INSN_SIZE actually depends on 
> > CONFIG_FUNCTION_TRACER... I think we can use 5 instead of 
> > that since we are copying.

I'll use 5 for now.

> Or just make the define more widely available? It's not 
> like the size changes from disabling the function tracer.

I would do this in a separate patch that would consolidate all
NOP_ATOMIC5 users: ftrace, jump_labels, and kprobe. The number
5 is hardcoded more times in arch/x86/kernel/kprobes/core.c.
I'll put it into my TODO list.

Best Regards,
Petr

  parent reply	other threads:[~2015-02-20 13:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 17:48 [PATCH v2] kprobes/x86: Use 5-byte NOP when the code might be modified by ftrace Petr Mladek
2015-02-03  7:41 ` Masami Hiramatsu
2015-02-03 11:38   ` Petr Mladek
2015-02-03 11:52     ` Masami Hiramatsu
2015-02-03 12:00     ` Petr Mladek
2015-02-18 21:22     ` Ingo Molnar
2015-02-20 10:16       ` Petr Mladek
2015-02-20 10:16         ` [PATCH 1/2] " Petr Mladek
2015-02-20 10:26           ` Ingo Molnar
2015-02-20 12:38             ` Masami Hiramatsu
2015-02-20 12:52               ` Ingo Molnar
2015-02-20 13:25                 ` Masami Hiramatsu
2015-02-20 13:34                 ` Petr Mladek [this message]
2015-02-20 10:16         ` [PATCH 2/2] kprobes/x86: Check for invalid ftrace location in __recover_probed_insn() Petr Mladek
2015-02-20 10:19           ` Ingo Molnar

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=20150220133440.GK5136@pathway.suse.cz \
    --to=pmladek@suse.cz \
    --cc=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@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