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: <1253955120.12145.2.camel@frodo>
Date:	Sat, 26 Sep 2009 04:52:00 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Masami Hiramatsu <mhiramat@...hat.com>
Cc:	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...e.hu>,
	lkml <linux-kernel@...r.kernel.org>,
	systemtap <systemtap@...hat.com>,
	DLE <dle-develop@...ts.sourceforge.net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Mike Galbraith <efault@....de>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Christoph Hellwig <hch@...radead.org>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Jim Keniston <jkenisto@...ibm.com>,
	"Frank Ch. Eigler" <fche@...hat.com>
Subject: Re: [RFC PATCH tracing/kprobes 4/5] perf: Support perf kprobe
 command for kprobe-event setup helper

On Fri, 2009-09-25 at 12:15 -0700, Masami Hiramatsu wrote:

> +
> +#define MAX_CMDLEN 256
> +
> +static int synthesize_probepoint(struct probe_point *pp)
> +{
> +	char *buf;
> +	int i, len, ret;
> +	pp->probes[0] = buf = (char *)calloc(MAX_CMDLEN, sizeof(char));
> +	len = snprintf(buf, MAX_CMDLEN, "%s+%d", pp->function, pp->offset);

What happens if func and offset is too big for MAX_CMDLEN?

> +	for (i = 0; i < pp->nr_args; i++) {

Can you have a case where pp->nr_args == 0?

> +		ret = snprintf(&buf[len], MAX_CMDLEN - len, " %s",
> +			       pp->args[i]);
> +		if (ret <= 0 || ret >= MAX_CMDLEN - len) {
> +			free(pp->probes[0]);
> +			return -E2BIG;
> +		}
> +		len += ret;
> +	}
> +	return pp->found = 1;
> +}
> +
> +int cmd_kprobe(int argc, const char **argv, const char *prefix __used)
> +{
> +	int i, j, fd, ret, need_dwarf = 0;
> +	struct probe_point *pp;
> +	char buf[MAX_CMDLEN];
> +
> +	argc = parse_options(argc, argv, options, kprobe_usage,
> +		PARSE_OPT_STOP_AT_NON_OPTION);
> +	if (argc || session.nr_probe == 0)
> +		usage_with_options(kprobe_usage, options);
> +
> +	/* Synthesize return probes */
> +	for (j = 0; j < session.nr_probe; j++) {
> +		if (session.events[j][0] != 'r') {
> +			need_dwarf = 1;
> +			continue;
> +		}
> +		ret = synthesize_probepoint(&session.probes[j]);
> +		if (ret < 0)
> +			semantic_error("probe point is too long.");

If we have no args but the func and offset is too big, then this does
not catch it. But this depends on if we can have no args.

-- Steve

> +	}
> +
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ