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: <CAP-5=fXWwQjdAQHNxVoz1=AF83g75Yd=L32owxCfyiXKL+mVeA@mail.gmail.com>
Date: Tue, 2 Dec 2025 12:53:48 -0800
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, James Clark <james.clark@...aro.org>, 
	Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>, 
	Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...nel.org>, 
	LKML <linux-kernel@...r.kernel.org>, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 4/5] perf tools: Use machine->root_dir to find /proc/kallsyms

On Tue, Dec 2, 2025 at 12:16 AM Namhyung Kim <namhyung@...nel.org> wrote:
>
> This is for test functions to find the kallsyms correctly.  It can find
> the machine from the kernel maps and use its root_dir.  This is helpful
> to setup fake /proc directory for testing.
>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/util/symbol.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index b533fbf17a8b19a3..e90ecfd286043aa4 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -2002,6 +2002,7 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
>         char sbuild_id[SBUILD_ID_SIZE];
>         bool is_host = false;
>         char path[PATH_MAX];
> +       struct kmap *kmap = map__kmap(map);

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

nit: perhaps just use map__kmaps here to avoid testing two values below.

Thanks,
Ian

>
>         if (!dso__has_build_id(dso)) {
>                 /*
> @@ -2038,8 +2039,13 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
>                 return strdup(path);
>
>         /* Use current /proc/kallsyms if possible */
> -       if (is_host) {
>  proc_kallsyms:
> +       if (kmap && kmap->kmaps) {
> +               struct machine *machine = maps__machine(kmap->kmaps);
> +
> +               scnprintf(path, sizeof(path), "%s/proc/kallsyms", machine->root_dir);
> +               return strdup(path);
> +       } else if (is_host) {
>                 return strdup("/proc/kallsyms");
>         }
>
> --
> 2.52.0.158.g65b55ccf14-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ