lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  4 Sep 2019 15:17:38 +0530
From:   Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
        Ravi Bangoria <ravi.bangoria@...ux.ibm.com>,
        Naveen N Rao <naveen.n.rao@...ux.vnet.ibm.com>
Subject: [PATCH 2/2] perf/stat: Fix a segmentation fault when using repeat forever

Observe a segmentation fault when perf stat is asked to repeat forever
with the interval option.

Without fix:
perf stat -r 0 -I 5000 -e cycles -a sleep 10
 #           time             counts unit events
     5.000211692  3,13,89,82,34,157      cycles
    10.000380119  1,53,98,52,22,294      cycles
    10.040467280       17,16,79,265      cycles
Segmentation fault

This problem was only observed when we use forever option aka -r 0 and
works with limited repeats. Calling print_counter with ts being set to
NULL, is not a correct option when interval is set. Hence avoid
print_counter(NULL,..)  if interval is set.

With fix:
perf stat -r 0 -I 5000 -e cycles -a sleep 10
 #           time             counts unit events
     5.019866622  3,15,14,43,08,697      cycles
    10.039865756  3,15,16,31,95,261      cycles
    10.059950628     1,26,05,47,158      cycles
     5.009902655  3,14,52,62,33,932      cycles
    10.019880228  3,14,52,22,89,154      cycles
    10.030543876       66,90,18,333      cycles
     5.009848281  3,14,51,98,25,437      cycles
    10.029854402  3,15,14,93,04,918      cycles
     5.009834177  3,14,51,95,92,316      cycles

Signed-off-by: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
---
 tools/perf/builtin-stat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index eda451842bfd..8ec06bf3372c 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1965,7 +1965,7 @@ int cmd_stat(int argc, const char **argv)
 			perf_evlist__reset_prev_raw_counts(evsel_list);
 
 		status = run_perf_stat(argc, argv, run_idx);
-		if (forever && status != -1) {
+		if (forever && status != -1 && !interval) {
 			print_counters(NULL, argc, argv);
 			perf_stat__reset_stats();
 		}
-- 
2.18.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ