diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 10 | ||||
-rw-r--r-- | include/linux/compiler.h | 2 | ||||
-rw-r--r-- | include/linux/kprobes.h | 21 | ||||
-rw-r--r-- | include/linux/perf_event.h | 11 | ||||
-rw-r--r-- | include/linux/uprobes.h | 4 | ||||
-rw-r--r-- | include/uapi/linux/perf_event.h | 11 |
6 files changed, 51 insertions, 8 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 146e4fffd710..8e0204a68c74 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -109,6 +109,15 @@ | |||
109 | #define BRANCH_PROFILE() | 109 | #define BRANCH_PROFILE() |
110 | #endif | 110 | #endif |
111 | 111 | ||
112 | #ifdef CONFIG_KPROBES | ||
113 | #define KPROBE_BLACKLIST() . = ALIGN(8); \ | ||
114 | VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \ | ||
115 | *(_kprobe_blacklist) \ | ||
116 | VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .; | ||
117 | #else | ||
118 | #define KPROBE_BLACKLIST() | ||
119 | #endif | ||
120 | |||
112 | #ifdef CONFIG_EVENT_TRACING | 121 | #ifdef CONFIG_EVENT_TRACING |
113 | #define FTRACE_EVENTS() . = ALIGN(8); \ | 122 | #define FTRACE_EVENTS() . = ALIGN(8); \ |
114 | VMLINUX_SYMBOL(__start_ftrace_events) = .; \ | 123 | VMLINUX_SYMBOL(__start_ftrace_events) = .; \ |
@@ -507,6 +516,7 @@ | |||
507 | *(.init.rodata) \ | 516 | *(.init.rodata) \ |
508 | FTRACE_EVENTS() \ | 517 | FTRACE_EVENTS() \ |
509 | TRACE_SYSCALLS() \ | 518 | TRACE_SYSCALLS() \ |
519 | KPROBE_BLACKLIST() \ | ||
510 | MEM_DISCARD(init.rodata) \ | 520 | MEM_DISCARD(init.rodata) \ |
511 | CLK_OF_TABLES() \ | 521 | CLK_OF_TABLES() \ |
512 | RESERVEDMEM_OF_TABLES() \ | 522 | RESERVEDMEM_OF_TABLES() \ |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index ee7239ea1583..0300c0f5c88b 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -374,7 +374,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
374 | /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ | 374 | /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ |
375 | #ifdef CONFIG_KPROBES | 375 | #ifdef CONFIG_KPROBES |
376 | # define __kprobes __attribute__((__section__(".kprobes.text"))) | 376 | # define __kprobes __attribute__((__section__(".kprobes.text"))) |
377 | # define nokprobe_inline __always_inline | ||
377 | #else | 378 | #else |
378 | # define __kprobes | 379 | # define __kprobes |
380 | # define nokprobe_inline inline | ||
379 | #endif | 381 | #endif |
380 | #endif /* __LINUX_COMPILER_H */ | 382 | #endif /* __LINUX_COMPILER_H */ |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 925eaf28fca9..e059507c465d 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -205,10 +205,10 @@ struct kretprobe_blackpoint { | |||
205 | void *addr; | 205 | void *addr; |
206 | }; | 206 | }; |
207 | 207 | ||
208 | struct kprobe_blackpoint { | 208 | struct kprobe_blacklist_entry { |
209 | const char *name; | 209 | struct list_head list; |
210 | unsigned long start_addr; | 210 | unsigned long start_addr; |
211 | unsigned long range; | 211 | unsigned long end_addr; |
212 | }; | 212 | }; |
213 | 213 | ||
214 | #ifdef CONFIG_KPROBES | 214 | #ifdef CONFIG_KPROBES |
@@ -265,6 +265,7 @@ extern void arch_disarm_kprobe(struct kprobe *p); | |||
265 | extern int arch_init_kprobes(void); | 265 | extern int arch_init_kprobes(void); |
266 | extern void show_registers(struct pt_regs *regs); | 266 | extern void show_registers(struct pt_regs *regs); |
267 | extern void kprobes_inc_nmissed_count(struct kprobe *p); | 267 | extern void kprobes_inc_nmissed_count(struct kprobe *p); |
268 | extern bool arch_within_kprobe_blacklist(unsigned long addr); | ||
268 | 269 | ||
269 | struct kprobe_insn_cache { | 270 | struct kprobe_insn_cache { |
270 | struct mutex mutex; | 271 | struct mutex mutex; |
@@ -476,4 +477,18 @@ static inline int enable_jprobe(struct jprobe *jp) | |||
476 | return enable_kprobe(&jp->kp); | 477 | return enable_kprobe(&jp->kp); |
477 | } | 478 | } |
478 | 479 | ||
480 | #ifdef CONFIG_KPROBES | ||
481 | /* | ||
482 | * Blacklist ganerating macro. Specify functions which is not probed | ||
483 | * by using this macro. | ||
484 | */ | ||
485 | #define __NOKPROBE_SYMBOL(fname) \ | ||
486 | static unsigned long __used \ | ||
487 | __attribute__((section("_kprobe_blacklist"))) \ | ||
488 | _kbl_addr_##fname = (unsigned long)fname; | ||
489 | #define NOKPROBE_SYMBOL(fname) __NOKPROBE_SYMBOL(fname) | ||
490 | #else | ||
491 | #define NOKPROBE_SYMBOL(fname) | ||
492 | #endif | ||
493 | |||
479 | #endif /* _LINUX_KPROBES_H */ | 494 | #endif /* _LINUX_KPROBES_H */ |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 9b5cd1992a88..b4c1d4685bf0 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -167,16 +167,27 @@ struct perf_event; | |||
167 | #define PERF_EVENT_TXN 0x1 | 167 | #define PERF_EVENT_TXN 0x1 |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * pmu::capabilities flags | ||
171 | */ | ||
172 | #define PERF_PMU_CAP_NO_INTERRUPT 0x01 | ||
173 | |||
174 | /** | ||
170 | * struct pmu - generic performance monitoring unit | 175 | * struct pmu - generic performance monitoring unit |
171 | */ | 176 | */ |
172 | struct pmu { | 177 | struct pmu { |
173 | struct list_head entry; | 178 | struct list_head entry; |
174 | 179 | ||
180 | struct module *module; | ||
175 | struct device *dev; | 181 | struct device *dev; |
176 | const struct attribute_group **attr_groups; | 182 | const struct attribute_group **attr_groups; |
177 | const char *name; | 183 | const char *name; |
178 | int type; | 184 | int type; |
179 | 185 | ||
186 | /* | ||
187 | * various common per-pmu feature flags | ||
188 | */ | ||
189 | int capabilities; | ||
190 | |||
180 | int * __percpu pmu_disable_count; | 191 | int * __percpu pmu_disable_count; |
181 | struct perf_cpu_context * __percpu pmu_cpu_context; | 192 | struct perf_cpu_context * __percpu pmu_cpu_context; |
182 | int task_ctx_nr; | 193 | int task_ctx_nr; |
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index edff2b97b864..88c3b7e8b384 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h | |||
@@ -102,6 +102,7 @@ extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, u | |||
102 | extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); | 102 | extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); |
103 | extern bool __weak is_trap_insn(uprobe_opcode_t *insn); | 103 | extern bool __weak is_trap_insn(uprobe_opcode_t *insn); |
104 | extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); | 104 | extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); |
105 | extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs); | ||
105 | extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); | 106 | extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); |
106 | extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); | 107 | extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); |
107 | extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); | 108 | extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); |
@@ -130,6 +131,9 @@ extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *r | |||
130 | #else /* !CONFIG_UPROBES */ | 131 | #else /* !CONFIG_UPROBES */ |
131 | struct uprobes_state { | 132 | struct uprobes_state { |
132 | }; | 133 | }; |
134 | |||
135 | #define uprobe_get_trap_addr(regs) instruction_pointer(regs) | ||
136 | |||
133 | static inline int | 137 | static inline int |
134 | uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc) | 138 | uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc) |
135 | { | 139 | { |
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 853bc1ccb395..d9cd853818ad 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h | |||
@@ -163,8 +163,9 @@ enum perf_branch_sample_type { | |||
163 | PERF_SAMPLE_BRANCH_ABORT_TX = 1U << 7, /* transaction aborts */ | 163 | PERF_SAMPLE_BRANCH_ABORT_TX = 1U << 7, /* transaction aborts */ |
164 | PERF_SAMPLE_BRANCH_IN_TX = 1U << 8, /* in transaction */ | 164 | PERF_SAMPLE_BRANCH_IN_TX = 1U << 8, /* in transaction */ |
165 | PERF_SAMPLE_BRANCH_NO_TX = 1U << 9, /* not in transaction */ | 165 | PERF_SAMPLE_BRANCH_NO_TX = 1U << 9, /* not in transaction */ |
166 | PERF_SAMPLE_BRANCH_COND = 1U << 10, /* conditional branches */ | ||
166 | 167 | ||
167 | PERF_SAMPLE_BRANCH_MAX = 1U << 10, /* non-ABI */ | 168 | PERF_SAMPLE_BRANCH_MAX = 1U << 11, /* non-ABI */ |
168 | }; | 169 | }; |
169 | 170 | ||
170 | #define PERF_SAMPLE_BRANCH_PLM_ALL \ | 171 | #define PERF_SAMPLE_BRANCH_PLM_ALL \ |
@@ -722,10 +723,10 @@ enum perf_callchain_context { | |||
722 | PERF_CONTEXT_MAX = (__u64)-4095, | 723 | PERF_CONTEXT_MAX = (__u64)-4095, |
723 | }; | 724 | }; |
724 | 725 | ||
725 | #define PERF_FLAG_FD_NO_GROUP (1U << 0) | 726 | #define PERF_FLAG_FD_NO_GROUP (1UL << 0) |
726 | #define PERF_FLAG_FD_OUTPUT (1U << 1) | 727 | #define PERF_FLAG_FD_OUTPUT (1UL << 1) |
727 | #define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */ | 728 | #define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */ |
728 | #define PERF_FLAG_FD_CLOEXEC (1U << 3) /* O_CLOEXEC */ | 729 | #define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */ |
729 | 730 | ||
730 | union perf_mem_data_src { | 731 | union perf_mem_data_src { |
731 | __u64 val; | 732 | __u64 val; |