diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2014-04-17 04:17:05 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-04-24 04:02:56 -0400 |
commit | 376e242429bf8539ef39a080ac113c8799840b13 (patch) | |
tree | 33c871f48d37acd167de0b3bf5c902ce4aaa325c /arch | |
parent | be8f274323c26ddc7e6fd6c44254b7abcdbe6389 (diff) |
kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklist
Introduce NOKPROBE_SYMBOL() macro which builds a kprobes
blacklist at kernel build time.
The usage of this macro is similar to EXPORT_SYMBOL(),
placed after the function definition:
NOKPROBE_SYMBOL(function);
Since this macro will inhibit inlining of static/inline
functions, this patch also introduces a nokprobe_inline macro
for static/inline functions. In this case, we must use
NOKPROBE_SYMBOL() for the inline function caller.
When CONFIG_KPROBES=y, the macro stores the given function
address in the "_kprobe_blacklist" section.
Since the data structures are not fully initialized by the
macro (because there is no "size" information), those
are re-initialized at boot time by using kallsyms.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Link: http://lkml.kernel.org/r/20140417081705.26341.96719.stgit@ltc230.yrl.intra.hitachi.co.jp
Cc: Alok Kataria <akataria@vmware.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christopher Li <sparse@chrisli.org>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Jan-Simon Möller <dl9pf@gmx.de>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-arch@vger.kernel.org
Cc: linux-doc@vger.kernel.org
Cc: linux-sparse@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/asm.h | 7 | ||||
-rw-r--r-- | arch/x86/kernel/paravirt.c | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 4582e8e1cd1a..7730c1c5c83a 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h | |||
@@ -57,6 +57,12 @@ | |||
57 | .long (from) - . ; \ | 57 | .long (from) - . ; \ |
58 | .long (to) - . + 0x7ffffff0 ; \ | 58 | .long (to) - . + 0x7ffffff0 ; \ |
59 | .popsection | 59 | .popsection |
60 | |||
61 | # define _ASM_NOKPROBE(entry) \ | ||
62 | .pushsection "_kprobe_blacklist","aw" ; \ | ||
63 | _ASM_ALIGN ; \ | ||
64 | _ASM_PTR (entry); \ | ||
65 | .popsection | ||
60 | #else | 66 | #else |
61 | # define _ASM_EXTABLE(from,to) \ | 67 | # define _ASM_EXTABLE(from,to) \ |
62 | " .pushsection \"__ex_table\",\"a\"\n" \ | 68 | " .pushsection \"__ex_table\",\"a\"\n" \ |
@@ -71,6 +77,7 @@ | |||
71 | " .long (" #from ") - .\n" \ | 77 | " .long (" #from ") - .\n" \ |
72 | " .long (" #to ") - . + 0x7ffffff0\n" \ | 78 | " .long (" #to ") - . + 0x7ffffff0\n" \ |
73 | " .popsection\n" | 79 | " .popsection\n" |
80 | /* For C file, we already have NOKPROBE_SYMBOL macro */ | ||
74 | #endif | 81 | #endif |
75 | 82 | ||
76 | #endif /* _ASM_X86_ASM_H */ | 83 | #endif /* _ASM_X86_ASM_H */ |
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 1b10af835c31..e136869ae42e 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/efi.h> | 23 | #include <linux/efi.h> |
24 | #include <linux/bcd.h> | 24 | #include <linux/bcd.h> |
25 | #include <linux/highmem.h> | 25 | #include <linux/highmem.h> |
26 | #include <linux/kprobes.h> | ||
26 | 27 | ||
27 | #include <asm/bug.h> | 28 | #include <asm/bug.h> |
28 | #include <asm/paravirt.h> | 29 | #include <asm/paravirt.h> |
@@ -389,6 +390,9 @@ __visible struct pv_cpu_ops pv_cpu_ops = { | |||
389 | .end_context_switch = paravirt_nop, | 390 | .end_context_switch = paravirt_nop, |
390 | }; | 391 | }; |
391 | 392 | ||
393 | /* At this point, native_get_debugreg has a real function entry */ | ||
394 | NOKPROBE_SYMBOL(native_get_debugreg); | ||
395 | |||
392 | struct pv_apic_ops pv_apic_ops = { | 396 | struct pv_apic_ops pv_apic_ops = { |
393 | #ifdef CONFIG_X86_LOCAL_APIC | 397 | #ifdef CONFIG_X86_LOCAL_APIC |
394 | .startup_ipi_hook = paravirt_nop, | 398 | .startup_ipi_hook = paravirt_nop, |