Re: [PATCH v1] perf synthetic-events: Return error if procfs isn't mounted for PID namespaces

From: Leo Yan
Date: Mon Feb 07 2022 - 00:55:28 EST


On Sun, Feb 06, 2022 at 08:46:37AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Feb 04, 2022 at 08:48:49PM +0800, Leo Yan escreveu:
> > On Fri, Jan 07, 2022 at 02:27:57PM +0000, James Clark wrote:
> > > On 24/12/2021 12:40, Leo Yan wrote:
> > > > For perf recording, it retrieves process info by iterating nodes in proc
> > > > fs. If we run perf in a non-root PID namespace with command:
> > > >
> > > > # unshare --fork --pid perf record -e cycles -a -- test_program
> > > >
> > > > ... in this case, unshare command creates a child PID namespace and
> > > > launches perf tool in it, but the issue is the proc fs is not mounted
> > > > for the non-root PID namespace, this leads to the perf tool gathering
> > > > process info from its parent PID namespace.
> > > >
> > >
> > > I had some concerns that this would prevent use of perf in docker, but docker
> > > does mount /proc so it is still working. And you've added a warning about how
> > > to fix the unshare command so I think this is ok.
> > >
> > > Reviewed-by: James Clark <james.clark@xxxxxxx>
> >
> > Thanks a lot for review, James.
> >
> > Arnaldo, Jiri, could you take a look for this patch? Thanks!
>
> Looks sane, there was discussion, a detailed set of steps to reproduce
> the problem was provided, thanks, applied.

Thank you, Arnaldo!