diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-09-02 03:22:53 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-09-02 03:22:53 -0400 |
commit | 5b923564ccf43f92969c9e0fd199c8c5db657039 (patch) | |
tree | 569c570d011874e21ff08843e223763338ffdf38 | |
parent | 532026612455a4a6fd27c1b2e7111263f63218a2 (diff) | |
parent | af4aeadd8c04303c0aa2d112145c3627e2ebd026 (diff) |
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
- Fix link time error with sample_reg_masks on non-x86. (Stephane Eranian)
- Fix potential array out of bounds access. (Wang Nan)
- Fix Intel PT instruction decoder dependency problem. (Wang Nan)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | tools/perf/arch/sh/util/dwarf-regs.c | 2 | ||||
-rw-r--r-- | tools/perf/arch/sparc/util/dwarf-regs.c | 2 | ||||
-rw-r--r-- | tools/perf/arch/x86/util/dwarf-regs.c | 2 | ||||
-rw-r--r-- | tools/perf/arch/x86/util/perf_regs.c | 44 | ||||
-rw-r--r-- | tools/perf/util/intel-pt-decoder/Build | 1 | ||||
-rw-r--r-- | tools/perf/util/perf_regs.c | 4 | ||||
-rw-r--r-- | tools/perf/util/perf_regs.h | 2 |
7 files changed, 31 insertions, 26 deletions
diff --git a/tools/perf/arch/sh/util/dwarf-regs.c b/tools/perf/arch/sh/util/dwarf-regs.c index 0d0897f57a10..f8dfa89696f4 100644 --- a/tools/perf/arch/sh/util/dwarf-regs.c +++ b/tools/perf/arch/sh/util/dwarf-regs.c | |||
@@ -51,5 +51,5 @@ const char *sh_regs_table[SH_MAX_REGS] = { | |||
51 | /* Return architecture dependent register string (for kprobe-tracer) */ | 51 | /* Return architecture dependent register string (for kprobe-tracer) */ |
52 | const char *get_arch_regstr(unsigned int n) | 52 | const char *get_arch_regstr(unsigned int n) |
53 | { | 53 | { |
54 | return (n <= SH_MAX_REGS) ? sh_regs_table[n] : NULL; | 54 | return (n < SH_MAX_REGS) ? sh_regs_table[n] : NULL; |
55 | } | 55 | } |
diff --git a/tools/perf/arch/sparc/util/dwarf-regs.c b/tools/perf/arch/sparc/util/dwarf-regs.c index 92eda412fed3..b704fdb9237a 100644 --- a/tools/perf/arch/sparc/util/dwarf-regs.c +++ b/tools/perf/arch/sparc/util/dwarf-regs.c | |||
@@ -39,5 +39,5 @@ const char *sparc_regs_table[SPARC_MAX_REGS] = { | |||
39 | */ | 39 | */ |
40 | const char *get_arch_regstr(unsigned int n) | 40 | const char *get_arch_regstr(unsigned int n) |
41 | { | 41 | { |
42 | return (n <= SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL; | 42 | return (n < SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL; |
43 | } | 43 | } |
diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/arch/x86/util/dwarf-regs.c index be22dd463232..a08de0a35b83 100644 --- a/tools/perf/arch/x86/util/dwarf-regs.c +++ b/tools/perf/arch/x86/util/dwarf-regs.c | |||
@@ -71,5 +71,5 @@ const char *x86_64_regs_table[X86_64_MAX_REGS] = { | |||
71 | /* Return architecture dependent register string (for kprobe-tracer) */ | 71 | /* Return architecture dependent register string (for kprobe-tracer) */ |
72 | const char *get_arch_regstr(unsigned int n) | 72 | const char *get_arch_regstr(unsigned int n) |
73 | { | 73 | { |
74 | return (n <= ARCH_MAX_REGS) ? arch_regs_table[n] : NULL; | 74 | return (n < ARCH_MAX_REGS) ? arch_regs_table[n] : NULL; |
75 | } | 75 | } |
diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c index 087c84ef5234..c5db14f36cc7 100644 --- a/tools/perf/arch/x86/util/perf_regs.c +++ b/tools/perf/arch/x86/util/perf_regs.c | |||
@@ -1,30 +1,28 @@ | |||
1 | #include "../../perf.h" | 1 | #include "../../perf.h" |
2 | #include "../../util/perf_regs.h" | 2 | #include "../../util/perf_regs.h" |
3 | 3 | ||
4 | #define REG(n, b) { .name = #n, .mask = 1ULL << (b) } | ||
5 | #define REG_END { .name = NULL } | ||
6 | const struct sample_reg sample_reg_masks[] = { | 4 | const struct sample_reg sample_reg_masks[] = { |
7 | REG(AX, PERF_REG_X86_AX), | 5 | SMPL_REG(AX, PERF_REG_X86_AX), |
8 | REG(BX, PERF_REG_X86_BX), | 6 | SMPL_REG(BX, PERF_REG_X86_BX), |
9 | REG(CX, PERF_REG_X86_CX), | 7 | SMPL_REG(CX, PERF_REG_X86_CX), |
10 | REG(DX, PERF_REG_X86_DX), | 8 | SMPL_REG(DX, PERF_REG_X86_DX), |
11 | REG(SI, PERF_REG_X86_SI), | 9 | SMPL_REG(SI, PERF_REG_X86_SI), |
12 | REG(DI, PERF_REG_X86_DI), | 10 | SMPL_REG(DI, PERF_REG_X86_DI), |
13 | REG(BP, PERF_REG_X86_BP), | 11 | SMPL_REG(BP, PERF_REG_X86_BP), |
14 | REG(SP, PERF_REG_X86_SP), | 12 | SMPL_REG(SP, PERF_REG_X86_SP), |
15 | REG(IP, PERF_REG_X86_IP), | 13 | SMPL_REG(IP, PERF_REG_X86_IP), |
16 | REG(FLAGS, PERF_REG_X86_FLAGS), | 14 | SMPL_REG(FLAGS, PERF_REG_X86_FLAGS), |
17 | REG(CS, PERF_REG_X86_CS), | 15 | SMPL_REG(CS, PERF_REG_X86_CS), |
18 | REG(SS, PERF_REG_X86_SS), | 16 | SMPL_REG(SS, PERF_REG_X86_SS), |
19 | #ifdef HAVE_ARCH_X86_64_SUPPORT | 17 | #ifdef HAVE_ARCH_X86_64_SUPPORT |
20 | REG(R8, PERF_REG_X86_R8), | 18 | SMPL_REG(R8, PERF_REG_X86_R8), |
21 | REG(R9, PERF_REG_X86_R9), | 19 | SMPL_REG(R9, PERF_REG_X86_R9), |
22 | REG(R10, PERF_REG_X86_R10), | 20 | SMPL_REG(R10, PERF_REG_X86_R10), |
23 | REG(R11, PERF_REG_X86_R11), | 21 | SMPL_REG(R11, PERF_REG_X86_R11), |
24 | REG(R12, PERF_REG_X86_R12), | 22 | SMPL_REG(R12, PERF_REG_X86_R12), |
25 | REG(R13, PERF_REG_X86_R13), | 23 | SMPL_REG(R13, PERF_REG_X86_R13), |
26 | REG(R14, PERF_REG_X86_R14), | 24 | SMPL_REG(R14, PERF_REG_X86_R14), |
27 | REG(R15, PERF_REG_X86_R15), | 25 | SMPL_REG(R15, PERF_REG_X86_R15), |
28 | #endif | 26 | #endif |
29 | REG_END | 27 | SMPL_REG_END |
30 | }; | 28 | }; |
diff --git a/tools/perf/util/intel-pt-decoder/Build b/tools/perf/util/intel-pt-decoder/Build index 240730d682c1..2386322ece4f 100644 --- a/tools/perf/util/intel-pt-decoder/Build +++ b/tools/perf/util/intel-pt-decoder/Build | |||
@@ -4,6 +4,7 @@ inat_tables_script = util/intel-pt-decoder/gen-insn-attr-x86.awk | |||
4 | inat_tables_maps = util/intel-pt-decoder/x86-opcode-map.txt | 4 | inat_tables_maps = util/intel-pt-decoder/x86-opcode-map.txt |
5 | 5 | ||
6 | $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_tables_maps) | 6 | $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_tables_maps) |
7 | $(call rule_mkdir) | ||
7 | @$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@ | 8 | @$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@ |
8 | 9 | ||
9 | $(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c | 10 | $(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c |
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c index 43168fb0d9a2..885e8ac83997 100644 --- a/tools/perf/util/perf_regs.c +++ b/tools/perf/util/perf_regs.c | |||
@@ -2,6 +2,10 @@ | |||
2 | #include "perf_regs.h" | 2 | #include "perf_regs.h" |
3 | #include "event.h" | 3 | #include "event.h" |
4 | 4 | ||
5 | const struct sample_reg __weak sample_reg_masks[] = { | ||
6 | SMPL_REG_END | ||
7 | }; | ||
8 | |||
5 | int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) | 9 | int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) |
6 | { | 10 | { |
7 | int i, idx = 0; | 11 | int i, idx = 0; |
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h index 92c1fff2153e..2984dcc54d67 100644 --- a/tools/perf/util/perf_regs.h +++ b/tools/perf/util/perf_regs.h | |||
@@ -9,6 +9,8 @@ struct sample_reg { | |||
9 | const char *name; | 9 | const char *name; |
10 | uint64_t mask; | 10 | uint64_t mask; |
11 | }; | 11 | }; |
12 | #define SMPL_REG(n, b) { .name = #n, .mask = 1ULL << (b) } | ||
13 | #define SMPL_REG_END { .name = NULL } | ||
12 | 14 | ||
13 | extern const struct sample_reg sample_reg_masks[]; | 15 | extern const struct sample_reg sample_reg_masks[]; |
14 | 16 | ||