aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-03-07 17:38:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-03-07 17:38:16 -0500
commitc3abcabe813b4a0976b58f7e6c1e63b2070c8dda (patch)
tree72d7719e484340ddca3d5cf2710823f25a5d6542
parent500e1af25209a048daa1f1f86083d4849d5c555b (diff)
parent9d020d33fc1b2faa0eb35859df1381ca5dc94ffe (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "This includes a fix for a crash if certain special addresses are kprobed, plus does a rename of two Kconfig variables that were a minor misnomer" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/core: Rename CONFIG_[UK]PROBE_EVENT to CONFIG_[UK]PROBE_EVENTS kprobes/x86: Fix kernel panic when certain exception-handling addresses are probed
-rw-r--r--Documentation/trace/kprobetrace.txt2
-rw-r--r--Documentation/trace/uprobetracer.txt2
-rw-r--r--arch/s390/configs/default_defconfig2
-rw-r--r--arch/s390/configs/gcov_defconfig2
-rw-r--r--arch/s390/configs/performance_defconfig2
-rw-r--r--arch/s390/defconfig2
-rw-r--r--arch/x86/kernel/kprobes/common.h2
-rw-r--r--arch/x86/kernel/kprobes/core.c6
-rw-r--r--arch/x86/kernel/kprobes/opt.c2
-rw-r--r--kernel/trace/Kconfig6
-rw-r--r--kernel/trace/Makefile4
-rw-r--r--kernel/trace/trace.c10
-rw-r--r--kernel/trace/trace_probe.h4
13 files changed, 23 insertions, 23 deletions
diff --git a/Documentation/trace/kprobetrace.txt b/Documentation/trace/kprobetrace.txt
index e4991fb1eedc..41ef9d8efe95 100644
--- a/Documentation/trace/kprobetrace.txt
+++ b/Documentation/trace/kprobetrace.txt
@@ -12,7 +12,7 @@ kprobes can probe (this means, all functions body except for __kprobes
12functions). Unlike the Tracepoint based event, this can be added and removed 12functions). Unlike the Tracepoint based event, this can be added and removed
13dynamically, on the fly. 13dynamically, on the fly.
14 14
15To enable this feature, build your kernel with CONFIG_KPROBE_EVENT=y. 15To enable this feature, build your kernel with CONFIG_KPROBE_EVENTS=y.
16 16
17Similar to the events tracer, this doesn't need to be activated via 17Similar to the events tracer, this doesn't need to be activated via
18current_tracer. Instead of that, add probe points via 18current_tracer. Instead of that, add probe points via
diff --git a/Documentation/trace/uprobetracer.txt b/Documentation/trace/uprobetracer.txt
index fa7b680ee8a0..bf526a7c5559 100644
--- a/Documentation/trace/uprobetracer.txt
+++ b/Documentation/trace/uprobetracer.txt
@@ -7,7 +7,7 @@
7Overview 7Overview
8-------- 8--------
9Uprobe based trace events are similar to kprobe based trace events. 9Uprobe based trace events are similar to kprobe based trace events.
10To enable this feature, build your kernel with CONFIG_UPROBE_EVENT=y. 10To enable this feature, build your kernel with CONFIG_UPROBE_EVENTS=y.
11 11
12Similar to the kprobe-event tracer, this doesn't need to be activated via 12Similar to the kprobe-event tracer, this doesn't need to be activated via
13current_tracer. Instead of that, add probe points via 13current_tracer. Instead of that, add probe points via
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig
index 143b1e00b818..4b176fe83da4 100644
--- a/arch/s390/configs/default_defconfig
+++ b/arch/s390/configs/default_defconfig
@@ -609,7 +609,7 @@ CONFIG_SCHED_TRACER=y
609CONFIG_FTRACE_SYSCALLS=y 609CONFIG_FTRACE_SYSCALLS=y
610CONFIG_STACK_TRACER=y 610CONFIG_STACK_TRACER=y
611CONFIG_BLK_DEV_IO_TRACE=y 611CONFIG_BLK_DEV_IO_TRACE=y
612CONFIG_UPROBE_EVENT=y 612CONFIG_UPROBE_EVENTS=y
613CONFIG_FUNCTION_PROFILER=y 613CONFIG_FUNCTION_PROFILER=y
614CONFIG_HIST_TRIGGERS=y 614CONFIG_HIST_TRIGGERS=y
615CONFIG_TRACE_ENUM_MAP_FILE=y 615CONFIG_TRACE_ENUM_MAP_FILE=y
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig
index f05d2d6e1087..0de46cc397f6 100644
--- a/arch/s390/configs/gcov_defconfig
+++ b/arch/s390/configs/gcov_defconfig
@@ -560,7 +560,7 @@ CONFIG_SCHED_TRACER=y
560CONFIG_FTRACE_SYSCALLS=y 560CONFIG_FTRACE_SYSCALLS=y
561CONFIG_STACK_TRACER=y 561CONFIG_STACK_TRACER=y
562CONFIG_BLK_DEV_IO_TRACE=y 562CONFIG_BLK_DEV_IO_TRACE=y
563CONFIG_UPROBE_EVENT=y 563CONFIG_UPROBE_EVENTS=y
564CONFIG_FUNCTION_PROFILER=y 564CONFIG_FUNCTION_PROFILER=y
565CONFIG_HIST_TRIGGERS=y 565CONFIG_HIST_TRIGGERS=y
566CONFIG_TRACE_ENUM_MAP_FILE=y 566CONFIG_TRACE_ENUM_MAP_FILE=y
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
index 2358bf33c5ef..e167557b434c 100644
--- a/arch/s390/configs/performance_defconfig
+++ b/arch/s390/configs/performance_defconfig
@@ -558,7 +558,7 @@ CONFIG_SCHED_TRACER=y
558CONFIG_FTRACE_SYSCALLS=y 558CONFIG_FTRACE_SYSCALLS=y
559CONFIG_STACK_TRACER=y 559CONFIG_STACK_TRACER=y
560CONFIG_BLK_DEV_IO_TRACE=y 560CONFIG_BLK_DEV_IO_TRACE=y
561CONFIG_UPROBE_EVENT=y 561CONFIG_UPROBE_EVENTS=y
562CONFIG_FUNCTION_PROFILER=y 562CONFIG_FUNCTION_PROFILER=y
563CONFIG_HIST_TRIGGERS=y 563CONFIG_HIST_TRIGGERS=y
564CONFIG_TRACE_ENUM_MAP_FILE=y 564CONFIG_TRACE_ENUM_MAP_FILE=y
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 68bfd09f1b02..97189dbaf34b 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -179,7 +179,7 @@ CONFIG_FTRACE_SYSCALLS=y
179CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y 179CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y
180CONFIG_STACK_TRACER=y 180CONFIG_STACK_TRACER=y
181CONFIG_BLK_DEV_IO_TRACE=y 181CONFIG_BLK_DEV_IO_TRACE=y
182CONFIG_UPROBE_EVENT=y 182CONFIG_UPROBE_EVENTS=y
183CONFIG_FUNCTION_PROFILER=y 183CONFIG_FUNCTION_PROFILER=y
184CONFIG_TRACE_ENUM_MAP_FILE=y 184CONFIG_TRACE_ENUM_MAP_FILE=y
185CONFIG_KPROBES_SANITY_TEST=y 185CONFIG_KPROBES_SANITY_TEST=y
diff --git a/arch/x86/kernel/kprobes/common.h b/arch/x86/kernel/kprobes/common.h
index c6ee63f927ab..d688826e5736 100644
--- a/arch/x86/kernel/kprobes/common.h
+++ b/arch/x86/kernel/kprobes/common.h
@@ -67,7 +67,7 @@
67#endif 67#endif
68 68
69/* Ensure if the instruction can be boostable */ 69/* Ensure if the instruction can be boostable */
70extern int can_boost(kprobe_opcode_t *instruction); 70extern int can_boost(kprobe_opcode_t *instruction, void *addr);
71/* Recover instruction if given address is probed */ 71/* Recover instruction if given address is probed */
72extern unsigned long recover_probed_instruction(kprobe_opcode_t *buf, 72extern unsigned long recover_probed_instruction(kprobe_opcode_t *buf,
73 unsigned long addr); 73 unsigned long addr);
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 6384eb754a58..993fa4fe4f68 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -167,12 +167,12 @@ NOKPROBE_SYMBOL(skip_prefixes);
167 * Returns non-zero if opcode is boostable. 167 * Returns non-zero if opcode is boostable.
168 * RIP relative instructions are adjusted at copying time in 64 bits mode 168 * RIP relative instructions are adjusted at copying time in 64 bits mode
169 */ 169 */
170int can_boost(kprobe_opcode_t *opcodes) 170int can_boost(kprobe_opcode_t *opcodes, void *addr)
171{ 171{
172 kprobe_opcode_t opcode; 172 kprobe_opcode_t opcode;
173 kprobe_opcode_t *orig_opcodes = opcodes; 173 kprobe_opcode_t *orig_opcodes = opcodes;
174 174
175 if (search_exception_tables((unsigned long)opcodes)) 175 if (search_exception_tables((unsigned long)addr))
176 return 0; /* Page fault may occur on this address. */ 176 return 0; /* Page fault may occur on this address. */
177 177
178retry: 178retry:
@@ -417,7 +417,7 @@ static int arch_copy_kprobe(struct kprobe *p)
417 * __copy_instruction can modify the displacement of the instruction, 417 * __copy_instruction can modify the displacement of the instruction,
418 * but it doesn't affect boostable check. 418 * but it doesn't affect boostable check.
419 */ 419 */
420 if (can_boost(p->ainsn.insn)) 420 if (can_boost(p->ainsn.insn, p->addr))
421 p->ainsn.boostable = 0; 421 p->ainsn.boostable = 0;
422 else 422 else
423 p->ainsn.boostable = -1; 423 p->ainsn.boostable = -1;
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index 3d1bee9d6a72..3e7c6e5a08ff 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -178,7 +178,7 @@ static int copy_optimized_instructions(u8 *dest, u8 *src)
178 178
179 while (len < RELATIVEJUMP_SIZE) { 179 while (len < RELATIVEJUMP_SIZE) {
180 ret = __copy_instruction(dest + len, src + len); 180 ret = __copy_instruction(dest + len, src + len);
181 if (!ret || !can_boost(dest + len)) 181 if (!ret || !can_boost(dest + len, src + len))
182 return -EINVAL; 182 return -EINVAL;
183 len += ret; 183 len += ret;
184 } 184 }
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index d5038005eb5d..d4a06e714645 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -429,7 +429,7 @@ config BLK_DEV_IO_TRACE
429 429
430 If unsure, say N. 430 If unsure, say N.
431 431
432config KPROBE_EVENT 432config KPROBE_EVENTS
433 depends on KPROBES 433 depends on KPROBES
434 depends on HAVE_REGS_AND_STACK_ACCESS_API 434 depends on HAVE_REGS_AND_STACK_ACCESS_API
435 bool "Enable kprobes-based dynamic events" 435 bool "Enable kprobes-based dynamic events"
@@ -447,7 +447,7 @@ config KPROBE_EVENT
447 This option is also required by perf-probe subcommand of perf tools. 447 This option is also required by perf-probe subcommand of perf tools.
448 If you want to use perf tools, this option is strongly recommended. 448 If you want to use perf tools, this option is strongly recommended.
449 449
450config UPROBE_EVENT 450config UPROBE_EVENTS
451 bool "Enable uprobes-based dynamic events" 451 bool "Enable uprobes-based dynamic events"
452 depends on ARCH_SUPPORTS_UPROBES 452 depends on ARCH_SUPPORTS_UPROBES
453 depends on MMU 453 depends on MMU
@@ -466,7 +466,7 @@ config UPROBE_EVENT
466 466
467config BPF_EVENTS 467config BPF_EVENTS
468 depends on BPF_SYSCALL 468 depends on BPF_SYSCALL
469 depends on (KPROBE_EVENT || UPROBE_EVENT) && PERF_EVENTS 469 depends on (KPROBE_EVENTS || UPROBE_EVENTS) && PERF_EVENTS
470 bool 470 bool
471 default y 471 default y
472 help 472 help
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index e57980845549..90f2701d92a7 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -57,7 +57,7 @@ obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
57obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o 57obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o
58obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o 58obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o
59obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o 59obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o
60obj-$(CONFIG_KPROBE_EVENT) += trace_kprobe.o 60obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe.o
61obj-$(CONFIG_TRACEPOINTS) += power-traces.o 61obj-$(CONFIG_TRACEPOINTS) += power-traces.o
62ifeq ($(CONFIG_PM),y) 62ifeq ($(CONFIG_PM),y)
63obj-$(CONFIG_TRACEPOINTS) += rpm-traces.o 63obj-$(CONFIG_TRACEPOINTS) += rpm-traces.o
@@ -66,7 +66,7 @@ ifeq ($(CONFIG_TRACING),y)
66obj-$(CONFIG_KGDB_KDB) += trace_kdb.o 66obj-$(CONFIG_KGDB_KDB) += trace_kdb.o
67endif 67endif
68obj-$(CONFIG_PROBE_EVENTS) += trace_probe.o 68obj-$(CONFIG_PROBE_EVENTS) += trace_probe.o
69obj-$(CONFIG_UPROBE_EVENT) += trace_uprobe.o 69obj-$(CONFIG_UPROBE_EVENTS) += trace_uprobe.o
70 70
71obj-$(CONFIG_TRACEPOINT_BENCHMARK) += trace_benchmark.o 71obj-$(CONFIG_TRACEPOINT_BENCHMARK) += trace_benchmark.o
72 72
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 707445ceb7ef..f35109514a01 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4341,22 +4341,22 @@ static const char readme_msg[] =
4341 "\t\t\t traces\n" 4341 "\t\t\t traces\n"
4342#endif 4342#endif
4343#endif /* CONFIG_STACK_TRACER */ 4343#endif /* CONFIG_STACK_TRACER */
4344#ifdef CONFIG_KPROBE_EVENT 4344#ifdef CONFIG_KPROBE_EVENTS
4345 " kprobe_events\t\t- Add/remove/show the kernel dynamic events\n" 4345 " kprobe_events\t\t- Add/remove/show the kernel dynamic events\n"
4346 "\t\t\t Write into this file to define/undefine new trace events.\n" 4346 "\t\t\t Write into this file to define/undefine new trace events.\n"
4347#endif 4347#endif
4348#ifdef CONFIG_UPROBE_EVENT 4348#ifdef CONFIG_UPROBE_EVENTS
4349 " uprobe_events\t\t- Add/remove/show the userspace dynamic events\n" 4349 " uprobe_events\t\t- Add/remove/show the userspace dynamic events\n"
4350 "\t\t\t Write into this file to define/undefine new trace events.\n" 4350 "\t\t\t Write into this file to define/undefine new trace events.\n"
4351#endif 4351#endif
4352#if defined(CONFIG_KPROBE_EVENT) || defined(CONFIG_UPROBE_EVENT) 4352#if defined(CONFIG_KPROBE_EVENTS) || defined(CONFIG_UPROBE_EVENTS)
4353 "\t accepts: event-definitions (one definition per line)\n" 4353 "\t accepts: event-definitions (one definition per line)\n"
4354 "\t Format: p|r[:[<group>/]<event>] <place> [<args>]\n" 4354 "\t Format: p|r[:[<group>/]<event>] <place> [<args>]\n"
4355 "\t -:[<group>/]<event>\n" 4355 "\t -:[<group>/]<event>\n"
4356#ifdef CONFIG_KPROBE_EVENT 4356#ifdef CONFIG_KPROBE_EVENTS
4357 "\t place: [<module>:]<symbol>[+<offset>]|<memaddr>\n" 4357 "\t place: [<module>:]<symbol>[+<offset>]|<memaddr>\n"
4358#endif 4358#endif
4359#ifdef CONFIG_UPROBE_EVENT 4359#ifdef CONFIG_UPROBE_EVENTS
4360 "\t place: <path>:<offset>\n" 4360 "\t place: <path>:<offset>\n"
4361#endif 4361#endif
4362 "\t args: <name>=fetcharg[:type]\n" 4362 "\t args: <name>=fetcharg[:type]\n"
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index 0c0ae54d44c6..903273c93e61 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -248,7 +248,7 @@ ASSIGN_FETCH_FUNC(file_offset, ftype), \
248#define FETCH_TYPE_STRING 0 248#define FETCH_TYPE_STRING 0
249#define FETCH_TYPE_STRSIZE 1 249#define FETCH_TYPE_STRSIZE 1
250 250
251#ifdef CONFIG_KPROBE_EVENT 251#ifdef CONFIG_KPROBE_EVENTS
252struct symbol_cache; 252struct symbol_cache;
253unsigned long update_symbol_cache(struct symbol_cache *sc); 253unsigned long update_symbol_cache(struct symbol_cache *sc);
254void free_symbol_cache(struct symbol_cache *sc); 254void free_symbol_cache(struct symbol_cache *sc);
@@ -278,7 +278,7 @@ alloc_symbol_cache(const char *sym, long offset)
278{ 278{
279 return NULL; 279 return NULL;
280} 280}
281#endif /* CONFIG_KPROBE_EVENT */ 281#endif /* CONFIG_KPROBE_EVENTS */
282 282
283struct probe_arg { 283struct probe_arg {
284 struct fetch_param fetch; 284 struct fetch_param fetch;