Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1465694 > unrolled thread
| Started by | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| First post | 2016-08-19 03:00 +0200 |
| Last post | 2016-08-19 05:50 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-19 03:00 +0200
[PATCH 2/3] tools lib: Reinstate strlcpy() header guard with __UCLIBC__ Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-19 03:40 +0200
Re: [GIT PULL 0/3] perf/urgent fixes Ingo Molnar <mingo@kernel.org> - 2016-08-19 04:40 +0200
[PATCH 3/3] perf evsel: Do not access outside hw cache name arrays Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-19 05:50 +0200
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-08-19 03:00 +0200 |
| Subject | [GIT PULL 0/3] perf/urgent fixes |
| Message-ID | <s7Gat-6Ui-7@gated-at.bofh.it> |
Hi Ingo,
Please consider pulling,
- Arnaldo
Build stats at the end of this message.
The following changes since commit 3cace81ea5bb0b3f2b97cab8e2c8e1fae2feb7ed:
Merge tag 'perf-urgent-for-mingo-20160815' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2016-08-16 20:08:56 +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-20160818
for you to fetch changes up to c53412ee8c7ec31373a4176ff7f3a6b79296c05c:
perf evsel: Do not access outside hw cache name arrays (2016-08-18 16:39:46 -0300)
----------------------------------------------------------------
perf/urgent fixes:
- Do not access outside hw cache name arrays (Arnaldo Carvalho de Melo)
- Use addr_location::addr instead of ip for entries when unwinding using
DWARF CFI, fixing the "srcline" information for userspace application
callchains (Milian Wolff)
- Reinstate strlcpy() header guard with __UCLIBC__, fixing the build
with uclibc, detected when building for the ARC architecture (Vineet Gupta)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Arnaldo Carvalho de Melo (1):
perf evsel: Do not access outside hw cache name arrays
Milian Wolff (1):
perf unwind: Use addr_location::addr instead of ip for entries
Vineet Gupta (1):
tools lib: Reinstate strlcpy() header guard with __UCLIBC__
tools/include/linux/string.h | 6 +++++-
tools/perf/util/evsel.c | 6 +++---
tools/perf/util/unwind-libdw.c | 2 +-
tools/perf/util/unwind-libunwind-local.c | 2 +-
4 files changed, 10 insertions(+), 6 deletions(-)
Build stats, now only android-ndk doesn't build with NO_LIBELF=1, as it
doesn't even have libelf to cross build with, and the non-cross builds
build objtool, uClibc and an ARC architecture cross build image are in
the works:
# time dm
1 77.199181517 alpine:3.4: Ok
2 30.215940343 android-ndk:r12b-arm: Ok
3 80.593965325 archlinux:latest: Ok
4 45.102186377 centos:5: Ok
5 67.078635441 centos:6: Ok
6 73.582617061 centos:7: Ok
7 65.462644128 debian:7: Ok
8 69.919139691 debian:8: Ok
9 77.192563446 debian:experimental: Ok
10 80.651363745 fedora:20: Ok
11 85.566954259 fedora:21: Ok
12 87.547437162 fedora:22: Ok
13 94.866327046 fedora:23: Ok
14 93.829320269 fedora:24: Ok
15 94.860933711 fedora:rawhide: Ok
16 88.890456556 mageia:5: Ok
17 85.622890293 opensuse:13.2: Ok
18 87.232034972 opensuse:42.1: Ok
19 94.807172866 opensuse:tumbleweed: Ok
20 72.189153053 ubuntu:12.04.5: Ok
21 86.275708891 ubuntu:14.04.4: Ok
22 90.743742216 ubuntu:15.10: Ok
23 86.931085419 ubuntu:16.04: Ok
24 67.823595709 ubuntu:16.04-x-arm: Ok
25 62.985390761 ubuntu:16.04-x-arm64: Ok
26 64.727635984 ubuntu:16.04-x-powerpc64: Ok
27 63.208264990 ubuntu:16.04-x-powerpc64el: Ok
28 64.685772233 ubuntu:16.04-x-s390: Ok
29 85.089091168 ubuntu:16.10: Ok
2224.88s
real 37m6.200s
user 0m1.830s
sys 0m2.653s
#
[toc] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-08-19 03:40 +0200 |
| Subject | [PATCH 2/3] tools lib: Reinstate strlcpy() header guard with __UCLIBC__ |
| Message-ID | <s7GWR-7sc-5@gated-at.bofh.it> |
| In reply to | #1465694 |
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
perf tools build in recent kernels spews splat when cross compiling with uClibc:
| CC util/alias.o
| In file included from tools/perf/util/../ui/../util/cache.h:8:0,
| from tools/perf/util/../ui/helpline.h:7,
| from tools/perf/util/debug.h:8,
| from arch/../util/cpumap.h:9,
| from arch/../util/env.h:5,
| from arch/common.h:4,
| from arch/common.c:3:
| tools/include/linux/string.h:12:15: warning: redundant redeclaration of ‘strlcpy’ [-Wredundant-decls]
| extern size_t strlcpy(char *dest, const char *src, size_t size);
^
This is after commit 61a6445e463a31 ("tools lib: Guard the strlcpy() header with
__GLIBC__").
The problem is uClibc also defines __GLIBC__ for exported headers for
applications. So add that specific check to not trip for uClibc.
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petri Gynther <pgynther@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: linux-snps-arc@lists.infradead.org
Link: http://lkml.kernel.org/r/1471537703-16439-1-git-send-email-vgupta@synopsys.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/linux/string.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h
index b96879477311..f436d2420a18 100644
--- a/tools/include/linux/string.h
+++ b/tools/include/linux/string.h
@@ -8,7 +8,11 @@ void *memdup(const void *src, size_t len);
int strtobool(const char *s, bool *res);
-#ifdef __GLIBC__
+/*
+ * glibc based builds needs the extern while uClibc doesn't.
+ * However uClibc headers also define __GLIBC__ hence the hack below
+ */
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
extern size_t strlcpy(char *dest, const char *src, size_t size);
#endif
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2016-08-19 04:40 +0200 |
| Message-ID | <s7HSW-892-39@gated-at.bofh.it> |
| In reply to | #1465694 |
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > Hi Ingo, > > Please consider pulling, > > - Arnaldo > > Build stats at the end of this message. > > The following changes since commit 3cace81ea5bb0b3f2b97cab8e2c8e1fae2feb7ed: > > Merge tag 'perf-urgent-for-mingo-20160815' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2016-08-16 20:08:56 +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-20160818 > > for you to fetch changes up to c53412ee8c7ec31373a4176ff7f3a6b79296c05c: > > perf evsel: Do not access outside hw cache name arrays (2016-08-18 16:39:46 -0300) > > ---------------------------------------------------------------- > perf/urgent fixes: > > - Do not access outside hw cache name arrays (Arnaldo Carvalho de Melo) > > - Use addr_location::addr instead of ip for entries when unwinding using > DWARF CFI, fixing the "srcline" information for userspace application > callchains (Milian Wolff) > > - Reinstate strlcpy() header guard with __UCLIBC__, fixing the build > with uclibc, detected when building for the ARC architecture (Vineet Gupta) > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> > > ---------------------------------------------------------------- > Arnaldo Carvalho de Melo (1): > perf evsel: Do not access outside hw cache name arrays > > Milian Wolff (1): > perf unwind: Use addr_location::addr instead of ip for entries > > Vineet Gupta (1): > tools lib: Reinstate strlcpy() header guard with __UCLIBC__ > > tools/include/linux/string.h | 6 +++++- > tools/perf/util/evsel.c | 6 +++--- > tools/perf/util/unwind-libdw.c | 2 +- > tools/perf/util/unwind-libunwind-local.c | 2 +- > 4 files changed, 10 insertions(+), 6 deletions(-) > > Build stats, now only android-ndk doesn't build with NO_LIBELF=1, as it > doesn't even have libelf to cross build with, and the non-cross builds > build objtool, uClibc and an ARC architecture cross build image are in > the works: > > # time dm > 1 77.199181517 alpine:3.4: Ok > 2 30.215940343 android-ndk:r12b-arm: Ok > 3 80.593965325 archlinux:latest: Ok > 4 45.102186377 centos:5: Ok > 5 67.078635441 centos:6: Ok > 6 73.582617061 centos:7: Ok > 7 65.462644128 debian:7: Ok > 8 69.919139691 debian:8: Ok > 9 77.192563446 debian:experimental: Ok > 10 80.651363745 fedora:20: Ok > 11 85.566954259 fedora:21: Ok > 12 87.547437162 fedora:22: Ok > 13 94.866327046 fedora:23: Ok > 14 93.829320269 fedora:24: Ok > 15 94.860933711 fedora:rawhide: Ok > 16 88.890456556 mageia:5: Ok > 17 85.622890293 opensuse:13.2: Ok > 18 87.232034972 opensuse:42.1: Ok > 19 94.807172866 opensuse:tumbleweed: Ok > 20 72.189153053 ubuntu:12.04.5: Ok > 21 86.275708891 ubuntu:14.04.4: Ok > 22 90.743742216 ubuntu:15.10: Ok > 23 86.931085419 ubuntu:16.04: Ok > 24 67.823595709 ubuntu:16.04-x-arm: Ok > 25 62.985390761 ubuntu:16.04-x-arm64: Ok > 26 64.727635984 ubuntu:16.04-x-powerpc64: Ok > 27 63.208264990 ubuntu:16.04-x-powerpc64el: Ok > 28 64.685772233 ubuntu:16.04-x-s390: Ok > 29 85.089091168 ubuntu:16.10: Ok > 2224.88s > > real 37m6.200s > user 0m1.830s > sys 0m2.653s > # Pulled, thanks a lot Arnaldo! Ingo
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-08-19 05:50 +0200 |
| Subject | [PATCH 3/3] perf evsel: Do not access outside hw cache name arrays |
| Message-ID | <s7IYF-kP-7@gated-at.bofh.it> |
| In reply to | #1465694 |
From: Arnaldo Carvalho de Melo <acme@redhat.com>
We have to check if the values are >= *_MAX, not just >, fix it.
From the bugzilla report:
''In file /tools/perf/util/evsel.c function __perf_evsel__hw_cache_name
it appears that there is a bug that reads beyond the end of the buffer.
The statement "if (type > PERF_COUNT_HW_CACHE_MAX)" allows type to be
equal to the maximum value. Later, when statement "if
(!perf_evsel__is_cache_op_valid(type, op))" is executed, the function
can access array perf_evsel__hw_cache_stat[type] beyond the end of the
buffer.
It appears to me that the statement "if (type > PERF_COUNT_HW_CACHE_MAX)"
should be "if (type >= PERF_COUNT_HW_CACHE_MAX)"
Bug found with Coverity and manual code review. No attempts were made to
execute the code with a maximum type value.''
Committer note:
Testing it:
$ perf record -e $(echo $(perf list cache | cut -d \[ -f1) | sed 's/ /,/g') usleep 1
[ perf record: Woken up 16 times to write data ]
[ perf record: Captured and wrote 0.023 MB perf.data (34 samples) ]
$ perf evlist
L1-dcache-load-misses
L1-dcache-loads
L1-dcache-stores
L1-icache-load-misses
LLC-load-misses
LLC-loads
LLC-store-misses
LLC-stores
branch-load-misses
branch-loads
dTLB-load-misses
dTLB-loads
dTLB-store-misses
dTLB-stores
iTLB-load-misses
iTLB-loads
node-load-misses
node-loads
node-store-misses
node-stores
$ perf list cache
List of pre-defined events (to be used in -e):
L1-dcache-load-misses [Hardware cache event]
L1-dcache-loads [Hardware cache event]
L1-dcache-stores [Hardware cache event]
L1-icache-load-misses [Hardware cache event]
LLC-load-misses [Hardware cache event]
LLC-loads [Hardware cache event]
LLC-store-misses [Hardware cache event]
LLC-stores [Hardware cache event]
branch-load-misses [Hardware cache event]
branch-loads [Hardware cache event]
dTLB-load-misses [Hardware cache event]
dTLB-loads [Hardware cache event]
dTLB-store-misses [Hardware cache event]
dTLB-stores [Hardware cache event]
iTLB-load-misses [Hardware cache event]
iTLB-loads [Hardware cache event]
node-load-misses [Hardware cache event]
node-loads [Hardware cache event]
node-store-misses [Hardware cache event]
node-stores [Hardware cache event]
$
Reported-by: Brian Sweeney <bsweeney@lgsinnovations.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=153351
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d9b80ef881cd..21fd573106ed 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -507,17 +507,17 @@ static int __perf_evsel__hw_cache_name(u64 config, char *bf, size_t size)
u8 op, result, type = (config >> 0) & 0xff;
const char *err = "unknown-ext-hardware-cache-type";
- if (type > PERF_COUNT_HW_CACHE_MAX)
+ if (type >= PERF_COUNT_HW_CACHE_MAX)
goto out_err;
op = (config >> 8) & 0xff;
err = "unknown-ext-hardware-cache-op";
- if (op > PERF_COUNT_HW_CACHE_OP_MAX)
+ if (op >= PERF_COUNT_HW_CACHE_OP_MAX)
goto out_err;
result = (config >> 16) & 0xff;
err = "unknown-ext-hardware-cache-result";
- if (result > PERF_COUNT_HW_CACHE_RESULT_MAX)
+ if (result >= PERF_COUNT_HW_CACHE_RESULT_MAX)
goto out_err;
err = "invalid-cache";
--
2.7.4
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web