[PATCH] Kprobes: Fix to prevent possible race conditions

Andi Kleen ak@suse.de
Fri Jul 1 13:05:00 GMT 2005


Prasanna S Panchamukhi <prasanna@in.ibm.com> writes:

> diff -puN arch/i386/kernel/kprobes.c~kprobes-exclude-region arch/i386/kernel/kprobes.c
> --- linux-2.6.13-rc1/arch/i386/kernel/kprobes.c~kprobes-exclude-region	2005-07-01 18:01:23.000000000 +0530
> +++ linux-2.6.13-rc1-prasanna/arch/i386/kernel/kprobes.c	2005-07-01 18:01:23.000000000 +0530
> @@ -46,8 +46,27 @@ static long *jprobe_saved_esp;
>  /* copy of the kernel stack at the probe fire time */
>  static kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
>  void jprobe_return_end(void);
> +static void kprobes_arch_code_end(void);

This won't work with unit-at-a-time mode in the compiler 
which reorders functions freely.

You need to define a special section for all of this, similar to
what __sched does for scheduler functions and mark the functions
properly. 

Also don't you need to do the same for the page fault and exception
handlers? 

-Andi



More information about the Systemtap mailing list