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: <20191118220147.GD20465@kernel.org>
Date:   Mon, 18 Nov 2019 19:01:47 -0300
From:   Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To:     Masami Hiramatsu <mhiramat@...nel.org>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        linux-kernel@...r.kernel.org,
        Tom Zanussi <tom.zanussi@...ux.intel.com>,
        Ravi Bangoria <ravi.bangoria@...ux.ibm.com>,
        Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH v3 3/7] perf probe: Do not show non representive lines by
 perf-probe -L

Em Mon, Nov 18, 2019 at 05:12:10PM +0900, Masami Hiramatsu escreveu:
> Since perf probe -L shows non representive lines, it can be
> mislead users where user can put probes.
> This prevents to show such non representive lines so that user
> can understand which lines user can probe.
> 
>   # perf probe -L kernel_read
>   <kernel_read@...ild/linux-pvZVvI/linux-5.0.0/fs/read_write.c:0>
>         0  ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
>            {
>         2         mm_segment_t old_fs;
>                   ssize_t result;
> 
>                   old_fs = get_fs();
>         6         set_fs(get_ds());
>                   /* The cast to a user pointer is valid due to the set_fs() */
>         8         result = vfs_read(file, (void __user *)buf, count, pos);
>         9         set_fs(old_fs);
>        10         return result;
>            }
>            EXPORT_SYMBOL(kernel_read);

Thanks, this fixes the problem I reported, applied.

- Arnaldo
 
> Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
> ---
>  tools/perf/util/probe-finder.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index ef1b320cedf8..f12ad507a822 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -1734,12 +1734,19 @@ static int line_range_walk_cb(const char *fname, int lineno,
>  			      void *data)
>  {
>  	struct line_finder *lf = data;
> +	const char *__fname;
> +	int __lineno;
>  	int err;
>  
>  	if ((strtailcmp(fname, lf->fname) != 0) ||
>  	    (lf->lno_s > lineno || lf->lno_e < lineno))
>  		return 0;
>  
> +	/* Make sure this line can be reversable */
> +	if (cu_find_lineinfo(&lf->cu_die, addr, &__fname, &__lineno) > 0
> +	    && (lineno != __lineno || strcmp(fname, __fname)))
> +		return 0;
> +
>  	err = line_range_add_line(fname, lineno, lf->lr);
>  	if (err < 0 && err != -EEXIST)
>  		return err;

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ