aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasami Hiramatsu <[email protected]>2013-04-04 19:40:50 +0900
committerIngo Molnar <[email protected]>2013-04-08 17:28:34 +0200
commit324670b620ab1ed00ba160e435686bd2ae4a59ce (patch)
tree176c0f872668097350fa6c38cddd884088862ce6
parentcc2f5a8adbc7ab1fdb7d9bcf4ea9838c73e82dfe (diff)
kprobes: Move __kprobes definition into compiler.h
Currently, __kprobes is defined in linux/kprobes.h which is too big to be included in small or basic headers that want to make use of this simple attribute. So move __kprobes definition into linux/compiler.h in which other compiler attributes are defined. Signed-off-by: Masami Hiramatsu <[email protected]> Cc: Timo Juhani Lindfors <[email protected]> Cc: Ananth N Mavinakayanahalli <[email protected]> Cc: Pavel Emelyanov <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Nadia Yvette Chambers <[email protected]> Cc: [email protected] Cc: David S. Miller <[email protected]> Cc: Linus Torvalds <[email protected]> Link: http://lkml.kernel.org/r/20130404104049.21071.20908.stgit@mhiramat-M0-7522 [ Improved the attribute explanation a bit. ] Signed-off-by: Ingo Molnar <[email protected]>
-rw-r--r--include/linux/compiler.h6
-rw-r--r--include/linux/kprobes.h6
2 files changed, 7 insertions, 5 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 10b8f23fab0f..92669cd182a6 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -351,4 +351,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
*/
#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */
+#ifdef CONFIG_KPROBES
+# define __kprobes __attribute__((__section__(".kprobes.text")))
+#else
+# define __kprobes
+#endif
#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 4b6ef4d33cc2..ca1d27a0d6a6 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -29,6 +29,7 @@
* <[email protected]> and Prasanna S Panchamukhi
* <[email protected]> added function-return probes.
*/
+#include <linux/compiler.h> /* for __kprobes */
#include <linux/linkage.h>
#include <linux/list.h>
#include <linux/notifier.h>
@@ -49,16 +50,11 @@
#define KPROBE_REENTER 0x00000004
#define KPROBE_HIT_SSDONE 0x00000008
-/* Attach to insert probes on any functions which should be ignored*/
-#define __kprobes __attribute__((__section__(".kprobes.text")))
-
#else /* CONFIG_KPROBES */
typedef int kprobe_opcode_t;
struct arch_specific_insn {
int dummy;
};
-#define __kprobes
-
#endif /* CONFIG_KPROBES */
struct kprobe;