[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190812202947.GI9280@kernel.org>
Date: Mon, 12 Aug 2019 17:29:47 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Igor Lubashev <ilubashe@...mai.com>
Cc: linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...hat.com>,
Alexey Budankov <alexey.budankov@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
linux-arm-kernel@...ts.infradead.org,
James Morris <jmorris@...ei.org>
Subject: Re: [PATCH v3 4/4] perf: Use CAP_SYS_ADMIN instead of euid==0 with
ftrace
Em Mon, Aug 12, 2019 at 05:27:06PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Aug 12, 2019 at 05:22:51PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Wed, Aug 07, 2019 at 10:44:17AM -0400, Igor Lubashev escreveu:
> > > @@ -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");
> >
> > I guess we should update the error message too?
> >
>
> I.e. I applied this as a follow up patch:
>
> diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> index 01a5bb58eb04..ba8b65c2f9dc 100644
> --- a/tools/perf/builtin-ftrace.c
> +++ b/tools/perf/builtin-ftrace.c
> @@ -284,7 +284,12 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
> };
>
> if (!perf_cap__capable(CAP_SYS_ADMIN)) {
> - pr_err("ftrace only works for root!\n");
> + pr_err("ftrace only works for %s!\n",
> +#ifdef HAVE_LIBCAP_SUPPORT
> + "users with the SYS_ADMIN capability"
> +#else
> + "root"
> +#endif
);
:-)
> return -1;
> }
>
I've pushed the whole set to my tmp.perf/cap branch, please chec
- Arnaldo
Powered by blists - more mailing lists