linux/arch
Masami Hiramatsu c0f7ac3a9e kprobes/x86: Support kprobes jump optimization on x86
Introduce x86 arch-specific optimization code, which supports
both of x86-32 and x86-64.

This code also supports safety checking, which decodes whole of
a function in which probe is inserted, and checks following
conditions before optimization:
 - The optimized instructions which will be replaced by a jump instruction
   don't straddle the function boundary.
 - There is no indirect jump instruction, because it will jumps into
   the address range which is replaced by jump operand.
 - There is no jump/loop instruction which jumps into the address range
   which is replaced by jump operand.
 - Don't optimize kprobes if it is in functions into which fixup code will
   jumps.

This uses text_poke_multibyte() which doesn't support modifying
code on NMI/MCE handler. However, since kprobes itself doesn't
support NMI/MCE code probing, it's not a problem.

Changes in v9:
 - Use *_text_reserved() for checking the probe can be optimized.
 - Verify jump address range is in 2G range when preparing slot.
 - Backup original code when switching optimized buffer, instead of
   preparing buffer, because there can be int3 of other probes in
   preparing phase.
 - Check kprobe is disabled in arch_check_optimized_kprobe().
 - Strictly check indirect jump opcodes (ff /4, ff /5).

Changes in v6:
 - Split stop_machine-based jump patching code.
 - Update comments and coding style.

Changes in v5:
 - Introduce stop_machine-based jump replacing.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Anders Kaseorg <andersk@ksplice.com>
Cc: Tim Abbott <tabbott@ksplice.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
LKML-Reference: <20100225133446.6725.78994.stgit@localhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-02-25 17:49:26 +01:00
..
alpha alpha: cpumask_of_node() should handle -1 as a node 2010-01-14 13:21:35 -05:00
arm Merge branch 'omap-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6 2010-01-25 18:56:12 -08:00
avr32 Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
blackfin blackfin,kgdb: Do not put PC in gdb_regs into retx. 2010-01-07 11:58:37 -06:00
cris Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
frv FDPIC: Respect PT_GNU_STACK exec protection markings when creating NOMMU stack 2010-01-06 18:16:02 -08:00
h8300 Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
ia64 kprobes: Disable booster when CONFIG_PREEMPT=y 2010-02-04 09:36:18 +01:00
m32r elf: kill USE_ELF_CORE_DUMP 2009-12-16 07:20:12 -08:00
m68k m68knommu: fix definitions of __pa() and __va() 2010-01-12 20:51:45 -08:00
m68knommu m68knommu: fix invalid flags on coldfire pit clocksource 2010-01-16 12:15:38 -08:00
microblaze microblaze: pci_controller->arch_data really is a struct device_node * 2010-01-18 16:36:07 +01:00
mips MIPS: Ignore vmlinux.* 2010-01-12 18:19:38 +01:00
mn10300 mn10300: update the ASB2303 defconfig 2010-01-11 09:34:10 -08:00
parisc Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
powerpc Merge branch 'perf/urgent' into perf/core 2010-01-29 10:36:22 +01:00
s390 KVM: S390: fix potential array overrun in intercept handling 2010-01-25 12:26:39 -02:00
score mm: make totalhigh_pages unsigned long 2010-01-11 09:34:03 -08:00
sh Merge branch 'perf/urgent' into perf/core 2010-01-29 10:36:22 +01:00
sparc sparc64: Fix IRQ ->set_affinity() methods. 2010-01-20 19:30:49 -08:00
um Unrot uml mconsole a bit 2010-01-14 09:05:26 -05:00
x86 kprobes/x86: Support kprobes jump optimization on x86 2010-02-25 17:49:26 +01:00
xtensa Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
.gitignore
Kconfig kprobes: Introduce kprobes jump optimization 2010-02-25 17:49:24 +01:00