From: Sasha Levin <sashal@kernel•org>
To: linux-kernel@vger•kernel.org, stable@vger•kernel.org
Cc: Sasha Levin <sashal@kernel•org>,
Mathieu Poirier <mathieu.poirier@linaro•org>,
Suzuki Poulouse <suzuki.poulose@arm•com>,
Alexander Shishkin <alexander.shishkin@linux•intel.com>,
Alexey Budankov <alexey.budankov@linux•intel.com>,
Igor Lubashev <ilubashe@akamai•com>,
James Morris <jmorris@namei•org>,
Arnaldo Carvalho de Melo <acme@redhat•com>,
Peter Zijlstra <peterz@infradead•org>,
Jiri Olsa <jolsa@kernel•org>, Namhyung Kim <namhyung@kernel•org>,
linux-arm-kernel@lists•infradead.org
Subject: [PATCH AUTOSEL 4.19 051/128] perf ftrace: Use CAP_SYS_ADMIN instead of euid==0
Date: Sun, 22 Sep 2019 14:53:01 -0400 [thread overview]
Message-ID: <20190922185418.2158-51-sashal@kernel.org> (raw)
In-Reply-To: <20190922185418.2158-1-sashal@kernel.org>
From: Igor Lubashev <ilubashe@akamai•com>
[ Upstream commit c766f3df635de14295e410c6dd5410bc416c24a0 ]
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@akamai•com>
Acked-by: Jiri Olsa <jolsa@kernel•org>
Cc: Alexander Shishkin <alexander.shishkin@linux•intel.com>
Cc: Alexey Budankov <alexey.budankov@linux•intel.com>
Cc: James Morris <jmorris@namei•org>
Cc: Mathieu Poirier <mathieu.poirier@linaro•org>
Cc: Namhyung Kim <namhyung@kernel•org>
Cc: Peter Zijlstra <peterz@infradead•org>
Cc: Suzuki Poulouse <suzuki.poulose@arm•com>
Cc: linux-arm-kernel@lists•infradead.org
Link: http://lkml.kernel.org/r/bd8763b72ed4d58d0b42d44fbc7eb474d32e53a3.1565188228.git.ilubashe@akamai.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat•com>
Signed-off-by: Sasha Levin <sashal@kernel•org>
---
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 137955197ba8d..e0c61c572db06 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -14,6 +14,7 @@
#include <signal.h>
#include <fcntl.h>
#include <poll.h>
+#include <linux/capability.h>
#include "debug.h"
#include <subcmd/parse-options.h>
@@ -22,6 +23,7 @@
#include "target.h"
#include "cpumap.h"
#include "thread_map.h"
+#include "util/cap.h"
#include "util/config.h"
@@ -282,7 +284,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;
}
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-09-22 18:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190922185418.2158-1-sashal@kernel.org>
2019-09-22 18:52 ` [PATCH AUTOSEL 4.19 040/128] firmware: arm_scmi: Check if platform has released shmem before using Sasha Levin
2019-09-22 18:53 ` Sasha Levin [this message]
2019-09-22 18:53 ` [PATCH AUTOSEL 4.19 059/128] ARM: dts: imx7d: cl-som-imx7: make ethernet work again Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190922185418.2158-51-sashal@kernel.org \
--to=sashal@kernel$(echo .)org \
--cc=acme@redhat$(echo .)com \
--cc=alexander.shishkin@linux$(echo .)intel.com \
--cc=alexey.budankov@linux$(echo .)intel.com \
--cc=ilubashe@akamai$(echo .)com \
--cc=jmorris@namei$(echo .)org \
--cc=jolsa@kernel$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=mathieu.poirier@linaro$(echo .)org \
--cc=namhyung@kernel$(echo .)org \
--cc=peterz@infradead$(echo .)org \
--cc=stable@vger$(echo .)kernel.org \
--cc=suzuki.poulose@arm$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox