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 17:45:43 -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 20/35] perf tools: Remove also guest kcore_dir with host kcore_dir

On Mon, Jul 11, 2022 at 2:33 AM Adrian Hunter <adrian.hunter@...el.com> wrote:
>
> Copies of /proc/kallsyms, /proc/modules and an extract of /proc/kcore can
> be stored in the perf.data output directory under the subdirectory named
> kcore_dir. Guest machines will have their files also under subdirectories
> beginning kcore_dir__ followed by the machine pid. Remove these also when
> removing kcore_dir.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>

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

Thanks,
Ian

> ---
>  tools/perf/util/util.c | 37 +++++++++++++++++++++++++++++++++++--
>  1 file changed, 35 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index eeb83c80f458..9b02edf9311d 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -200,7 +200,7 @@ static int rm_rf_depth_pat(const char *path, int depth, const char **pat)
>         return rmdir(path);
>  }
>
> -static int rm_rf_kcore_dir(const char *path)
> +static int rm_rf_a_kcore_dir(const char *path, const char *name)
>  {
>         char kcore_dir_path[PATH_MAX];
>         const char *pat[] = {
> @@ -210,11 +210,44 @@ static int rm_rf_kcore_dir(const char *path)
>                 NULL,
>         };
>
> -       snprintf(kcore_dir_path, sizeof(kcore_dir_path), "%s/kcore_dir", path);
> +       snprintf(kcore_dir_path, sizeof(kcore_dir_path), "%s/%s", path, name);
>
>         return rm_rf_depth_pat(kcore_dir_path, 0, pat);
>  }
>
> +static bool kcore_dir_filter(const char *name __maybe_unused, struct dirent *d)
> +{
> +       const char *pat[] = {
> +               "kcore_dir",
> +               "kcore_dir__[1-9]*",
> +               NULL,
> +       };
> +
> +       return match_pat(d->d_name, pat);
> +}
> +
> +static int rm_rf_kcore_dir(const char *path)
> +{
> +       struct strlist *kcore_dirs;
> +       struct str_node *nd;
> +       int ret;
> +
> +       kcore_dirs = lsdir(path, kcore_dir_filter);
> +
> +       if (!kcore_dirs)
> +               return 0;
> +
> +       strlist__for_each_entry(nd, kcore_dirs) {
> +               ret = rm_rf_a_kcore_dir(path, nd->s);
> +               if (ret)
> +                       return ret;
> +       }
> +
> +       strlist__delete(kcore_dirs);
> +
> +       return 0;
> +}
> +
>  int rm_rf_perf_data(const char *path)
>  {
>         const char *pat[] = {
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ