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: <20210223062440.15848-1-liuyun01@kylinos.cn>
Date:   Tue, 23 Feb 2021 14:24:40 +0800
From:   Jackie Liu <jackieliu2113@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     Jackie Liu <liuyun01@...inos.cn>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>
Subject: [PATCH] perf tools: check perf_event_paranoid and kptr_restrict on 'perf top'

Perf top will segfault, we should give prompt information like perf
record instead of crashing directly.

Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Mark Rutland <mark.rutland@....com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Signed-off-by: Jackie Liu <liuyun01@...inos.cn>
---
 tools/perf/builtin-top.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 3673c04d16b6..b257fadba3bd 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1239,6 +1239,14 @@ static int __cmd_top(struct perf_top *top)
 			return ret;
 	}
 
+	if (symbol_conf.kptr_restrict && !evlist__exclude_kernel(top->evlist)) {
+		pr_warning(
+"Kernel address maps (/proc/{kallsyms,modules}) are restricted.\n\n"
+"Check /proc/sys/kernel/kptr_restrict and /proc/sys/kernel/perf_event_paranoid.\n\n"
+"Kernel samples will not be resolved.\n");
+		return -1;
+	}
+
 	ret = callchain_param__setup_sample_type(&callchain_param);
 	if (ret)
 		return ret;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ