Re: [1/6 PATCH] Kprobes : Prevent possible race conditions genericchanges

From: Andrew Morton
Date: Thu Jul 07 2005 - 05:30:47 EST


Prasanna S Panchamukhi <prasanna@xxxxxxxxxx> wrote:
>
> There are possible race conditions if probes are placed on routines within the
> kprobes files and routines used by the kprobes.

So... don't do that then? Is it likely that anyone would want to stick a
probe on the kprobe code itself?

> -kprobe_opcode_t *get_insn_slot(void)
> +kprobe_opcode_t * __kprobes get_insn_slot(void)

coding style regression...

> -int register_kprobe(struct kprobe *p)
> +static int __kprobes in_kprobes_functions(unsigned long addr)
> +{
> + /* Linker adds these: start and end of __kprobes functions */
> + extern char __kprobes_text_start[], __kprobes_text_end[];

There's an old unix convention that section markers (start, end, edata,
etc) are declared `int'. For some reason we don't do that in the kernel.
Oh well.

> + if ((ret = in_kprobes_functions((unsigned long) p->addr)) !=0)

whitespace broke.

Some people don't like the assign-then-test-it style.

> + return ret;
> if ((ret = arch_prepare_kprobe(p)) != 0) {
> goto rm_kprobe;
> }

hm, who put the unneeded braces in there?

> --- linux-2.6.13-rc1-mm1/include/linux/kprobes.h~kprobes-exclude-functions-generic 2005-07-06 18:51:16.000000000 +0530
> +++ linux-2.6.13-rc1-mm1-prasanna/include/linux/kprobes.h 2005-07-06 18:51:16.000000000 +0530
> @@ -42,6 +42,10 @@
> #define KPROBE_REENTER 0x00000004
> #define KPROBE_HIT_SSDONE 0x00000008
>
> +/* Attach to insert probes on any functions which should be ignored*/
> +#define __kprobes __attribute__((__section__(".kprobes.text")))
> +/* Is this address in the __kprobes functions? */
> +

What's that comment mean?


-
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/