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: <CAM9d7cjCn-GFtjejw+DtK_Y6kNRGLQTAZNn6zarQfNDjvWHUXw@mail.gmail.com>
Date: Thu, 29 Feb 2024 18:04:00 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
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>, Masami Hiramatsu <mhiramat@...nel.org>, 
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] perf map: Fix map reference count issues

On Wed, Feb 28, 2024 at 10:21 PM Ian Rogers <irogers@...gle.com> wrote:
>
> The find will get the map, ensure puts are done on all paths.
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>

Acked-by: Namhyung Kim <namhyung@...nel.org>

Thanks,
Namhyung


> ---
>  tools/perf/util/maps.c        | 14 +++++++-------
>  tools/perf/util/probe-event.c |  4 +---
>  2 files changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c
> index 53aea6d2ef93..ce13145a9f8e 100644
> --- a/tools/perf/util/maps.c
> +++ b/tools/perf/util/maps.c
> @@ -611,14 +611,14 @@ struct symbol *maps__find_symbol(struct maps *maps, u64 addr, struct map **mapp)
>         struct symbol *result = NULL;
>
>         /* Ensure map is loaded before using map->map_ip */
> -       if (map != NULL && map__load(map) >= 0) {
> -               if (mapp)
> -                       *mapp = map;
> -
> +       if (map != NULL && map__load(map) >= 0)
>                 result = map__find_symbol(map, map__map_ip(map, addr));
> -               if (!mapp)
> -                       map__put(map);
> -       }
> +
> +       if (mapp)
> +               *mapp = map;
> +       else
> +               map__put(map);
> +
>         return result;
>  }
>
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index be71abe8b9b0..2a0ad9ecf0a2 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -2274,9 +2274,7 @@ static int find_perf_probe_point_from_map(struct probe_trace_point *tp,
>         ret = pp->function ? 0 : -ENOMEM;
>
>  out:
> -       if (map && !is_kprobe) {
> -               map__put(map);
> -       }
> +       map__put(map);
>
>         return ret;
>  }
> --
> 2.44.0.278.ge034bb2e1d-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ