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-next>] [day] [month] [year] [list]
Message-Id: <1380791146-7465-1-git-send-email-artagnon@gmail.com>
Date:	Thu,  3 Oct 2013 14:35:46 +0530
From:	Ramkumar Ramachandra <artagnon@...il.com>
To:	LKML <linux-kernel@...r.kernel.org>
Cc:	Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Subject: [PATCH] perf tool: report user-friendly error from timechart

Earlier, when 'timechart record' was invoked by a user without
permissions to debugfs:

$ perf timechart record
invalid or unsupported event: 'power:cpu_frequency'
Run 'perf list' for a list of valid events

 usage: perf record [<options>] [<command>]
    or: perf record [<options>] -- <command> [<options>]
[... detailed usage information ...]

This is highly user unfriendly, as the real problem is not reported to
the user correctly. Now, the user gets a much more friendly:

$ perf timechart record
Error:  No permissions to read $debugfs/tracing/events/power/cpu_frequency
Hint:   Change the permissions of debugfs: /sys/kernel/debug
        The directory will be present if your kernel was compiled with debugfs support.

Cc: Ingo Molnar <mingo@...nel.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Signed-off-by: Ramkumar Ramachandra <artagnon@...il.com>
---
 tools/perf/builtin-timechart.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index c2e0231..ceaf9b8 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -1056,6 +1056,14 @@ static int __cmd_record(int argc, const char **argv)
 	}
 #endif
 
+	/* Perform a quick sanity check */
+	if (!is_valid_tracepoint("power:cpu_frequency")) {
+		fprintf(stderr, "Error:\tNo permissions to read $debugfs/tracing/events/power/cpu_frequency\n");
+		fprintf(stderr, "Hint:\tChange the permissions of debugfs: /sys/kernel/debug\n");
+		fprintf(stderr, "\tThe directory will be present if your kernel was compiled with debugfs support.\n");
+		return 1;
+	}
+
 	rec_argc = record_elems + argc - 1;
 	rec_argv = calloc(rec_argc + 1, sizeof(char *));
 
-- 
1.8.4.477.g5d89aa9

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ