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: <YB0UvM6t+BSqQkkk@krava>
Date:   Fri, 5 Feb 2021 10:49:48 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Jin Yao <yao.jin@...ux.intel.com>
Cc:     acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
        mingo@...hat.com, alexander.shishkin@...ux.intel.com,
        Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH v2 2/2] perf script: Support filtering by hex address

On Fri, Jan 29, 2021 at 03:08:54PM +0800, Jin Yao wrote:

SNIP

> +			}
> +		}
> +
>  		if (!ret)
>  			al->filtered |= (1 << HIST_FILTER__SYMBOL);
>  	}
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 64a039cbba1b..2c13f6acda7f 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -2406,6 +2406,39 @@ int setup_intlist(struct intlist **list, const char *list_str,
>  	return 0;
>  }
>  
> +static int setup_addrlist(struct intlist **addr_list, struct strlist *sym_list)
> +{
> +	struct str_node *pos, *tmp;
> +	unsigned long val;
> +	char *sep;
> +	int err = 0, i = 0;
> +
> +	*addr_list = intlist__new(NULL);
> +	if (!*addr_list)
> +		return -1;
> +
> +	strlist__for_each_entry_safe(pos, tmp, sym_list) {
> +		val = strtoul(pos->s, &sep, 16);
> +		if (*sep != ',' && *sep != '\0')
> +			continue;

I think you also need to check that val is valid and errno
(check other strtoul we call in perf)
because above could pass for:

	$ ./perf script -S ",7fd0f1b69a13"
	ls 651468 410180.795577:      90098 cycles:u:      7fd0f1b69a13 __GI___tunables_init+0x73 (/usr/lib64/ld-2.32.so)


plus check for " " so we could do:

	$ ./perf script -S "7fd0f1b69a13 ,7fd0f1b5e189"
	ls 651468 410180.796055:     190731 cycles:u:      7fd0f1b5e189 _dl_relocate_object+0x4b9 (/usr/lib64/ld-2.32.so)

	$ ./perf script -S "7fd0f1b69a13,7fd0f1b5e189"
	ls 651468 410180.795577:      90098 cycles:u:      7fd0f1b69a13 __GI___tunables_init+0x73 (/usr/lib64/ld-2.32.so)
	ls 651468 410180.796055:     190731 cycles:u:      7fd0f1b5e189 _dl_relocate_object+0x4b9 (/usr/lib64/ld-2.32.so)


thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ