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, 19 Jul 2022 18:09:24 -0700
From:   Ian Rogers <irogers@...gle.com>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Andi Kleen <ak@...ux.intel.com>, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org
Subject: Re: [PATCH 26/35] perf tools: Handle injected guest kernel mmap event

On Mon, Jul 11, 2022 at 2:33 AM Adrian Hunter <adrian.hunter@...el.com> wrote:
>
> If a kernel mmap event was recorded inside a guest and injected into a host
> perf.data file, then it will match a host mmap_name not a guest mmap_name,
> see machine__set_mmap_name(). So try matching a host mmap_name in that
> case.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>


Acked-by: Ian Rogers <irogers@...gle.com>

Thanks,
Ian

> ---
>  tools/perf/util/machine.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index 27d1a38f44c3..8f657225fb02 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -1742,6 +1742,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
>         struct map *map;
>         enum dso_space_type dso_space;
>         bool is_kernel_mmap;
> +       const char *mmap_name = machine->mmap_name;
>
>         /* If we have maps from kcore then we do not need or want any others */
>         if (machine__uses_kcore(machine))
> @@ -1752,8 +1753,16 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
>         else
>                 dso_space = DSO_SPACE__KERNEL_GUEST;
>
> -       is_kernel_mmap = memcmp(xm->name, machine->mmap_name,
> -                               strlen(machine->mmap_name) - 1) == 0;
> +       is_kernel_mmap = memcmp(xm->name, mmap_name, strlen(mmap_name) - 1) == 0;
> +       if (!is_kernel_mmap && !machine__is_host(machine)) {
> +               /*
> +                * If the event was recorded inside the guest and injected into
> +                * the host perf.data file, then it will match a host mmap_name,
> +                * so try that - see machine__set_mmap_name().
> +                */
> +               mmap_name = "[kernel.kallsyms]";
> +               is_kernel_mmap = memcmp(xm->name, mmap_name, strlen(mmap_name) - 1) == 0;
> +       }
>         if (xm->name[0] == '/' ||
>             (!is_kernel_mmap && xm->name[0] == '[')) {
>                 map = machine__addnew_module_map(machine, xm->start,
> @@ -1767,7 +1776,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
>                         dso__set_build_id(map->dso, bid);
>
>         } else if (is_kernel_mmap) {
> -               const char *symbol_name = (xm->name + strlen(machine->mmap_name));
> +               const char *symbol_name = xm->name + strlen(mmap_name);
>                 /*
>                  * Should be there already, from the build-id table in
>                  * the header.
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ