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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171120060506.GA20701@sejong>
Date:   Mon, 20 Nov 2017 15:05:06 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     Tom Zanussi <tom.zanussi@...ux.intel.com>
Cc:     rostedt@...dmis.org, tglx@...utronix.de, mhiramat@...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, julia@...com, fengguang.wu@...el.com,
        linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org,
        kernel-team@....com
Subject: Re: [PATCH v6 18/37] tracing: Add simple expression support to hist
 triggers

Hi Tom,

On Fri, Nov 17, 2017 at 02:32:57PM -0600, Tom Zanussi wrote:
> Add support for simple addition, subtraction, and unary expressions
> (-(expr) and expr, where expr = b-a, a+b, a+b+c) to hist triggers, in
> order to support a minimal set of useful inter-event calculations.
> 
> These operations are needed for calculating latencies between events
> (timestamp1-timestamp0) and for combined latencies (latencies over 3
> or more events).
> 
> In the process, factor out some common code from key and value
> parsing.
> 
> Signed-off-by: Tom Zanussi <tom.zanussi@...ux.intel.com>
> ---

[SNIP]
> +static char *expr_str(struct hist_field *field, unsigned int level)
> +{
> +	char *expr;
> +
> +	if (level > 1)
> +		return NULL;
> +
> +	expr = kzalloc(MAX_FILTER_STR_VAL, GFP_KERNEL);
> +	if (!expr)
> +		return NULL;
> +
> +	if (field->operator == FIELD_OP_UNARY_MINUS) {
> +		char *subexpr;
> +
> +		strcat(expr, "-(");
> +		subexpr = expr_str(field->operands[0], ++level);
> +		if (!subexpr) {
> +			kfree(expr);
> +			return NULL;
> +		}
> +		strcat(expr, subexpr);
> +		strcat(expr, ")");
> +
> +		return expr;

The subexpr was leaked.

Thanks,
Namhyung


> +	}
> +
> +	strcat(expr, hist_field_name(field->operands[0], 0));
> +	if (field->operands[0]->flags) {
> +		const char *flags_str = get_hist_field_flags(field->operands[0]);
> +
> +		if (flags_str) {
> +			strcat(expr, ".");
> +			strcat(expr, flags_str);
> +		}
> +	}
> +
> +	switch (field->operator) {
> +	case FIELD_OP_MINUS:
> +		strcat(expr, "-");
> +		break;
> +	case FIELD_OP_PLUS:
> +		strcat(expr, "+");
> +		break;
> +	default:
> +		kfree(expr);
> +		return NULL;
> +	}
> +
> +	strcat(expr, hist_field_name(field->operands[1], 0));
> +	if (field->operands[1]->flags) {
> +		const char *flags_str = get_hist_field_flags(field->operands[1]);
> +
> +		if (flags_str) {
> +			strcat(expr, ".");
> +			strcat(expr, flags_str);
> +		}
> +	}
> +
> +	return expr;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ