[PATCH -mm 2/2] kprobes: add tests for register_kprobes

Jim Keniston jkenisto@us.ibm.com
Mon Jun 9 11:37:00 GMT 2008


On Fri, 2008-06-06 at 10:08 -0400, Masami Hiramatsu wrote:
> Add testcases for *probe batch registration (register_kprobes)
> to kprobes sanity tests.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> CC: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> CC: Jim Keniston <jkenisto@us.ibm.com>
> CC: David Miller <davem@davemloft.net>
> ---
>  ...
> +
> +static int test_kprobes(void)
> +{
> +	int ret;
> +	struct kprobe *kps[2] = {&kp, &kp2};

preh_val and posth_val are being reused after test_kprobe(), which sets
them to non-zero values.  Seems like you want to reinitialize them here
as well as below.

Ditto jph_val for jprobes and krph_val for kretprobes.

Ack otherwise.
Jim

+
> +	ret = register_kprobes(kps, 2);
> +	if (ret < 0) {
> +		printk(KERN_ERR "Kprobe smoke test failed: "
> +				"register_kprobes returned %d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = target(rand1);
> +
> +	if (preh_val == 0) {
> +		printk(KERN_ERR "Kprobe smoke test failed: "
> +				"kprobe pre_handler not called\n");
> +		handler_errors++;
> +	}
> +
> +	if (posth_val == 0) {
> +		printk(KERN_ERR "Kprobe smoke test failed: "
> +				"kprobe post_handler not called\n");
> +		handler_errors++;
> +	}
> +
> +	preh_val = 0;
> +	posth_val = 0;
> +	ret = target2(rand1);
> ...



More information about the Systemtap mailing list