All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
To: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: "linux-perf-use." <linux-perf-users@vger.kernel.org>,
	Wang Nan <wangnan0@huawei.com>,
	Hari Bathini <hbathini@linux.vnet.ibm.com>,
	Ananth M <ananth@linux.vnet.ibm.com>,
	"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Subject: Re: perf segfault in docker container
Date: Fri, 10 Jun 2016 15:58:48 +0530	[thread overview]
Message-ID: <575A9660.4070907@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAE40pdfWpz6rreOCMJCs1P8WXfOXO_B5zZoeOyC_5usYGp8xRQ@mail.gmail.com>

Hi Brendan,

I though of replying to your mail as I saw you running perf inside a
docker container. I believe you would be interested in events specific
to the container context as you are using "perf record -a".

We are working on supporting "container-aware tracing" i.e., whenever
you run "perf record -a" inside a container it should report
container-wide events rather than system-wide events. Towards that goal,
we posted an RFC patch in LKML [1] last year and also discussed possible
ways to restrict events within a container in Plumbers (Container
Microconf) [2].

Based on the discussion in Container Microconf, we are coming up with a
new prototype which should be ready for review by next week. The new
prototype introduces a new namespace "perf-namespace" (namespace name is
just a placeholder. Suggestions welcome). If the container is created
with perf-namespace, then "perf record -a" inside the container reports
only those events that are triggered within the container.

We would like to know if you are looking for "container-aware tracing"
and also like to know the scenarios/problems you are trying to debug by
running perf inside a container.

[1] lkml.org/lkml/2015/7/15/192
[2] linuxplumbersconf.org/2015/ocw/sessions/2667.html

Regards,
Aravinda

On Friday 10 June 2016 02:44 AM, Brendan Gregg wrote:
> G'Day,
> 
> Default docker container, in Linux 4.7-rc2, with latest perf from perf/core:
> 
> docker# ./perf record -F 99 -a
> Segmentation fault
> 
> The segfault is in perf_event__synthesize_kernel_mmap(). I know
> symbol__read_kptr_restrict() has been updated recently to fix similar
> segfaults, hence getting perf/core.
> 
> I think the problem is this:
> 
> docker# id
> uid=0(root) gid=0(root) groups=0(root)
> docker# cat /proc/sys/kernel/kptr_restrict
> 1
> 
> (I'd previously set "echo -1 > /proc/sys/kernel/perf_event_paranoid")
> 
> The current (May 24) code has, symbol__read_kptr_restrict():
> 
>                 if (fgets(line, sizeof(line), fp) != NULL)
>                         value = (geteuid() != 0) ?
>                                         (atoi(line) != 0) :
>                                         (atoi(line) == 2);
> 
> assumes that if euid is 0 && kptr_restrict isn't 2, then we're aren't
> restricted. But we are. Maybe the code should check for CAP_SYS_ADMIN,
> instead of euid == 0?
> 
> Brendan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
Regards,
Aravinda

  reply	other threads:[~2016-06-10 10:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-09 21:14 perf segfault in docker container Brendan Gregg
2016-06-10 10:28 ` Aravinda Prasad [this message]
2016-06-21 22:32   ` Brendan Gregg
2016-06-21 22:43     ` Brendan Gregg
2016-06-22 21:35     ` Aravinda Prasad
2016-06-10 20:15 ` Arnaldo Carvalho de Melo

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=575A9660.4070907@linux.vnet.ibm.com \
    --to=aravinda@linux.vnet.ibm.com \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=brendan.d.gregg@gmail.com \
    --cc=hbathini@linux.vnet.ibm.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.