From: Oleg Nesterov <oleg@redhat.com>
To: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Anton Arapov <anton@redhat.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] uprobes: Kill set_swbp()->is_swbp_at_addr()
Date: Mon, 24 Sep 2012 18:02:50 +0200 [thread overview]
Message-ID: <20120924160250.GA15999@redhat.com> (raw)
In-Reply-To: <20120924090858.GA2248@in.ibm.com>
On 09/24, Ananth N Mavinakayanahalli wrote:
>
> On Sun, Sep 23, 2012 at 10:19:45PM +0200, Oleg Nesterov wrote:
>
> > It doesn't matter if this "int3" was in fact
> > installed by gdb or application itself, we are going to "steal" this
> > breakpoint anyway and execute the original insn from vm_file even if
> > it no longer matches the memory.
>
> Wouldn't this text make more sense:
>
> It doesn't matter if this 'breakpoint' was in fact...
>
> 'int3' is still an x86 artifact.
Agreed, will update the changelog.
> On powerpc, we don't even get to install_breakpoint() ->set_swbp()
> ->is_swbp_at_addr() because arch_uprobe_analyze_insn() would've already
> caused install_breakpoint() to return -ENOTSUPP.
>
> > OTOH, handle_swbp()->find_active_uprobe() uses is_swbp_at_addr() to
> > figure out whether we need to send SIGTRAP or not if we can not find
> > uprobe, so in this case it should return true for all trap variants,
> > not only for UPROBE_SWBP_INSN.
>
> So, we will need a powerpc specific is_swbp_insn()... ok.
I think yes.
But again, we need 2 helpers. One for is_swbp_at_addr(), and another
for verify_opcode() which only checks UPROBE_SWBP_INSN. IOW, something
like the patch below (on top of this series).
Do you agree?
Oleg.
--- x/kernel/events/uprobes.c
+++ x/kernel/events/uprobes.c
@@ -178,6 +178,11 @@ static int __replace_page(struct vm_area
* Default implementation of is_swbp_insn
* Returns true if @insn is a breakpoint instruction.
*/
+static bool is_uprobe_opcode(uprobe_opcode_t *insn)
+{
+ return *insn == UPROBE_SWBP_INSN;
+}
+
bool __weak is_swbp_insn(uprobe_opcode_t *insn)
{
return *insn == UPROBE_SWBP_INSN;
@@ -196,9 +201,9 @@ static int verify_opcode(struct page *pa
bool is_swbp;
copy_opcode(page, vaddr, &old_opcode);
- is_swbp = is_swbp_insn(&old_opcode);
+ is_swbp = is_uprobe_opcode(&old_opcode);
- if (is_swbp_insn(new_opcode)) {
+ if (is_uprobe_opcode(new_opcode)) {
if (is_swbp) /* register: already installed? */
return 0;
} else {
@@ -585,7 +590,7 @@ install_breakpoint(struct uprobe *uprobe
if (ret)
return ret;
- if (is_swbp_insn((uprobe_opcode_t *)uprobe->arch.insn))
+ if (is_uprobe_opcode((uprobe_opcode_t *)uprobe->arch.insn))
return -ENOTSUPP;
ret = arch_uprobe_analyze_insn(&uprobe->arch, mm, vaddr);
next prev parent reply other threads:[~2012-09-24 16:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-23 20:19 [PATCH 0/4] uprobes: remove is_swbp_at_addr() from register/unregister Oleg Nesterov
2012-09-23 20:19 ` [PATCH 1/4] uprobes: Kill set_swbp()->is_swbp_at_addr() Oleg Nesterov
2012-09-24 9:03 ` Peter Zijlstra
2012-09-24 15:23 ` Oleg Nesterov
2012-09-24 9:08 ` Ananth N Mavinakayanahalli
2012-09-24 16:02 ` Oleg Nesterov [this message]
2012-10-06 6:55 ` Srikar Dronamraju
2012-09-23 20:19 ` [PATCH 2/4] uprobes: Introduce copy_opcode(), kill read_opcode() Oleg Nesterov
2012-10-06 6:59 ` Srikar Dronamraju
2012-09-23 20:19 ` [PATCH 3/4] uprobes: Kill set_orig_insn()->is_swbp_at_addr() Oleg Nesterov
2012-09-24 9:13 ` Peter Zijlstra
2012-09-24 15:23 ` Oleg Nesterov
2012-10-06 7:18 ` Srikar Dronamraju
2012-09-23 20:19 ` [PATCH 4/4] uprobes: Simplify is_swbp_at_addr(), remove stale comments Oleg Nesterov
2012-10-06 7:11 ` Srikar Dronamraju
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=20120924160250.GA15999@redhat.com \
--to=oleg@redhat.com \
--cc=ananth@in.ibm.com \
--cc=anton@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
/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