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]
Message-ID: <ec6b22fe1246427a80086e46fb34d765@huawei.com>
Date: Thu, 4 Jul 2024 01:43:03 +0000
From: duchangbin <changbin.du@...wei.com>
To: Namhyung Kim <namhyung@...nel.org>
CC: duchangbin <changbin.du@...wei.com>, Peter Zijlstra
	<peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, "Arnaldo Carvalho de
 Melo" <acme@...nel.org>, Nathan Chancellor <nathan@...nel.org>, Mark Rutland
	<mark.rutland@....com>, Alexander Shishkin
	<alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, "Ian
 Rogers" <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>,
	"Liang, Kan" <kan.liang@...ux.intel.com>, Nick Desaulniers
	<ndesaulniers@...gle.com>, Bill Wendling <morbo@...gle.com>, Justin Stitt
	<justinstitt@...gle.com>, "linux-perf-users@...r.kernel.org"
	<linux-perf-users@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "llvm@...ts.linux.dev"
	<llvm@...ts.linux.dev>, "Wanghui (OS Kernel Lab, Beijing)"
	<hw.huiwang@...wei.com>
Subject: Re: [PATCH v5 8/8] perf buildid-cache: recognize vdso when adding
 files

Hi, Namhyung,
On Wed, Jul 03, 2024 at 04:18:26PM -0700, Namhyung Kim wrote:
> Hello,
> 
> On Tue, Jul 02, 2024 at 12:18:37PM +0800, Changbin Du wrote:
> > Identify vdso by file name matching. The vdso objects have name
> > as vdso[32,64].so[.dbg].
> > 
> > $ perf buildid-cache -a /work/linux/arch/x86/entry/vdso/vdso64.so.dbg
> > 
> > Without this change, adding vdso using above command actually will never
> > be used.
> 
> Can we handle /tmp/perf-vdso.so-XXXXXX too?
>
This temporary path is already handled by perf_session__cache_build_ids()->...->dso__cache_build_id().

> Thanks,
> Namhyung
> 
> > 
> > Signed-off-by: Changbin Du <changbin.du@...wei.com>
> > ---
> >  tools/perf/builtin-buildid-cache.c | 26 +++++++++++++++++++++++++-
> >  1 file changed, 25 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
> > index b0511d16aeb6..8edea9044a65 100644
> > --- a/tools/perf/builtin-buildid-cache.c
> > +++ b/tools/perf/builtin-buildid-cache.c
> > @@ -172,6 +172,30 @@ static int build_id_cache__add_kcore(const char *filename, bool force)
> >  	return 0;
> >  }
> >  
> > +static bool filename_is_vdso(const char *filename)
> > +{
> > +	char *fname, *bname;
> > +	static const char * const vdso_names[] = {
> > +		"vdso.so", "vdso32.so", "vdso64.so", "vdsox32.so"
> > +	};
> > +
> > +	fname = strdup(filename);
> > +	if (!fname) {
> > +		pr_err("no mememory\n");
> > +		return false;
> > +	}
> > +
> > +	bname = basename(fname);
> > +	if (!bname)
> > +		return false;
> > +
> > +	for (unsigned int i = 0; i < ARRAY_SIZE(vdso_names); i++) {
> > +		if (!strncmp(bname, vdso_names[i], strlen(vdso_names[i])))
> > +			return true;
> > +	}
> > +	return false;
> > +}
> > +
> >  static int build_id_cache__add_file(const char *filename, struct nsinfo *nsi)
> >  {
> >  	char sbuild_id[SBUILD_ID_SIZE];
> > @@ -189,7 +213,7 @@ static int build_id_cache__add_file(const char *filename, struct nsinfo *nsi)
> >  
> >  	build_id__sprintf(&bid, sbuild_id);
> >  	err = build_id_cache__add_s(sbuild_id, filename, nsi,
> > -				    false, false);
> > +				    false, filename_is_vdso(filename));
> >  	pr_debug("Adding %s %s: %s\n", sbuild_id, filename,
> >  		 err ? "FAIL" : "Ok");
> >  	return err;
> > -- 
> > 2.34.1
> > 
> 

-- 
Cheers,
Changbin Du

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ