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]
Date:   Sun, 11 Mar 2018 20:49:12 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Leo Yan <leo.yan@...aro.org>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-kernel@...r.kernel.org,
        Mathieu Poirier <mathieu.poirier@...aro.org>
Subject: Re: [PATCH v2] perf machine: Fix load kernel symbol with '-k' option

On Sat, Mar 10, 2018 at 05:50:56PM +0800, Leo Yan wrote:

SNIP

> > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> > > index 12b7427..3125871 100644
> > > --- a/tools/perf/util/machine.c
> > > +++ b/tools/perf/util/machine.c
> > > @@ -1299,9 +1299,18 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
> > >  	else
> > >  		kernel_type = DSO_TYPE_GUEST_KERNEL;
> > >  
> > > -	is_kernel_mmap = memcmp(event->mmap.filename,
> > > -				machine->mmap_name,
> > > -				strlen(machine->mmap_name) - 1) == 0;
> > > +	/*
> > > +	 * When symbol_conf.vmlinux_name is not NULL, it includes the specified
> > > +	 * kernel vmlinux path with option '-k'.  So set 'is_kernel_mmap' to
> > > +	 * true for creating machine symbol map.
> > > +	 */
> > > +	if (symbol_conf.vmlinux_name)
> > > +		is_kernel_mmap = true;
> > > +	else
> > > +		is_kernel_mmap = memcmp(event->mmap.filename,
> > > +					machine->mmap_name,
> > > +					strlen(machine->mmap_name) - 1) == 0;
> > > +
> > >  	if (event->mmap.filename[0] == '/' ||
> > >  	    (!is_kernel_mmap && event->mmap.filename[0] == '[')) {
> > >  		map = machine__findnew_module_map(machine, event->mmap.start,
> > 
> > right, the mmap gets confused with the vmlinux path, but I wonder
> > the fix should be not to include symbol_conf.vmlinux_name in the
> > mmap_name like below.. untested
> 
> I tested below fixing at my side, and confirm your fixing also can
> resolve this issue.  After reviewing the change, it's more neat than my
> own change .  So you could add my test tag :)
> 
> Tested-by: Leo Yan <leo.yan@...aro.org>

thanks

SNIP

>  static int machine__set_mmap_name(struct machine *machine)
>  {
> -       if (machine__is_host(machine)) {
> -               if (symbol_conf.vmlinux_name)
> -                       machine->mmap_name = strdup(symbol_conf.vmlinux_name);
> -               else
> -                       machine->mmap_name = strdup("[kernel.kallsyms]");
> -       } else if (machine__is_default_guest(machine)) {
> -               if (symbol_conf.default_guest_vmlinux_name)
> -                       machine->mmap_name = strdup(symbol_conf.default_guest_vmlinux_name);
> -               else
> -                       machine->mmap_name = strdup("[guest.kernel.kallsyms]");
> -       } else {
> -               if (asprintf(&machine->mmap_name, "[guest.kernel.kallsyms.%d]",
> -                        machine->pid) < 0)
> -                       machine->mmap_name = NULL;
> -       }
> +       if (machine__is_host(machine))
> +               machine->mmap_name = strdup("[kernel.kallsyms]");
> +       else if (machine__is_default_guest(machine))
> +               machine->mmap_name = strdup("[guest.kernel.kallsyms]");
> +       else if (asprintf(&machine->mmap_name, "[guest.kernel.kallsyms.%d]",
> +                machine->pid) < 0)
> +               machine->mmap_name = NULL;

yea, that looks better.. will change

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ