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: <20171004141105.4f88f44f@gandalf.local.home>
Date:   Wed, 4 Oct 2017 14:11:05 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Tom Zanussi <tom.zanussi@...ux.intel.com>
Cc:     tglx@...utronix.de, mhiramat@...nel.org, namhyung@...nel.org,
        vedang.patel@...el.com, bigeasy@...utronix.de,
        joel.opensrc@...il.com, joelaf@...gle.com,
        mathieu.desnoyers@...icios.com, baohong.liu@...el.com,
        rajvi.jingar@...el.com, linux-kernel@...r.kernel.org,
        linux-rt-users@...r.kernel.org
Subject: Re: [PATCH v3 25/33] tracing: Allow whitespace to surround hist
 trigger filter

On Fri, 22 Sep 2017 15:00:05 -0500
Tom Zanussi <tom.zanussi@...ux.intel.com> wrote:

> The existing code only allows for one space before and after the 'if'
> specifying the filter for a hist trigger.  Add code to make that more
> permissive as far as whitespace goes.  Specifically, we want to allow
> spaces in the trigger itself now that we have additional syntax
> (onmatch/onmax) where spaces are more natural e.g. spaces after commas
> in param lists.
> 
> Signed-off-by: Tom Zanussi <tom.zanussi@...ux.intel.com>
> ---
>  kernel/trace/trace_events_hist.c | 24 +++++++++++++++++++-----
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index ba42fe2..431f2b2 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -4857,7 +4857,7 @@ static int event_hist_trigger_func(struct event_command *cmd_ops,
>  	struct synth_event *se;
>  	const char *se_name;
>  	bool remove = false;
> -	char *trigger;
> +	char *trigger, *p;
>  	int ret = 0;
>  
>  	if (!param)
> @@ -4866,10 +4866,23 @@ static int event_hist_trigger_func(struct event_command *cmd_ops,
>  	if (glob[0] == '!')
>  		remove = true;
>  
> -	/* separate the trigger from the filter (k:v [if filter]) */
> -	trigger = strsep(&param, " \t");
> -	if (!trigger)
> -		return -EINVAL;
> +	/*
> +	 * separate the trigger from the filter (k:v [if filter])
> +	 * allowing for whitespace in the trigger
> +	 */
> +	trigger = param;
> +	p = strstr(param, " if");
> +	if (!p)
> +		p = strstr(param, "\tif");
> +	if (p) {
> +		if (p == trigger)
> +			return -EINVAL;
> +		param = p + 1;
> +		param = strstrip(param);
> +		*p = '\0';
> +		trigger = strstrip(trigger);
> +	} else
> +		param = NULL;

I think you forgot to update this:

> > This seems rather complex. Wouldn't the following work?
> > 
> > 	param = skip_spaces(param);
> > 	trigger = strsep(&param, " \t");
> > 	if (param)
> > 		param = strstrip(param);
> >   
> 
> Yes, much better ;-)
> 
> Tom

-- Steve

>  
>  	attrs = parse_hist_trigger_attrs(trigger);
>  	if (IS_ERR(attrs))
> @@ -4927,6 +4940,7 @@ static int event_hist_trigger_func(struct event_command *cmd_ops,
>  	}
>  
>  	ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
> +
>  	/*
>  	 * The above returns on success the # of triggers registered,
>  	 * but if it didn't register any it returns zero.  Consider no

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ