lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 10 Nov 2021 23:59:05 -0800
From:   Namhyung Kim <namhyung@...nel.org>
To:     Leo Yan <leo.yan@...aro.org>
Cc:     German Gomez <german.gomez@....com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        linux-perf-users <linux-perf-users@...r.kernel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        John Garry <john.garry@...wei.com>,
        Will Deacon <will@...nel.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 4/4] perf arm-spe: Support hardware-based PID tracing

Hi Leo,

On Wed, Nov 10, 2021 at 11:41 PM Leo Yan <leo.yan@...aro.org> wrote:
>
> On Wed, Nov 10, 2021 at 11:28:48PM -0800, Namhyung Kim wrote:
>
> [...]
>
> > > +static void arm_spe_set_pid_tid_cpu(struct arm_spe *spe,
> > > +                                   struct auxtrace_queue *queue)
> > > +{
> > > +       struct arm_spe_queue *speq = queue->priv;
> > > +       pid_t tid;
> > > +
> > > +       tid = machine__get_current_tid(spe->machine, speq->cpu);
> > > +       if (tid != -1) {
> > > +               speq->tid = tid;
> > > +               thread__zput(speq->thread);
> > > +       } else
> > > +               speq->tid = queue->tid;
> > > +
> > > +       if ((!speq->thread) && (speq->tid != -1)) {
> > > +               speq->thread = machine__find_thread(spe->machine, -1,
> > > +                                                   speq->tid);
> > > +       }
> > > +
> > > +       if (speq->thread) {
> > > +               speq->pid = speq->thread->pid_;
> > > +               if (queue->cpu == -1)
> > > +                       speq->cpu = speq->thread->cpu;
> > > +       }
> > > +}
> > > +
> > > +static int arm_spe_set_tid(struct arm_spe_queue *speq, pid_t tid)
> > > +{
> > > +       struct arm_spe *spe = speq->spe;
> > > +       int err = machine__set_current_tid(spe->machine, speq->cpu, tid, tid);
> >
> > I think we should pass -1 as pid as we don't know the real pid.
>
> AFAICT, I observe one case for machine__set_current_tid() returning error
> is 'speq->cpu' is -1 (this is the case for per-thread tracing).  In
> this case, if pass '-1' for pid/tid, it still will return failure.
>
> So here should return the error as it is.  Am I missing anything?

I'm not saying about the error.  It's about thread status.
In the machine__set_current_tid(), it calls
machine__findnew_thread() with given pid and tid.

I suspect it can set pid to a wrong value if the thread has
no pid value at the moment.

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ