[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-d9c4a30e82614d43b55893a73f31e7284007ce82@git.kernel.org>
Date: Mon, 18 Jun 2012 01:58:49 -0700
From: tip-bot for Oleg Nesterov <oleg@...hat.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...nel.org,
peterz@...radead.org, ananth@...ibm.com, anton@...hat.com,
srikar@...ux.vnet.ibm.com, tglx@...utronix.de, oleg@...hat.com
Subject: [tip:perf/core] uprobes: Move BUG_ON(UPROBE_SWBP_INSN_SIZE)
from write_opcode() to install_breakpoint()
Commit-ID: d9c4a30e82614d43b55893a73f31e7284007ce82
Gitweb: http://git.kernel.org/tip/d9c4a30e82614d43b55893a73f31e7284007ce82
Author: Oleg Nesterov <oleg@...hat.com>
AuthorDate: Fri, 15 Jun 2012 17:43:50 +0200
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Sat, 16 Jun 2012 09:10:47 +0200
uprobes: Move BUG_ON(UPROBE_SWBP_INSN_SIZE) from write_opcode() to install_breakpoint()
write_opcode() ensures that UPROBE_SWBP_INSN doesn't cross the
page boundary. This looks a bit confusing, the check does not
depend on vaddr and it is enough to do it only once right after
install_breakpoint()->arch_uprobe_analyze_insn().
Signed-off-by: Oleg Nesterov <oleg@...hat.com>
Acked-by: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@...ibm.com>
Cc: Anton Arapov <anton@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/r/20120615154350.GA9611@redhat.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
kernel/events/uprobes.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 14c71a2..b9c61bd 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -210,7 +210,6 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
void *vaddr_old, *vaddr_new;
struct vm_area_struct *vma;
struct uprobe *uprobe;
- unsigned long pgoff;
int ret;
retry:
/* Read the page with vaddr into memory */
@@ -251,11 +250,7 @@ retry:
vaddr_new = kmap_atomic(new_page);
memcpy(vaddr_new, vaddr_old, PAGE_SIZE);
-
- /* poke the new insn in, ASSUMES we don't cross page boundary */
- pgoff = (vaddr & ~PAGE_MASK);
- BUG_ON(pgoff + UPROBE_SWBP_INSN_SIZE > PAGE_SIZE);
- memcpy(vaddr_new + pgoff, &opcode, UPROBE_SWBP_INSN_SIZE);
+ memcpy(vaddr_new + (vaddr & ~PAGE_MASK), &opcode, UPROBE_SWBP_INSN_SIZE);
kunmap_atomic(vaddr_new);
kunmap_atomic(vaddr_old);
@@ -699,6 +694,10 @@ install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm,
if (ret)
return ret;
+ /* write_opcode() assumes we don't cross page boundary */
+ BUG_ON((uprobe->offset & ~PAGE_MASK) +
+ UPROBE_SWBP_INSN_SIZE > PAGE_SIZE);
+
uprobe->flags |= UPROBE_COPY_INSN;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists