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: <877fcjp5j0.fsf@ashishki-desk.ger.corp.intel.com>
Date:	Mon, 18 Jul 2016 14:08:51 +0300
From:	Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To:	Mathieu Poirier <mathieu.poirier@...aro.org>
Cc:	peterz@...radead.org, mingo@...hat.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] perf/core: fixing filename for start/stop filters

Mathieu Poirier <mathieu.poirier@...aro.org> writes:

> Binary file names have to be supplied for both range and start/stop
> filters but the current code only process the filename if an
> address range filter is specified.  This code adds processing of
> the filename for start/stop filters.
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@...aro.org>
> ---
>  kernel/events/core.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 912f10dfbfe5..df21611585d7 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -7852,8 +7852,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
>  					goto fail;
>  			}
>  
> -			if (token == IF_SRC_FILE) {
> -				filename = match_strdup(&args[2]);
> +			if (token == IF_SRC_FILE || token == IF_SRC_FILEADDR) {
> +				substring_t *fargs;
> +
> +				fargs = (token == IF_SRC_FILEADDR ?
> +					 &args[1] : &args[2]);
> +
> +				filename = match_strdup(fargs);
>  				if (!filename) {
>  					ret = -ENOMEM;
>  					goto fail;

How about a bit shorter version:

diff --git a/kernel/events/core.c b/kernel/events/core.c
index e6a78ccc07..f05d89b605 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8035,8 +8035,10 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
 					goto fail;
 			}
 
-			if (token == IF_SRC_FILE) {
-				filename = match_strdup(&args[2]);
+			if (token == IF_SRC_FILE || token == IF_SRC_FILEADDR) {
+				int fpos = filter->range ? 2 : 1;
+
+				filename = match_strdup(&args[fpos]);
 				if (!filename) {
 					ret = -ENOMEM;
 					goto fail;

Thanks,
--
Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ