[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-c766f3df635de14295e410c6dd5410bc416c24a0@git.kernel.org>
Date: Thu, 15 Aug 2019 02:27:47 -0700
From: tip-bot for Igor Lubashev <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: mingo@...nel.org, jmorris@...ei.org, namhyung@...nel.org,
alexander.shishkin@...ux.intel.com, mathieu.poirier@...aro.org,
acme@...hat.com, hpa@...or.com, alexey.budankov@...ux.intel.com,
linux-kernel@...r.kernel.org, peterz@...radead.org,
jolsa@...nel.org, ilubashe@...mai.com, suzuki.poulose@....com,
tglx@...utronix.de
Subject: [tip:perf/core] perf ftrace: Use CAP_SYS_ADMIN instead of euid==0
Commit-ID: c766f3df635de14295e410c6dd5410bc416c24a0
Gitweb: https://git.kernel.org/tip/c766f3df635de14295e410c6dd5410bc416c24a0
Author: Igor Lubashev <ilubashe@...mai.com>
AuthorDate: Wed, 7 Aug 2019 10:44:17 -0400
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 14 Aug 2019 10:59:59 -0300
perf ftrace: Use CAP_SYS_ADMIN instead of euid==0
The kernel requires CAP_SYS_ADMIN instead of euid==0 to mount debugfs
for ftrace. Make perf do the same.
Signed-off-by: Igor Lubashev <ilubashe@...mai.com>
Acked-by: Jiri Olsa <jolsa@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc: James Morris <jmorris@...ei.org>
Cc: Mathieu Poirier <mathieu.poirier@...aro.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Suzuki Poulouse <suzuki.poulose@....com>
Cc: linux-arm-kernel@...ts.infradead.org
Link: http://lkml.kernel.org/r/bd8763b72ed4d58d0b42d44fbc7eb474d32e53a3.1565188228.git.ilubashe@akamai.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/builtin-ftrace.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 20d4c0ce8b53..01a5bb58eb04 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -13,6 +13,7 @@
#include <signal.h>
#include <fcntl.h>
#include <poll.h>
+#include <linux/capability.h>
#include "debug.h"
#include <subcmd/parse-options.h>
@@ -21,6 +22,7 @@
#include "target.h"
#include "cpumap.h"
#include "thread_map.h"
+#include "util/cap.h"
#include "util/config.h"
@@ -281,7 +283,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
.events = POLLIN,
};
- if (geteuid() != 0) {
+ if (!perf_cap__capable(CAP_SYS_ADMIN)) {
pr_err("ftrace only works for root!\n");
return -1;
}
Powered by blists - more mailing lists