* [GIT PULL 0/3] perf/urgent fixes
@ 2015-09-01 16:14 Arnaldo Carvalho de Melo
2015-09-01 16:14 ` [PATCH 1/3] perf dwarf: Fix potential array out of bounds access Arnaldo Carvalho de Melo
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-01 16:14 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter, Andi Kleen,
David Ahern, David S . Miller, Jiri Olsa, Kan Liang,
Masami Hiramatsu, Namhyung Kim, Peter Zijlstra, pi3orama,
Stephane Eranian, Wang Nan, Zefan Li, Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit 532026612455a4a6fd27c1b2e7111263f63218a2:
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-09-01 10:25:57 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
for you to fetch changes up to af4aeadd8c04303c0aa2d112145c3627e2ebd026:
perf tools: Fix link time error with sample_reg_masks on non x86 (2015-09-01 13:04:41 -0300)
----------------------------------------------------------------
perf/urgent fixes:
- 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>
----------------------------------------------------------------
Stephane Eranian (1):
perf tools: Fix link time error with sample_reg_masks on non x86
Wang Nan (2):
perf dwarf: Fix potential array out of bounds access
perf build: Fix Intel PT instruction decoder dependency problem
tools/perf/arch/sh/util/dwarf-regs.c | 2 +-
tools/perf/arch/sparc/util/dwarf-regs.c | 2 +-
tools/perf/arch/x86/util/dwarf-regs.c | 2 +-
tools/perf/arch/x86/util/perf_regs.c | 44 ++++++++++++++++-----------------
tools/perf/util/intel-pt-decoder/Build | 1 +
tools/perf/util/perf_regs.c | 4 +++
tools/perf/util/perf_regs.h | 2 ++
7 files changed, 31 insertions(+), 26 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] perf dwarf: Fix potential array out of bounds access
2015-09-01 16:14 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
@ 2015-09-01 16:14 ` Arnaldo Carvalho de Melo
2015-09-01 16:14 ` [PATCH 2/3] perf build: Fix Intel PT instruction decoder dependency problem Arnaldo Carvalho de Melo
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-01 16:14 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Wang Nan, David S. Miller, Zefan Li, pi3orama,
Arnaldo Carvalho de Melo
From: Wang Nan <wangnan0@huawei.com>
There is a problem in the dwarf-regs.c files for sh, sparc and x86 where
it is possible to make an out-of-bounds array access when searching for
register names.
This patch fixes it by replacing '<=' to '<', so when register (number
== XXX_MAX_REGS), get_arch_regstr() will return NULL.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Reviewed-by: Matt Fleming <matt@console-pimps.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@huawei.com
Link: http://lkml.kernel.org/r/1441078184-105038-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/sh/util/dwarf-regs.c | 2 +-
tools/perf/arch/sparc/util/dwarf-regs.c | 2 +-
tools/perf/arch/x86/util/dwarf-regs.c | 2 +-
3 files changed, 3 insertions(+), 3 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] = {
/* Return architecture dependent register string (for kprobe-tracer) */
const char *get_arch_regstr(unsigned int n)
{
- return (n <= SH_MAX_REGS) ? sh_regs_table[n] : NULL;
+ return (n < SH_MAX_REGS) ? sh_regs_table[n] : NULL;
}
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] = {
*/
const char *get_arch_regstr(unsigned int n)
{
- return (n <= SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL;
+ return (n < SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL;
}
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] = {
/* Return architecture dependent register string (for kprobe-tracer) */
const char *get_arch_regstr(unsigned int n)
{
- return (n <= ARCH_MAX_REGS) ? arch_regs_table[n] : NULL;
+ return (n < ARCH_MAX_REGS) ? arch_regs_table[n] : NULL;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] perf build: Fix Intel PT instruction decoder dependency problem
2015-09-01 16:14 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
2015-09-01 16:14 ` [PATCH 1/3] perf dwarf: Fix potential array out of bounds access Arnaldo Carvalho de Melo
@ 2015-09-01 16:14 ` Arnaldo Carvalho de Melo
2015-09-01 16:14 ` [PATCH 3/3] perf tools: Fix link time error with sample_reg_masks on non x86 Arnaldo Carvalho de Melo
2015-09-02 7:24 ` [GIT PULL 0/3] perf/urgent fixes Ingo Molnar
3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-01 16:14 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Wang Nan, Zefan Li, pi3orama,
Arnaldo Carvalho de Melo
From: Wang Nan <wangnan0@huawei.com>
I hit following building error randomly:
...
/bin/sh: /path/to/kernel/buildperf/util/intel-pt-decoder/inat-tables.c: No such file or directory
...
LINK /path/to/kernel/buildperf/plugin_mac80211.so
LINK /path/to/kernel/buildperf/plugin_kmem.so
LINK /path/to/kernel/buildperf/plugin_xen.so
LINK /path/to/kernel/buildperf/plugin_hrtimer.so
In file included from util/intel-pt-decoder/intel-pt-insn-decoder.c:25:0:
util/intel-pt-decoder/inat.c:24:25: fatal error: inat-tables.c: No such file or directory
#include "inat-tables.c"
^
compilation terminated.
make[4]: *** [/path/to/kernel/buildperf/util/intel-pt-decoder/intel-pt-insn-decoder.o] Error 1
make[4]: *** Waiting for unfinished jobs....
LINK /path/to/kernel/buildperf/plugin_function.so
This is caused by tools/perf/util/intel-pt-decoder/Build that, it tries
to generate $(OUTPUT)util/intel-pt-decoder/inat-tables.c atomatically
but forget to ensure the existance of $(OUTPUT)util/intel-pt-decoder
directory.
This patch fixes it by adding $(call rule_mkdir) like other similar rules.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1441087005-107540-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/intel-pt-decoder/Build | 1 +
1 file changed, 1 insertion(+)
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
inat_tables_maps = util/intel-pt-decoder/x86-opcode-map.txt
$(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
+ $(call rule_mkdir)
@$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@
$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] perf tools: Fix link time error with sample_reg_masks on non x86
2015-09-01 16:14 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
2015-09-01 16:14 ` [PATCH 1/3] perf dwarf: Fix potential array out of bounds access Arnaldo Carvalho de Melo
2015-09-01 16:14 ` [PATCH 2/3] perf build: Fix Intel PT instruction decoder dependency problem Arnaldo Carvalho de Melo
@ 2015-09-01 16:14 ` Arnaldo Carvalho de Melo
2015-09-02 7:24 ` [GIT PULL 0/3] perf/urgent fixes Ingo Molnar
3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-01 16:14 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Stephane Eranian, Adrian Hunter, Andi Kleen,
David Ahern, Kan Liang, Namhyung Kim, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Stephane Eranian <eranian@google.com>
This patch makes perf compile on non x86 platforms by defining a weak
symbol for sample_reg_masks[] in util/perf_regs.c.
The patch also moves the REG() and REG_END() macros into the
util/per_regs.h header file. The macros are renamed to
SMPL_REG/SMPL_REG_END to avoid clashes with other header files.
Signed-off-by: Stephane Eranian <eranian@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1441099814-26783-1-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/x86/util/perf_regs.c | 44 +++++++++++++++++-------------------
tools/perf/util/perf_regs.c | 4 ++++
tools/perf/util/perf_regs.h | 2 ++
3 files changed, 27 insertions(+), 23 deletions(-)
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 @@
#include "../../perf.h"
#include "../../util/perf_regs.h"
-#define REG(n, b) { .name = #n, .mask = 1ULL << (b) }
-#define REG_END { .name = NULL }
const struct sample_reg sample_reg_masks[] = {
- REG(AX, PERF_REG_X86_AX),
- REG(BX, PERF_REG_X86_BX),
- REG(CX, PERF_REG_X86_CX),
- REG(DX, PERF_REG_X86_DX),
- REG(SI, PERF_REG_X86_SI),
- REG(DI, PERF_REG_X86_DI),
- REG(BP, PERF_REG_X86_BP),
- REG(SP, PERF_REG_X86_SP),
- REG(IP, PERF_REG_X86_IP),
- REG(FLAGS, PERF_REG_X86_FLAGS),
- REG(CS, PERF_REG_X86_CS),
- REG(SS, PERF_REG_X86_SS),
+ SMPL_REG(AX, PERF_REG_X86_AX),
+ SMPL_REG(BX, PERF_REG_X86_BX),
+ SMPL_REG(CX, PERF_REG_X86_CX),
+ SMPL_REG(DX, PERF_REG_X86_DX),
+ SMPL_REG(SI, PERF_REG_X86_SI),
+ SMPL_REG(DI, PERF_REG_X86_DI),
+ SMPL_REG(BP, PERF_REG_X86_BP),
+ SMPL_REG(SP, PERF_REG_X86_SP),
+ SMPL_REG(IP, PERF_REG_X86_IP),
+ SMPL_REG(FLAGS, PERF_REG_X86_FLAGS),
+ SMPL_REG(CS, PERF_REG_X86_CS),
+ SMPL_REG(SS, PERF_REG_X86_SS),
#ifdef HAVE_ARCH_X86_64_SUPPORT
- REG(R8, PERF_REG_X86_R8),
- REG(R9, PERF_REG_X86_R9),
- REG(R10, PERF_REG_X86_R10),
- REG(R11, PERF_REG_X86_R11),
- REG(R12, PERF_REG_X86_R12),
- REG(R13, PERF_REG_X86_R13),
- REG(R14, PERF_REG_X86_R14),
- REG(R15, PERF_REG_X86_R15),
+ SMPL_REG(R8, PERF_REG_X86_R8),
+ SMPL_REG(R9, PERF_REG_X86_R9),
+ SMPL_REG(R10, PERF_REG_X86_R10),
+ SMPL_REG(R11, PERF_REG_X86_R11),
+ SMPL_REG(R12, PERF_REG_X86_R12),
+ SMPL_REG(R13, PERF_REG_X86_R13),
+ SMPL_REG(R14, PERF_REG_X86_R14),
+ SMPL_REG(R15, PERF_REG_X86_R15),
#endif
- REG_END
+ SMPL_REG_END
};
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 @@
#include "perf_regs.h"
#include "event.h"
+const struct sample_reg __weak sample_reg_masks[] = {
+ SMPL_REG_END
+};
+
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
{
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 {
const char *name;
uint64_t mask;
};
+#define SMPL_REG(n, b) { .name = #n, .mask = 1ULL << (b) }
+#define SMPL_REG_END { .name = NULL }
extern const struct sample_reg sample_reg_masks[];
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [GIT PULL 0/3] perf/urgent fixes
2015-09-01 16:14 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2015-09-01 16:14 ` [PATCH 3/3] perf tools: Fix link time error with sample_reg_masks on non x86 Arnaldo Carvalho de Melo
@ 2015-09-02 7:24 ` Ingo Molnar
3 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2015-09-02 7:24 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Adrian Hunter, Andi Kleen, David Ahern,
David S . Miller, Jiri Olsa, Kan Liang, Masami Hiramatsu,
Namhyung Kim, Peter Zijlstra, pi3orama, Stephane Eranian,
Wang Nan, Zefan Li, Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> The following changes since commit 532026612455a4a6fd27c1b2e7111263f63218a2:
>
> Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-09-01 10:25:57 +0200)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
>
> for you to fetch changes up to af4aeadd8c04303c0aa2d112145c3627e2ebd026:
>
> perf tools: Fix link time error with sample_reg_masks on non x86 (2015-09-01 13:04:41 -0300)
>
> ----------------------------------------------------------------
> perf/urgent fixes:
>
> - 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>
>
> ----------------------------------------------------------------
> Stephane Eranian (1):
> perf tools: Fix link time error with sample_reg_masks on non x86
>
> Wang Nan (2):
> perf dwarf: Fix potential array out of bounds access
> perf build: Fix Intel PT instruction decoder dependency problem
>
> tools/perf/arch/sh/util/dwarf-regs.c | 2 +-
> tools/perf/arch/sparc/util/dwarf-regs.c | 2 +-
> tools/perf/arch/x86/util/dwarf-regs.c | 2 +-
> tools/perf/arch/x86/util/perf_regs.c | 44 ++++++++++++++++-----------------
> tools/perf/util/intel-pt-decoder/Build | 1 +
> tools/perf/util/perf_regs.c | 4 +++
> tools/perf/util/perf_regs.h | 2 ++
> 7 files changed, 31 insertions(+), 26 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-09-02 7:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01 16:14 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
2015-09-01 16:14 ` [PATCH 1/3] perf dwarf: Fix potential array out of bounds access Arnaldo Carvalho de Melo
2015-09-01 16:14 ` [PATCH 2/3] perf build: Fix Intel PT instruction decoder dependency problem Arnaldo Carvalho de Melo
2015-09-01 16:14 ` [PATCH 3/3] perf tools: Fix link time error with sample_reg_masks on non x86 Arnaldo Carvalho de Melo
2015-09-02 7:24 ` [GIT PULL 0/3] perf/urgent fixes Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).