Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599743

Re: [PATCH v8 1/6] perf: Add PERF_RECORD_NAMESPACES to include namespaces related info

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v8 1/6] perf: Add PERF_RECORD_NAMESPACES to include namespaces related info
Date 2017-03-13 21:00 +0100
Message-ID <tkEim-5lT-23@gated-at.bofh.it> (permalink)
References <tiuds-4ru-3@gated-at.bofh.it> <tiyAp-7Eu-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Wed, Mar 08, 2017 at 02:11:36AM +0530, Hari Bathini escreveu:
> @@ -9691,6 +9825,11 @@ SYSCALL_DEFINE5(perf_event_open,
>  			return -EACCES;
>  	}
>  
> +	if (attr.namespaces) {
> +		if (!capable(CAP_SYS_ADMIN))
> +			return -EACCES;
> +	}
> +

So, testing the first tooling patch I get:

[acme@jouet linux]$ perf record --namespaces ls
Error:
You may not have permission to collect stats.

Consider tweaking /proc/sys/kernel/perf_event_paranoid,
which controls use of the performance events system by
unprivileged users (without CAP_SYS_ADMIN).

The current value is 2:

  -1: Allow use of (almost) all events by all users
>= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK
>= 1: Disallow CPU event access by users without CAP_SYS_ADMIN
>= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN

To make this setting permanent, edit /etc/sysctl.conf too, e.g.:

	kernel.perf_event_paranoid = -1

[acme@jouet linux]$

----------------------- 8< ---------------------------------------

So this specific case is not related to perf_event_paranoid, we need to
improve error handling here, i.e. see attr.namespaces, !CAP_SYS_ADMIN,
-EACCESS at sys_perf_event_open() -> better error message.

And perhaps we make an extra check about perf_event_paranoid... Ingo? Peter?

Can be done as a follow up patch tho, just adding entry to the collective TODO
list.

- Arnaldo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v8 0/6] perf: Add support for analyzing events for containers Hari Bathini <hbathini@linux.vnet.ibm.com> - 2017-03-07 21:50 +0100
  [PATCH v8 5/6] perf script: Add script print support for namespace  events Hari Bathini <hbathini@linux.vnet.ibm.com> - 2017-03-07 21:50 +0100
    [tip:perf/core] perf script: Add script print support for namespace  events tip-bot for Hari Bathini <tipbot@zytor.com> - 2017-03-15 19:50 +0100
  [PATCH v8 3/6] perf record: Synthesize namespace events for current  processes Hari Bathini <hbathini@linux.vnet.ibm.com> - 2017-03-07 21:50 +0100
    Re: [PATCH v8 3/6] perf record: Synthesize namespace events for  current processes Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 14:40 +0100
    [tip:perf/core] perf record: Synthesize namespace events for  current processes tip-bot for Hari Bathini <tipbot@zytor.com> - 2017-03-15 19:50 +0100
  [PATCH v8 6/6] perf tools: Add cgroup identifier sort order keyword Hari Bathini <hbathini@linux.vnet.ibm.com> - 2017-03-07 23:50 +0100
    [tip:perf/core] perf tools: Add 'cgroup_id' sort order keyword tip-bot for Hari Bathini <tipbot@zytor.com> - 2017-03-15 19:50 +0100
  [PATCH v8 1/6] perf: Add PERF_RECORD_NAMESPACES to include  namespaces related info Hari Bathini <hbathini@linux.vnet.ibm.com> - 2017-03-08 02:30 +0100
    Re: [PATCH v8 1/6] perf: Add PERF_RECORD_NAMESPACES to include  namespaces related info Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-13 21:00 +0100
    [tip:perf/core] perf: Add PERF_RECORD_NAMESPACES to include  namespaces related info tip-bot for Hari Bathini <tipbot@zytor.com> - 2017-03-15 19:50 +0100

csiph-web