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:   Tue, 27 Jun 2023 09:57:48 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     James Clark <james.clark@....com>,
        linux-perf-users@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Mike Leach <mike.leach@...aro.org>,
        Leo Yan <leo.yan@...aro.org>,
        John Garry <john.g.garry@...cle.com>,
        Will Deacon <will@...nel.org>, linux-kernel@...r.kernel.org,
        coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 2/2] perf report: Don't add to histogram when there is no
 thread found

On Tue, Jun 27, 2023 at 9:43 AM Ian Rogers <irogers@...gle.com> wrote:
>
> On Mon, Jun 26, 2023 at 5:02 PM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > On Mon, Jun 26, 2023 at 05:10:58PM +0100, James Clark wrote:
> > > thread__find_map() chooses to exit without assigning a thread to the
> > > addr_location in some scenarios, for example when there are samples from
> > > a guest and perf_guest == false. This results in a segfault when adding
> > > to the histogram because it uses unguarded accesses to the thread member
> > > of the addr_location.
> >
> > Looking at the commit 0dd5041c9a0ea ("perf addr_location: Add
> > init/exit/copy functions") that introduced the change, I'm not sure if
> > it's the intend behavior.
> >
> > It might change maps and map, but not thread.  Then I think no reason
> > to not set the al->thread at the beginning.
> >
> > How about this?  Ian?
> > (I guess we can get rid of the duplicate 'al->map = NULL' part)
>
> It seemed strange that we were failing to find a map (the function's
> purpose) but then populating the address_location. The change below
> brings back that somewhat odd behavior. I'm okay with reverting to the
> old behavior, clearly there were users relying on it. We should
> probably also copy maps and not just thread, as that was the previous
> behavior.

Probably.  But it used to support samples without maps and I think
that's why it ignores the return value of thread__find_map().  So
we can expect al.map is NULL and maybe fine to leave it for now.

As machine__resolve() returns -1 if it gets no thread, we should set
al.thread when it returns 0.

Can I get your Acked-by?

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ