From: rabin@rab.in (Rabin Vincent)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/9] uprobes: allow ignoring of probe hits
Date: Sun, 14 Oct 2012 21:23:07 +0200 [thread overview]
Message-ID: <1350242593-17761-3-git-send-email-rabin@rab.in> (raw)
In-Reply-To: <1350242593-17761-1-git-send-email-rabin@rab.in>
Allow arches to decided to ignore a probe hit. ARM will use this to
only call handlers if the conditions to execute a conditionally executed
instruction are satisfied.
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
include/linux/uprobes.h | 1 +
kernel/events/uprobes.c | 14 +++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index ac90704..da21b66 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -128,6 +128,7 @@ extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
+extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
#else /* !CONFIG_UPROBES */
struct uprobes_state {
};
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index db4e3ab..a0e1a38 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1419,6 +1419,11 @@ static void mmf_recalc_uprobes(struct mm_struct *mm)
clear_bit(MMF_HAS_UPROBES, &mm->flags);
}
+bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs)
+{
+ return false;
+}
+
static struct uprobe *find_active_uprobe(unsigned long bp_vaddr, int *is_swbp)
{
struct mm_struct *mm = current->mm;
@@ -1469,6 +1474,7 @@ static void handle_swbp(struct pt_regs *regs)
struct uprobe *uprobe;
unsigned long bp_vaddr;
int uninitialized_var(is_swbp);
+ bool ignored = false;
bp_vaddr = uprobe_get_swbp_addr(regs);
uprobe = find_active_uprobe(bp_vaddr, &is_swbp);
@@ -1499,6 +1505,12 @@ static void handle_swbp(struct pt_regs *regs)
goto cleanup_ret;
}
utask->active_uprobe = uprobe;
+
+ if (arch_uprobe_ignore(&uprobe->arch, regs)) {
+ ignored = true;
+ goto cleanup_ret;
+ }
+
handler_chain(uprobe, regs);
if (uprobe->flags & UPROBE_SKIP_SSTEP && can_skip_sstep(uprobe, regs))
goto cleanup_ret;
@@ -1514,7 +1526,7 @@ cleanup_ret:
utask->active_uprobe = NULL;
utask->state = UTASK_RUNNING;
}
- if (!(uprobe->flags & UPROBE_SKIP_SSTEP))
+ if (!ignored && !(uprobe->flags & UPROBE_SKIP_SSTEP))
/*
* cannot singlestep; cannot skip instruction;
--
1.7.9.5
next prev parent reply other threads:[~2012-10-14 19:23 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-14 19:23 [PATCH 1/9] uprobes: move function declarations out of arch Rabin Vincent
2012-10-14 19:23 ` [PATCH 2/9] uprobes: check for single step support Rabin Vincent
2012-10-17 16:40 ` Srikar Dronamraju
2012-10-17 17:02 ` Oleg Nesterov
2012-10-14 19:23 ` Rabin Vincent [this message]
2012-10-15 16:52 ` [PATCH 3/9] uprobes: allow ignoring of probe hits Oleg Nesterov
2012-10-16 20:11 ` Rabin Vincent
2012-10-17 17:35 ` Oleg Nesterov
2012-10-21 18:15 ` Rabin Vincent
2012-10-21 19:40 ` Oleg Nesterov
2012-10-17 16:52 ` Srikar Dronamraju
2012-10-14 19:23 ` [PATCH 4/9] uprobes: allow arch access to xol slot Rabin Vincent
2012-10-17 17:17 ` Srikar Dronamraju
2012-10-14 19:23 ` [PATCH 5/9] uprobes: allow arch-specific initialization Rabin Vincent
2012-10-18 9:39 ` Srikar Dronamraju
2012-10-14 19:23 ` [PATCH 6/9] uprobes: flush cache after xol write Rabin Vincent
2012-10-15 16:57 ` Oleg Nesterov
2012-10-16 20:29 ` Rabin Vincent
2012-10-25 14:58 ` Oleg Nesterov
2012-10-26 5:52 ` Ananth N Mavinakayanahalli
2012-10-26 16:39 ` Oleg Nesterov
2012-10-29 5:35 ` Ananth N Mavinakayanahalli
2012-11-03 16:33 ` Oleg Nesterov
2012-11-04 14:29 ` Ananth N Mavinakayanahalli
2012-11-14 17:37 ` Oleg Nesterov
2012-10-14 19:23 ` [PATCH 7/9] uprobes: add arch write opcode hook Rabin Vincent
2012-10-14 19:23 ` [PATCH 8/9] ARM: support uprobe handling Rabin Vincent
2012-11-04 10:13 ` Russell King - ARM Linux
2012-11-12 17:26 ` Rabin Vincent
2012-10-14 19:23 ` [PATCH 9/9] ARM: add uprobes support Rabin Vincent
2012-10-15 11:14 ` Dave Martin
2012-10-15 11:44 ` Rabin Vincent
2012-10-15 17:44 ` Dave Martin
2012-10-17 14:50 ` Jon Medhurst (Tixy)
2012-10-21 18:43 ` Rabin Vincent
2012-10-21 18:59 ` Rabin Vincent
2012-10-15 17:31 ` Dave Martin
2012-10-21 18:27 ` Rabin Vincent
2012-10-17 17:54 ` Oleg Nesterov
2012-10-15 17:19 ` [PATCH 1/9] uprobes: move function declarations out of arch Srikar Dronamraju
2012-10-16 20:30 ` Rabin Vincent
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=1350242593-17761-3-git-send-email-rabin@rab.in \
--to=rabin@rab.in \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).