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] [day] [month] [year] [list]
Message-ID: <CAP-5=fX92dj4+UJrWGQpO15U62zJZDZ39SMgen8171RJ3Jcygw@mail.gmail.com>
Date: Mon, 28 Apr 2025 13:22:01 -0700
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: 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>, Kan Liang <kan.liang@...ux.intel.com>, 
	Athira Rajeev <atrajeev@...ux.ibm.com>, Kajol Jain <kjain@...ux.ibm.com>, 
	Li Huafei <lihuafei1@...wei.com>, "Steinar H. Gunderson" <sesse@...gle.com>, 
	James Clark <james.clark@...aro.org>, Stephen Brennan <stephen.s.brennan@...cle.com>, 
	Andi Kleen <ak@...ux.intel.com>, Dmitry Vyukov <dvyukov@...gle.com>, 
	Zhongqiu Han <quic_zhonhan@...cinc.com>, Yicong Yang <yangyicong@...ilicon.com>, 
	Krzysztof Łopatowski <krzysztof.m.lopatowski@...il.com>, 
	"Dr. David Alan Gilbert" <linux@...blig.org>, Zixian Cai <fzczx123@...il.com>, 
	Steve Clevenger <scclevenger@...amperecomputing.com>, 
	Thomas Falcon <thomas.falcon@...el.com>, Martin Liska <martin.liska@....com>, 
	Martin Liška <m.liska@...link.cz>, 
	Song Liu <song@...nel.org>, linux-perf-users@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 7/8] perf dso: Move build_id to dso_id

On Mon, Apr 28, 2025 at 1:04 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> On Fri, Apr 25, 2025 at 11:46:40AM -0700, Ian Rogers wrote:
> > On Fri, Apr 25, 2025 at 10:15 AM Namhyung Kim <namhyung@...nel.org> wrote:
> > > On Thu, Apr 24, 2025 at 12:58:30PM -0700, Ian Rogers wrote:
> [SNIP]
> > > > @@ -1665,18 +1675,20 @@ bool dso__build_id_equal(const struct dso *dso, struct build_id *bid)
> > > >  void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine)
> > > >  {
> > > >       char path[PATH_MAX];
> > > > +     struct build_id bid;
> > > >
> > > >       if (machine__is_default_guest(machine))
> > > >               return;
> > > >       sprintf(path, "%s/sys/kernel/notes", machine->root_dir);
> > > > -     if (sysfs__read_build_id(path, dso__bid(dso)) == 0)
> > > > -             dso__set_has_build_id(dso);
> > > > +     sysfs__read_build_id(path, &bid);
> > > > +     dso__set_build_id(dso, &bid);
> > >
> > > Why not check the return value anymore?
> >
> > Checking the return value was a mistake. For example if we have
> > libc.so with a build ID and then it is replaced with a libc.so without
> > a build ID then build ID wouldn't be updated previously as reading the
> > build ID had failed - no value found.
>
> I'm not sure if it updates the dso as a whole.  This functions is to get
> build-ID of the kernel and it seems we can skip this if it already has a
> build-ID.  But if sysfs__read_build_id() failed, it may have a garbage.
>
> Do I miss something?

I think there is a missing initialization, I'll add it in v2.

Thanks,
Ian

> Thanks,
> Namhyung
>
> > >
> > > >  }
> > > >
> > > >  int dso__kernel_module_get_build_id(struct dso *dso,
> > > >                                   const char *root_dir)
> > > >  {
> > > >       char filename[PATH_MAX];
> > > > +     struct build_id bid;
> > > >       /*
> > > >        * kernel module short names are of the form "[module]" and
> > > >        * we need just "module" here.
> > > > @@ -1687,9 +1699,8 @@ int dso__kernel_module_get_build_id(struct dso *dso,
> > > >                "%s/sys/module/%.*s/notes/.note.gnu.build-id",
> > > >                root_dir, (int)strlen(name) - 1, name);
> > > >
> > > > -     if (sysfs__read_build_id(filename, dso__bid(dso)) == 0)
> > > > -             dso__set_has_build_id(dso);
> > > > -
> > > > +     sysfs__read_build_id(filename, &bid);
> > > > +     dso__set_build_id(dso, &bid);
> > > >       return 0;
> > > >  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ