This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
Re: [1/6 PATCH] Kprobes : Prevent possible race conditions genericchanges
- From: Andrew Morton <akpm at osdl dot org>
- To: prasanna at in dot ibm dot com
- Cc: ak at suse dot de, davem at davemloft dot net, systemtap at sources dot redhat dot com, linux-kernel at vger dot kernel dot org
- Date: Thu, 7 Jul 2005 03:25:37 -0700
- Subject: Re: [1/6 PATCH] Kprobes : Prevent possible race conditions genericchanges
- References: <20050707101015.GE12106@in.ibm.com>
Prasanna S Panchamukhi <prasanna@in.ibm.com> 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?