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

From: Jim Keniston
Date: Fri Jun 06 2008 - 20:41:26 EST


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@xxxxxxxxxx>
> CC: Ananth N Mavinakayanahalli <ananth@xxxxxxxxxx>
> CC: Jim Keniston <jkenisto@xxxxxxxxxx>
> CC: David Miller <davem@xxxxxxxxxxxxx>
> ---
> ...
> +
> +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);
> ...

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