Message ID | 450d035a-c192-10e5-1c28-664ccae3e46e@linux.intel.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | perf: make Perf tool aware of SELinux access control | expand |
Em Wed, Apr 22, 2020 at 05:44:02PM +0300, Alexey Budankov escreveu: > > Update error message to mention CAP_PERFMON only. CAP_SYS_ADMIN still > works in keeping with user space backward compatibility approach. This will confuse users that build the latest perf to use in older systems where CAP_PERFMON isn't available, probably we need to, in these cases, check for the existence of CAP_PERFMON to provide a better warning message, something like: You need CAP_ADMIN or update your kernel and libcap to one that supports CAP_PERFMON. For systems without CAP_PERFMON, while mentioning only CAP_PERFMON for systems where it is present, right? > Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com> > --- > tools/perf/builtin-ftrace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c > index 55eda54240fb..39d43ad02f30 100644 > --- a/tools/perf/builtin-ftrace.c > +++ b/tools/perf/builtin-ftrace.c > @@ -288,7 +288,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > perf_cap__capable(CAP_SYS_ADMIN))) { > pr_err("ftrace only works for %s!\n", > #ifdef HAVE_LIBCAP_SUPPORT > - "users with the CAP_PERFMON or CAP_SYS_ADMIN capability" > + "users with the CAP_PERFMON capability" > #else > "root" > #endif > -- > 2.24.1 >
On 23.04.2020 16:20, Arnaldo Carvalho de Melo wrote: > Em Wed, Apr 22, 2020 at 05:44:02PM +0300, Alexey Budankov escreveu: >> >> Update error message to mention CAP_PERFMON only. CAP_SYS_ADMIN still >> works in keeping with user space backward compatibility approach. > > This will confuse users that build the latest perf to use in older > systems where CAP_PERFMON isn't available, probably we need to, in these > cases, check for the existence of CAP_PERFMON to provide a better > warning message, something like: > > You need CAP_ADMIN or update your kernel and libcap to one that supports > CAP_PERFMON. > > For systems without CAP_PERFMON, while mentioning only CAP_PERFMON for > systems where it is present, right? Right, but this ideal implementation requires more effort, so staying with two caps in the message and letting users decide which one to use looks like a good balance already. Thanks, Alexey
Em Thu, Apr 23, 2020 at 05:49:32PM +0300, Alexey Budankov escreveu: > > On 23.04.2020 16:20, Arnaldo Carvalho de Melo wrote: > > Em Wed, Apr 22, 2020 at 05:44:02PM +0300, Alexey Budankov escreveu: > >> > >> Update error message to mention CAP_PERFMON only. CAP_SYS_ADMIN still > >> works in keeping with user space backward compatibility approach. > > > > This will confuse users that build the latest perf to use in older > > systems where CAP_PERFMON isn't available, probably we need to, in these > > cases, check for the existence of CAP_PERFMON to provide a better > > warning message, something like: > > > > You need CAP_ADMIN or update your kernel and libcap to one that supports > > CAP_PERFMON. > > > > For systems without CAP_PERFMON, while mentioning only CAP_PERFMON for > > systems where it is present, right? > > Right, but this ideal implementation requires more effort, so staying with > two caps in the message and letting users decide which one to use looks like > a good balance already. Agreed. - Arnaldo
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 55eda54240fb..39d43ad02f30 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -288,7 +288,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) perf_cap__capable(CAP_SYS_ADMIN))) { pr_err("ftrace only works for %s!\n", #ifdef HAVE_LIBCAP_SUPPORT - "users with the CAP_PERFMON or CAP_SYS_ADMIN capability" + "users with the CAP_PERFMON capability" #else "root" #endif
Update error message to mention CAP_PERFMON only. CAP_SYS_ADMIN still works in keeping with user space backward compatibility approach. Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com> --- tools/perf/builtin-ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)